xtd 1.0.0
Loading...
Searching...
No Matches
environment.hpp
Go to the documentation of this file.
1
4#pragma once
9#include "io/directory.hpp"
10#include "io/path.hpp"
12#include "as.hpp"
14#include "compiler.hpp"
15#include "core_export.hpp"
16#include "cpp_language.hpp"
17#include "enum.hpp"
19#include "event.hpp"
20#include "exit_status.hpp"
21#include "guid.hpp"
22#include "iequatable.hpp"
23#include "is.hpp"
24#include "operating_system.hpp"
25#include "platform_id.hpp"
26#include "processor.hpp"
29#include "size_of.hpp"
30#include "static.hpp"
31#include "string.hpp"
32#include "target_id.hpp"
33#include "target_type.hpp"
34#include "time_span.hpp"
35#include "toolkit.hpp"
36#include "usize.hpp"
37#include "version.hpp"
38#define __XTD_CORE_INTERNAL__
44#undef __XTD_CORE_INTERNAL__
45#include <cassert>
46
48// The following constant is defined in the file xtd_command.cmake.
49// If the target project is not built with cmake, the following constant must be defined by the build tool like this if the cmake_install_prefix is not modified; otherwise the cmake_install_prefix value:
50// | Constant | Windows Value | macOS | linux |
51// | ----------------- | ---------------------------- |--------------|--------------|
52// | __XTD_ROOT_PATH__ | "C:\Program Files (x86)\xtd" | "/usr/local" | "/usr/local" |
53// Remarks : If __XTD_ROOT_PATH__ is empty the environment variable XTD_ROOT_PATH is used. And if the environment variable XTD_ROOT_PATH is empty too the directory componant of xtd::diagnostics::source_location::current().file_name() is used.
54#if !defined(__XTD_ROOT_PATH__)
55# define __XTD_ROOT_PATH__ ""
56#endif
58
60namespace xtd {
72 class signal_catcher;
73 public:
149 enum class special_folder {
151 desktop = 0,
153 programs = 2,
155 my_documents = 5,
157 personal = 5,
159 favorites = 6,
163 recent = 8,
165 send_to = 9,
167 start_menu = 11,
169 my_music = 13,
171 my_videos = 14,
173 desktop_directory = 16,
175 my_computer = 17,
177 network_shortcuts = 19,
179 fonts = 20,
181 templates = 21,
183 common_start_menu = 22,
185 common_programs = 23,
187 common_startup = 24,
189 common_desktop_directory = 25,
191 application_data = 26,
193 printer_shortcuts = 27,
195 local_application_data = 28,
197 internet_cache = 32,
199 cookies = 33,
201 history = 34,
203 common_application_data = 35,
207 system = 37,
209 program_files = 38,
211 my_pictures = 39,
213 user_profile = 40,
215 system_x86 = 41,
217 program_files_x86 = 42,
219 common_program_files = 43,
221 common_program_files_x86 = 44,
223 common_templates = 45,
225 common_documents = 46,
227 common_admin_tools = 47,
229 admin_tools = 48,
231 common_music = 53,
233 common_pictures = 54,
235 common_videos = 55,
237 resources = 56,
239 localized_resources = 57,
241 common_oem_links = 58,
243 cd_burning = 59,
245 home = 64,
247 application_resources = 999,
249 xtd_install = 1000,
251 xtd_locale = 1001,
253 xtd_reference_guide = 1002,
255 xtd_themes = 1003,
257 xtd_include = 1004,
261 xtd_resources = 1006,
263 xtd_console_include = 1007,
265 xtd_console_libraries = 1008,
267 xtd_drawing_include = 1009,
269 xtd_drawing_libraries = 1010,
271 xtd_drawing_resources = 1011,
273 xtd_forms_include = 1012,
275 xtd_forms_libraries = 1013,
277 xtd_forms_resources = 1014,
279 xtd_tunit_include = 1015,
281 xtd_tunit_libraries = 1016,
282 };
283
288 none = 0,
290 do_not_verify = 16384,
292 create = 32768
293 };
294
296 class xtd_library final : public xtd::object, public xtd::iequatable<xtd_library> {
297 public:
299 xtd_library() = default;
300 xtd_library(const xtd_library&) = default;
301 xtd_library& operator =(const xtd_library&) = default;
303
305
309 [[nodiscard]] auto include_path() const noexcept -> const xtd::string&;
310
313 [[nodiscard]] auto library_path() const noexcept -> const xtd::string&;
314
317 [[nodiscard]] auto name() const noexcept -> const xtd::string&;
318
321 [[nodiscard]] auto resources_path() const noexcept -> const xtd::string&;
322
325 [[nodiscard]] auto version() const noexcept -> const xtd::version&;
327
329
331 [[nodiscard]] auto equals(const object& other) const noexcept -> bool override {return is<xtd_library>(other) && equals(static_cast<const xtd_library&>(other));}
332 [[nodiscard]] auto equals(const xtd_library& other) const noexcept -> bool override {return name_ == other.name_ && version_ == other.version_ && include_path_ == other.include_path_ && library_path_ == other.library_path_ && resources_path_ == other.resources_path_;}
333
334 [[nodiscard]] auto to_string() const noexcept -> xtd::string override;
336
337 private:
338 friend class environment;
339 xtd_library(const xtd::string& name, const xtd::version& version, const xtd::string& include_path, const xtd::string& library_path, const xtd::string& resources_path);
340 xtd::string name_;
341 xtd::version version_;
342 xtd::string include_path_;
343 xtd::string library_path_;
344 xtd::string resources_path_;
345 };
346
349
351
358 [[nodiscard]] static auto command_line() noexcept -> xtd::string;
359
362 [[nodiscard]] static auto compiler_version() noexcept -> xtd::compiler {
363 static auto compiler_id = __compiler_id;
364 static auto version = __compiler_version;
365 static auto build_type = __build_type;
367 return compiler;
368 }
369
372 [[nodiscard]] static auto cpp_version() noexcept -> xtd::cpp_language {
373 static auto cpp_language = __cpp_language;
374 return cpp_language;
375 }
376
381 [[nodiscard]] static auto current_directory() -> xtd::string;
382
389 static auto current_directory(const xtd::string& directory_name) -> void;
390
393 [[nodiscard]] static auto current_managed_thread_id() noexcept -> xtd::int32;
394
397 [[nodiscard]] static auto current_thread_id() noexcept -> xtd::intptr;
398
404 [[nodiscard]] static auto exit_code() noexcept -> xtd::int32;
410 static auto exit_code(xtd::int32 value) noexcept -> void;
411
415 [[nodiscard]] static auto has_shutdown_started() -> bool;
416
419 [[nodiscard]] static auto is_64_bit_operating_system() noexcept -> bool;
420
423 [[nodiscard]] static auto is_64_bit_process() noexcept -> bool;
424
428 [[nodiscard]] static auto locale() noexcept -> std::locale;
429
433 [[nodiscard]] static auto machine_name() -> xtd::string;
434
437 static auto new_line() noexcept -> xtd::string;
438
442 template<typename char_t, typename traits_t>
443 [[nodiscard]] static auto new_line(std::basic_ostream<char_t, traits_t>& os) -> std::basic_ostream<char_t, traits_t>& {
444 for (auto c : new_line())
445 os.put(os.widen(c));
446 return os;
447 }
448
451 [[nodiscard]] static auto os_version() noexcept -> xtd::operating_system;
452
455 [[nodiscard]] static auto processor_count() -> xtd::usize;
456
459 [[nodiscard]] static auto processor_information() -> xtd::processor;
460
463 [[nodiscard]] static auto stack_trace() -> xtd::string;
464
468 [[nodiscard]] static auto system_directory() -> xtd::string;
469
472 [[nodiscard]] static auto system_page_size() -> xtd::usize;
473
476 [[nodiscard]] static auto target_type() noexcept -> xtd::target_type {
477 return xtd::target_type(as<xtd::target_id>(__XTD_CURRENT_TARGET_ID__));
478 }
479
482 [[nodiscard]] static auto tick_count() -> xtd::time_span;
485 [[nodiscard]] static auto tick_count_milliseconds() -> xtd::int32;
486
489 [[nodiscard]] static auto toolkit_version() -> xtd::toolkit;
490
493 [[nodiscard]] static auto user_administrator() -> bool;
494
497 [[nodiscard]] static auto user_domain_name() -> xtd::string;
498
504 [[nodiscard]] static auto user_interactive() -> bool;
505
508 [[nodiscard]] static auto user_name() -> xtd::string;
509
512 [[nodiscard]] static auto version() noexcept -> xtd::version;
513
520 [[nodiscard]] static auto working_set() -> xtd::int64;
521
524 [[nodiscard]] static auto xtd_libraries() noexcept -> const xtd_library_collection&;
526
528
537
542
544
547 static auto abort() -> void;
548
551 [[noreturn]] static auto exit() -> void;
555 [[noreturn]] static auto exit(xtd::int32 exit_code) -> void;
558 [[noreturn]] static auto exit(xtd::exit_status exit_status) -> void;
559
564 [[nodiscard]] static auto expand_environment_variables(const xtd::string& name) -> xtd::string;
565
572 [[noreturn]] static auto fail_fast() noexcept -> void {fail_fast_(xtd::diagnostics::stack_trace {false}, xtd::null, &string::empty_string);}
582 [[noreturn]] static auto fail_fast(const xtd::string& message) noexcept -> void {fail_fast_(xtd::diagnostics::stack_trace {false}, &message, &string::empty_string);}
597 template<typename exception_t>
598 requires std::derived_from<xtd::raw_type<exception_t>, std::exception>
599 [[noreturn]] static auto fail_fast(const xtd::string& message, const exception_t& exception) -> void {fail_fast_(xtd::diagnostics::stack_trace {false}, &message, &exception);}
604 template<typename exception_t>
605 requires std::derived_from<xtd::raw_type<exception_t>, std::exception>
606 [[noreturn]] static auto fail_fast(const exception_t& exception) noexcept -> void {fail_fast_(xtd::diagnostics::stack_trace {false}, xtd::null, &exception);}
607
623 [[nodiscard]] static auto get_command_line_args() -> const xtd::argument_collection&;
624
631 [[nodiscard]] static auto get_environment_variable(const xtd::string& variable) -> xtd::string;
632
641 [[nodiscard]] static auto get_environment_variable(const xtd::string& variable, xtd::environment_variable_target target) -> xtd::string;
642
647
655
660 [[nodiscard]] static auto get_folder_path(environment::special_folder folder) -> xtd::string {return get_folder_path_(folder, environment::special_folder_option::none);}
661
667 [[nodiscard]] static auto get_folder_path(environment::special_folder folder, environment::special_folder_option option) -> xtd::string {return get_folder_path_(folder, option);}
668
672
675 [[noreturn]] static auto quick_exit() noexcept -> void;
679 [[noreturn]] static auto quick_exit(xtd::int32 exit_code) noexcept -> void;
682 [[noreturn]] static auto quick_exit(xtd::exit_status exit_status) noexcept -> void;
683
686 static auto raise(xtd::signal signal) -> void;
687
703 static auto set_command_line_args(const xtd::argument_collection& args) -> void;
704
711 static auto set_environment_variable(const xtd::string& variable, const xtd::string& value) -> void;
712
721 static auto set_environment_variable(const xtd::string& variable, const xtd::string& value, xtd::environment_variable_target target) -> void;
722
742 [[noreturn]] static auto unreachable() -> void {
743 assert(false && "xtd::environment::unreachable() was reached");
744 __xtd_unreachable();
745 }
746
747
748 private:
749 static auto on_cancel_signal(xtd::signal_cancel_event_args& e) -> void;
750 static auto on_program_exit(const xtd::program_exit_event_args& e) -> void;
751
752 [[noreturn]] static auto fail_fast_exit() -> void;
753 static auto fail_fast_flush() -> void;
754 static auto fail_fast_write_line(const xtd::string& str) -> void;
755 template<typename exception_t>
756 [[noreturn]] static auto fail_fast_(const xtd::diagnostics::stack_trace& st, const xtd::string* message, const exception_t* exception) -> void {
757 fail_fast_write_line("\n\nProcess terminated.");
758 if (message && !xtd::string::is_empty(*message)) fail_fast_write_line(*message);
759 fail_fast_write_line(st.to_string());
760 if (exception) {
761 if constexpr (std::derived_from<xtd::raw_type<exception_t>, xtd::exception>) fail_fast_write_line(xtd::string::format("{}: {} (Parameter '{}')", type_of<xtd::raw_type<exception_t>>(), xtd::raw_type<exception_t> {}.message(), exception->message()));
762 else if constexpr (std::derived_from<xtd::raw_type<exception_t>, std::exception>) fail_fast_write_line(xtd::string::format("{} (Parameter '{}')", type_of<xtd::raw_type<exception_t>>(), exception->what()));
763 }
764 fail_fast_flush();
765 fail_fast_exit();
766 }
767
768 [[nodiscard]] static auto get_folder_path_(environment::special_folder folder, environment::special_folder_option option, bool is_gui_application = target_type().is_gui_application()) -> xtd::string;
769 [[nodiscard]] static auto xtd_root_path() -> xtd::string {return xtd::io::path::get_full_path(string::is_empty(__XTD_ROOT_PATH__) ? (string::is_empty(get_environment_variable("XTD_ROOT_PATH")) ? io::path::get_full_path(io::path::combine(io::path::get_directory_name(xtd::diagnostics::source_location::current().file_name()), "..", "..")) : get_environment_variable("XTD_ROOT_PATH")) : __XTD_ROOT_PATH__);}
770 static signal_catcher signal_catcher_;
772 };
773}
774
776template<> struct xtd::enum_register<xtd::environment::special_folder> {
777 static auto values() noexcept {return xtd::enum_collection<xtd::environment::special_folder> {{xtd::environment::special_folder::desktop, "desktop"}, {xtd::environment::special_folder::programs, "programs"}, {xtd::environment::special_folder::my_documents, "my_documents"}, {xtd::environment::special_folder::favorites, "favorites"}, {xtd::environment::special_folder::startup, "startup"}, {xtd::environment::special_folder::recent, "recent"}, {xtd::environment::special_folder::send_to, "send_to"}, {xtd::environment::special_folder::start_menu, "start_menu"}, {xtd::environment::special_folder::my_music, "my_music"}, {xtd::environment::special_folder::my_videos, "my_videos"}, {xtd::environment::special_folder::desktop_directory, "desktop_directory"}, {xtd::environment::special_folder::my_computer, "my_computer"}, {xtd::environment::special_folder::network_shortcuts, "network_shortcuts"}, {xtd::environment::special_folder::fonts, "fonts"}, {xtd::environment::special_folder::templates, "templates"}, {xtd::environment::special_folder::common_start_menu, "common_start_menu"}, {xtd::environment::special_folder::common_programs, "common_programs"}, {xtd::environment::special_folder::common_startup, "common_startup"}, {xtd::environment::special_folder::common_desktop_directory, "common_desktop_directory"}, {xtd::environment::special_folder::application_data, "application_data"}, {xtd::environment::special_folder::printer_shortcuts, "printer_shortcuts"}, {xtd::environment::special_folder::local_application_data, "local_application_data"}, {xtd::environment::special_folder::internet_cache, "internet_cache"}, {xtd::environment::special_folder::cookies, "cookies"}, {xtd::environment::special_folder::history, "history"}, {xtd::environment::special_folder::common_application_data, "common_application_data"}, {xtd::environment::special_folder::windows, "windows"}, {xtd::environment::special_folder::system, "system"}, {xtd::environment::special_folder::program_files, "program_files"}, {xtd::environment::special_folder::my_pictures, "my_pictures"}, {xtd::environment::special_folder::user_profile, "user_profile"}, {xtd::environment::special_folder::system_x86, "system_x86"}, {xtd::environment::special_folder::program_files_x86, "program_files_x86"}, {xtd::environment::special_folder::common_program_files, "common_program_files"}, {xtd::environment::special_folder::common_program_files_x86, "common_program_files_x86"}, {xtd::environment::special_folder::common_templates, "common_templates"}, {xtd::environment::special_folder::common_documents, "common_documents"}, {xtd::environment::special_folder::common_admin_tools, "common_admin_tools"}, {xtd::environment::special_folder::admin_tools, "admin_tools"}, {xtd::environment::special_folder::common_music, "common_music"}, {xtd::environment::special_folder::common_pictures, "common_pictures"}, {xtd::environment::special_folder::common_videos, "common_videos"}, {xtd::environment::special_folder::resources, "resources"}, {xtd::environment::special_folder::localized_resources, "localized_resources"}, {xtd::environment::special_folder::common_oem_links, "common_oem_links"}, {xtd::environment::special_folder::cd_burning, "cd_burning"}, {xtd::environment::special_folder::home, "home"}, {xtd::environment::special_folder::application_resources, "application_resources"}, {xtd::environment::special_folder::xtd_install, "xtd_install"}, {xtd::environment::special_folder::xtd_locale, "xtd_locale"}, {xtd::environment::special_folder::xtd_reference_guide, "xtd_reference_guide"}, {xtd::environment::special_folder::xtd_themes, "xtd_themes"}, {xtd::environment::special_folder::xtd_include, "xtd_include"}, {xtd::environment::special_folder::xtd_libraries, "xtd_libraries"}, {xtd::environment::special_folder::xtd_resources, "xtd_resources"}, {xtd::environment::special_folder::xtd_console_include, "xtd_console_include"}, {xtd::environment::special_folder::xtd_console_libraries, "xtd_console_libraries"}, {xtd::environment::special_folder::xtd_drawing_include, "xtd_drawing_include"}, {xtd::environment::special_folder::xtd_drawing_libraries, "xtd_drawing_libraries"}, {xtd::environment::special_folder::xtd_drawing_resources, "xtd_drawing_resources"}, {xtd::environment::special_folder::xtd_forms_include, "xtd_forms_include"}, {xtd::environment::special_folder::xtd_forms_libraries, "xtd_forms_libraries"}, {xtd::environment::special_folder::xtd_forms_resources, "xtd_forms_resources"}, {xtd::environment::special_folder::xtd_tunit_include, "xtd_tunit_include"}, {xtd::environment::special_folder::xtd_tunit_libraries, "xtd_tunit_libraries"}};}
778};
779
780template<> struct xtd::enum_register<xtd::environment::special_folder_option> {
782};
Contains xtd::argument_collection alias.
Contains xtd::as method.
Contains availability versions.
static const basic_string empty_string
Definition basic_string.hpp:119
static auto is_empty(const xtd::basic_string< value_type, traits_type, allocator_type > &string) noexcept -> bool
Definition basic_string.hpp:1232
Represents information about c++ libraries, such as the version and standard identifier....
Definition compiler.hpp:27
Represents information about c++ libraries, such as the version and language identifier....
Definition cpp_language.hpp:26
static auto current(const __xtd_source_location__ &value=__xtd_source_location__::current()) noexcept -> xtd::diagnostics::source_location
Crates a new xtd::diagnostics::source_location object corresponding to the location of the call site.
Represents a stack trace, which is an ordered collection of one or more stack frames.
Definition stack_trace.hpp:40
Represents a xtd library that contains name, version and paths.
Definition environment.hpp:296
auto library_path() const noexcept -> const xtd::string &
Gets The library path of the library.
auto resources_path() const noexcept -> const xtd::string &
Gets The resource path of the library.
auto to_string() const noexcept -> xtd::string override
Returns a xtd::string that represents the current object.
auto version() const noexcept -> const xtd::version &
Gets The version of the library.
auto include_path() const noexcept -> const xtd::string &
Gets The inlcude path of the library.
auto name() const noexcept -> const xtd::string &
Gets The name of the library.
auto equals(const object &other) const noexcept -> bool override
Determines whether the specified object is equal to the current object.
Definition environment.hpp:331
The environment class.
Definition environment.hpp:71
static auto get_environment_variable(const xtd::string &variable, xtd::environment_variable_target target) -> xtd::string
Retrieves the value of an environment variable from the current process or from the Windows operating...
static event< environment, program_exit_event_handler > program_exit
Occurs when the terminates normally (via xtd::environment::exit or returning from the main function).
Definition environment.hpp:540
static auto get_environment_variable(const xtd::string &variable) -> xtd::string
Retrieves the value of an environment variable from the current process.
static auto current_managed_thread_id() noexcept -> xtd::int32
Gets a unique identifier for the current managed thread.
static auto system_page_size() -> xtd::usize
Gets the number of bytes in the operating system's memory page.
static auto working_set() -> xtd::int64
Gets the amount of physical memory mapped to the process context.
static auto exit() -> void
Terminates this process and returns an exit code to the operating system.
static auto abort() -> void
Causes abnormal program termination unless xtd::signal::abnormal_termination is being caught by a xtd...
static auto xtd_libraries() noexcept -> const xtd_library_collection &
Gets an xtd::environment::xtd_library array that represent the xtd libraries name,...
static auto user_interactive() -> bool
Gets a value indicating whether the current process is running in user interactive mode.
static auto user_administrator() -> bool
Gets a value indicating whether the current user is an administrator.
static auto get_environment_variables(xtd::environment_variable_target target) -> xtd::collections::specialized::string_dictionary
Retrieves all environment variable names and their values from the current process,...
static auto set_environment_variable(const xtd::string &variable, const xtd::string &value) -> void
Creates, modifies, or deletes an environment variable stored in the current process.
special_folder
Specifies enumerated constants used to retrieve directory paths to system special folders.
Definition environment.hpp:149
@ common_startup
The file system directory that contains the programs that appear in the Startup folder for all users....
Definition environment.hpp:187
@ xtd_locale
The xtd locale folder.
Definition environment.hpp:251
@ printer_shortcuts
The file system directory that contains the link objects that can exist in the Printers virtual folde...
Definition environment.hpp:193
@ windows
The Windows directory or SYSROOT. This corresponds to the windir% or SYSTEMROOT% environment variable...
Definition environment.hpp:205
@ home
The file system directory that contains home folder.
Definition environment.hpp:245
@ xtd_drawing_libraries
The xtd::drawing libraries folder.
Definition environment.hpp:269
@ local_application_data
The directory that serves as a common repository for application-specific data that is used by the cu...
Definition environment.hpp:195
@ my_computer
The My Computer folder. The MyComputer constant always yields the empty string ("") because no path i...
Definition environment.hpp:175
@ user_profile
The user's profile folder. Applications should not create files or folders at this level; they should...
Definition environment.hpp:213
@ xtd_console_libraries
The xtd::console libraries folder.
Definition environment.hpp:265
@ common_application_data
The directory that serves as a common repository for application-specific data that is used by all us...
Definition environment.hpp:203
@ xtd_forms_resources
The xtd::forms resources folder.
Definition environment.hpp:277
@ xtd_forms_libraries
The xtd::forms libraries folder.
Definition environment.hpp:275
@ xtd_reference_guide
The xtd reference guide folder.
Definition environment.hpp:253
@ localized_resources
The file system directory that contains localized resource data.
Definition environment.hpp:239
@ common_program_files
The directory for components that are shared across applications.To get the x86 common program files ...
Definition environment.hpp:219
@ program_files
The program files directory.On a non-x86 system, passing ProgramFiles to the GetFolderPath method ret...
Definition environment.hpp:209
@ history
The directory that serves as a common repository for Internet history items.
Definition environment.hpp:201
@ xtd_console_include
The xtd::console include folder.
Definition environment.hpp:263
@ xtd_resources
The xtd resources folder.
Definition environment.hpp:261
@ common_videos
The file system directory that serves as a repository for video files common to all users.
Definition environment.hpp:235
@ common_admin_tools
The file system directory that contains administrative tools for all users of the computer.
Definition environment.hpp:227
@ programs
The directory that contains the user's program groups.
Definition environment.hpp:153
@ system
The System directory.
Definition environment.hpp:207
@ resources
The file system directory that contains resource data.
Definition environment.hpp:237
@ cookies
The directory that serves as a common repository for Internet cookies.
Definition environment.hpp:199
@ admin_tools
The file system directory that is used to store administrative tools for an individual user....
Definition environment.hpp:229
@ xtd_tunit_libraries
The xtd::tunit libraries folder.
Definition environment.hpp:281
@ common_desktop_directory
The file system directory that contains files and folders that appear on the desktop for all users....
Definition environment.hpp:189
@ common_start_menu
The file system directory that contains the programs and folders that appear on the Start menu for al...
Definition environment.hpp:183
@ xtd_drawing_include
The xtd::drawing include folder.
Definition environment.hpp:267
@ common_pictures
The file system directory that serves as a repository for image files common to all users.
Definition environment.hpp:233
@ my_music
The My Music folder.
Definition environment.hpp:169
@ desktop_directory
The directory used to physically store file objects on the desktop. Do not confuse this directory wit...
Definition environment.hpp:173
@ common_programs
A folder for components that are shared across applications. This special folder is valid only for Wi...
Definition environment.hpp:185
@ xtd_tunit_include
The xtd::tunit include folder.
Definition environment.hpp:279
@ xtd_include
The xtd inlude folder.
Definition environment.hpp:257
@ recent
The directory that contains the user's most recently used documents.
Definition environment.hpp:163
@ common_music
The file system directory that serves as a repository for music files common to all users.
Definition environment.hpp:231
@ my_pictures
The My Pictures folder.
Definition environment.hpp:211
@ fonts
A virtual folder that contains fonts.
Definition environment.hpp:179
@ xtd_install
The installation folder of xtd.
Definition environment.hpp:249
@ system_x86
The Windows System folder.
Definition environment.hpp:215
@ start_menu
The directory that contains the Start menu items.
Definition environment.hpp:167
@ my_documents
The My Documents folder. This member is equivalent to Personal.
Definition environment.hpp:155
@ xtd_forms_include
The xtd::forms include folder.
Definition environment.hpp:273
@ common_program_files_x86
The Program Files folder.
Definition environment.hpp:221
@ favorites
The directory that serves as a common repository for the user's favorite items.
Definition environment.hpp:159
@ desktop
The logical Desktop rather than the physical file system location.
Definition environment.hpp:151
@ network_shortcuts
A file system directory that contains the link objects that may exist in the My Network Places virtua...
Definition environment.hpp:177
@ internet_cache
The directory that serves as a common repository for temporary Internet files.
Definition environment.hpp:197
@ common_templates
The file system directory that contains the templates that are available to all users....
Definition environment.hpp:223
@ application_resources
The application resources folder.
Definition environment.hpp:247
@ send_to
The directory that contains the Send To menu items.
Definition environment.hpp:165
@ xtd_drawing_resources
The xtd::drawing resources folder.
Definition environment.hpp:271
@ application_data
The directory that serves as a common repository for application-specific data for the current roamin...
Definition environment.hpp:191
@ program_files_x86
The Program Files folder On an x86 system, passing the ProgramFilesX86 member to the Environment....
Definition environment.hpp:217
@ cd_burning
The file system directory that acts as a staging area for files waiting to be written to a CD.
Definition environment.hpp:243
@ startup
The directory that corresponds to the user's Startup program group. The system starts these programs ...
Definition environment.hpp:161
@ xtd_themes
The xtd themes folder.
Definition environment.hpp:255
@ common_oem_links
This value is recognized in Windows Vista for backward compatibility, but the special folder itself i...
Definition environment.hpp:241
@ my_videos
The file system directory that serves as a repository for videos that belong to a user.
Definition environment.hpp:171
@ common_documents
The file system directory that contains documents that are common to all users. This special folder i...
Definition environment.hpp:225
@ xtd_libraries
The xtd libraries folder.
Definition environment.hpp:259
@ templates
The directory that serves as a common repository for document templates.
Definition environment.hpp:181
static auto get_command_line_args() -> const xtd::argument_collection &
Returns a string array containing the command-line arguments for the current process.
static auto get_logical_drives() -> xtd::collections::specialized::string_collection
Returns an array of string containing the names of the logical drives on the current computer.
static auto current_thread_id() noexcept -> xtd::intptr
Gets a unique identifier for the current thread.
static auto raise(xtd::signal signal) -> void
Sends xtd::signal to the program. The xtd::environment::cancel_signal event is invoked with the speci...
static auto system_directory() -> xtd::string
Gets the fully qualified path of the system directory.
static auto has_shutdown_started() -> bool
Gets a value that indicates whether the current application domain is shutting down.
static auto quick_exit() noexcept -> void
Terminates this process and returns an exit code to the operating system without completely cleaning ...
static auto cpp_version() noexcept -> xtd::cpp_language
Gets an xtd::cpp_language object that contains the current c++ standard identifier and version number...
Definition environment.hpp:372
static auto user_domain_name() -> xtd::string
Gets the network domain name associated with the current user.
static auto toolkit_version() -> xtd::toolkit
Gets the current toolkit version.
static auto get_environment_variables() -> xtd::collections::specialized::string_dictionary
Retrieves all environment variable names and their values from the current process.
static event< environment, signal_cancel_event_handler > cancel_signal
Occurs when a signal is sent to the current process.
Definition environment.hpp:536
static auto target_type() noexcept -> xtd::target_type
Gets an xtd::target_type object that contains the current target identifier.
Definition environment.hpp:476
static auto fail_fast() noexcept -> void
Immediately terminates the process .
Definition environment.hpp:572
static auto fail_fast(const xtd::string &message) noexcept -> void
Immediately terminates the process before reporting an error message. For Windows,...
Definition environment.hpp:582
static auto fail_fast(const xtd::string &message, const exception_t &exception) -> void
Immediately terminates the process before reporting an error message. For Windows,...
Definition environment.hpp:599
xtd::collections::generic::list< xtd_library > xtd_library_collection
Represents a xtd libraries collection.
Definition environment.hpp:348
static auto tick_count_milliseconds() -> xtd::int32
Gets the number of milliseconds elapsed since the system started.
static auto set_command_line_args(const xtd::argument_collection &args) -> void
Sets the command-line arguments for the current process.
static auto get_folder_path(environment::special_folder folder, environment::special_folder_option option) -> xtd::string
Gets the path to the system special folder that is identified by the specified enumeration,...
Definition environment.hpp:667
special_folder_option
Specifies options to use for getting the path to a special folder.
Definition environment.hpp:286
@ none
The path to the folder is verified. If the folder exists, the path is returned. If the folder does no...
Definition environment.hpp:288
@ create
The path to the folder is created if it does not already exist.
Definition environment.hpp:292
@ do_not_verify
The path to the folder is returned without verifying whether the path exists. If the folder is locate...
Definition environment.hpp:290
static auto is_64_bit_operating_system() noexcept -> bool
Determines whether the current operating system is a 64-bit operating system.
static auto current_directory() -> xtd::string
Gets the fully qualified path of the current working directory.
static auto stack_trace() -> xtd::string
Gets current stack trace information.
static auto expand_environment_variables(const xtd::string &name) -> xtd::string
Replaces the name of each environment variable embedded in the specified string with the string equiv...
static auto processor_count() -> xtd::usize
Gets the number of processors on the current machine.
static auto version() noexcept -> xtd::version
Gets a version consisting of the major, minor, build, and revision numbers of the xtd framework.
static auto os_version() noexcept -> xtd::operating_system
Gets an xtd::operating_system object that contains the current platform identifier and version number...
static auto fail_fast(const exception_t &exception) noexcept -> void
Immediately terminates the process..
Definition environment.hpp:606
static auto current_directory(const xtd::string &directory_name) -> void
Sets the fully qualified path of the current working directory.
static auto locale() noexcept -> std::locale
Gets a copy of the global C++ locale, which is the locale most recently used as the argument to See s...
static auto tick_count() -> xtd::time_span
Gets the number of milliseconds elapsed since the system started.
static auto machine_name() -> xtd::string
Gets the NetBIOS name of this local computer.
static auto command_line() noexcept -> xtd::string
Gets the command line for this process.
static auto user_name() -> xtd::string
Gets the user name of the person who is currently logged on to the operating system.
static auto get_folder_path(environment::special_folder folder) -> xtd::string
Gets the path to the system special folder that is identified by the specified enumeration.
Definition environment.hpp:660
static auto new_line() noexcept -> xtd::string
Gets the newline string defined for this environment.
static auto is_64_bit_process() noexcept -> bool
Determines whether the current process is a 64-bit process.
static auto processor_information() -> xtd::processor
Gets an xtd::processor object that contains the processor identifier.
static auto compiler_version() noexcept -> xtd::compiler
Gets an xtd::compiler object that contains the current compiler identifier and version number.
Definition environment.hpp:362
static auto exit_code() noexcept -> xtd::int32
Gets the exit code of the process.
Represents an event.
Definition event.hpp:23
Defines the base class for predefined exceptions in the xtd namespace.
Definition exception.hpp:34
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:23
static auto get_full_path(const xtd::string &path) -> xtd::string
Returns the absolute path for the specified path string.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:40
Represents information about an operating system, such as the version and platform identifier....
Definition operating_system.hpp:25
Represents information about a processor, such as the architecture. This class cannot be inherited.
Definition processor.hpp:19
Provides data for the environment program exit event. This class cannot be inherited.
Definition program_exit_event_args.hpp:16
Provides data for the environment signal event. This class cannot be inherited.
Definition signal_cancel_event_args.hpp:18
Defines the xtd::startup object that can be used in the main method to safely call the application's ...
Definition startup.hpp:22
Represents information about target type, such as the target identifier. This class cannot be inherit...
Definition target_type.hpp:17
Represents a time interval.
Definition time_span.hpp:29
Represents a toolkit.
Definition toolkit.hpp:19
Contains xtd::compiler class.
Contains core_export_ keyword.
Contains xtd::cpp_language class.
auto() -> void
Signals a breakpoint to an attached debugger.
Definition debugger.hpp:75
Contains xtd::io::directory class.
Contains enum_ and enum_ut_ keywords.
Contains xtd::environment_variable_target enum class.
Contains xtd::event event.
Contains xtd::exit_status enum class.
static auto unreachable() -> void
The function unreachable expands to a void expression. Executing unreachable() results in undefined b...
Definition environment.hpp:742
xtd::delegate< void(const program_exit_event_args &)> program_exit_event_handler
Represents the method that will handle the program exit events of a xtd::environment.
Definition program_exit_event_handler.hpp:24
xtd::delegate< void(signal_cancel_event_args &)> signal_cancel_event_handler
Represents the method that will handle the signal events of a xtd::environment.
Definition signal_cancel_event_handler.hpp:24
static auto format(const basic_string< char > &fmt, args_t &&... args) -> basic_string
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition static.hpp:38
#define core_export_
Define shared library export.
Definition core_export.hpp:13
#define args_
Returns a string array containing the command-line arguments for the current process.
Definition args.hpp:65
xtd::collections::generic::dictionary< xtd::string, xtd::string > string_dictionary
Represents a xtd::collections::generic::dictionary with the key and the value strongly typed to be st...
Definition string_dictionary.hpp:28
xtd::collections::generic::list< xtd::string > string_collection
Represents a collection of strings.
Definition string_collection.hpp:27
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
std::int64_t int64
Represents a 64-bit signed integer.
Definition int64.hpp:23
null_ptr null
Represents a null pointer value.
std::intmax_t intptr
Represent a pointer or a handle.
Definition intptr.hpp:23
std::int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:25
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
std::remove_cvref_t< value_t > raw_type
Represents a raw type alias equivalent to std::remove_cvref_t<value_t>.
Definition raw_type.hpp:25
std::vector< std::pair< enum_t, xtd::string > > enum_collection
Represents a pair of an enum_t value and a string of an enum of type enum_t.
Definition enum_collection.hpp:24
signal
Specifies signals that can interrupt the current process.
Definition signal.hpp:18
auto as(any_object &o) -> type_t
Casts a type into another type.
Definition __as_any_object.hpp:60
auto is(xtd::any value) -> bool
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:485
exit_status
Specifies exit status for the xtd::environment::exit method.
Definition exit_status.hpp:18
environment_variable_target
Specifies the location where an environment variable is stored or retrieved in a set or get operation...
Definition environment_variable_target.hpp:15
build_type
Identifies the build type.
Definition build_type.hpp:20
xtd::array< xtd::string > argument_collection
Represents the collection of arguments passed to the main entry point method.
Definition argument_collection.hpp:19
compiler_id
Identifies the compiler, supported by an assembly.
Definition compiler_id.hpp:20
@ other
The operating system is other.
Definition platform_id.hpp:60
@ none
No modifier key.
Definition console_modifiers.hpp:22
@ home
The HOME key.
Definition console_key.hpp:44
@ c
The C key.
Definition console_key.hpp:92
Contains xtd::guid class.
Contains xtd::iequatable interface.
Contains xtd::is method.
Contains xtd::collections::generic::list <type_t> class.
The xtd::collections namespace contains interfaces and classes that define various collections of obj...
Definition any_pair.hpp:10
The xtd::windows namespaces including animation clients, user interface controls, data binding,...
Definition forms_namespace_aliases.hpp:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
auto size_of() noexcept -> xtd::usize
Used to obtain the size in bytes of the object representation of type or expression.
Definition size_of.hpp:21
auto equals(const object &obj) const noexcept -> bool override
Determines whether the specified object is equal to the current object.
Definition read_only_span.hpp:235
Contains xtd::operating_system class.
Contains xtd::io::path class.
Contains xtd::platform_id enum class.
Contains xtd::processor class.
Contains xtd::program_exit_event_handler event handler.
Contains xtd::signal_cancel_event_handler event handler.
Contains xtd::size_of methods.
Contains xtd::diagnostics::stack_trace class.
Contains xtd::static_object class.
Contains xtd::string alias.
Contains xtd::collections::specialized::string_collection alias.
Contains xtd::collections::specialized::string_dictionary alias.
Contains xtd::target_id enum class.
Contains xtd::target_type class.
Contains xtd::time_span class.
Contains xtd::toolkit class.
Contains xtd::usize type.
Contains xtd::version class.