xtd - Reference Guide
0.1.1
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
|
#include <environment.h>
The environment class.
Inherits xtd::static_object.
Static Public Member Functions | |
static xtd::ustring | command_line () |
Gets the command line for this process. More... | |
static xtd::compiler | compiler_version () |
Gets an cpp_standard object that contains the current c++ standard identifier and version number. More... | |
static xtd::cpp_language | cpp_version () |
Gets an cpp_standard object that contains the current c++ standard identifier and version number. More... | |
static xtd::ustring | current_directory () |
Gets the fully qualified path of the current working directory. More... | |
static void | current_directory (const xtd::ustring &directory_name) |
Sets the fully qualified path of the current working directory. More... | |
static std::thread::id | current_thread_id () |
Gets a unique identifier for the current thread. More... | |
static void | exit (int exit_code) |
Terminates this process and returns an exit code to the operating system. More... | |
static int | exit_code () |
Gets the exit code of the process. More... | |
static void | exit_code (int value) |
Sets the exit code of the process. More... | |
static xtd::ustring | expand_environment_variables (const xtd::ustring &name) |
Replaces the name of each environment variable embedded in the specified string with the string equivalent of the value of the variable, then returns the resulting string. More... | |
static xtd::collections::specialized::string_vector | get_command_line_args () |
Returns a string array containing the command-line arguments for the current process. More... | |
static xtd::ustring | get_environment_variable (const xtd::ustring &variable) |
Retrieves the value of an environment variable from the current process. More... | |
static xtd::ustring | get_environment_variable (const xtd::ustring &variable, environment_variable_target target) |
Retrieves the value of an environment variable from the current process or from the Windows operating system registry key for the current user or local machine. More... | |
static std::map< std::string, std::string > & | get_environment_variables () |
Retrieves all environment variable names and their values from the current process. More... | |
static std::map< std::string, std::string > & | get_environment_variables (environment_variable_target target) |
Retrieves all environment variable names and their values from the current process, or from the Windows operating system registry key for the current user or local machine. More... | |
static xtd::ustring | get_folder_path (environment::special_folder folder) |
Gets the path to the system special folder that is identified by the specified enumeration. More... | |
static xtd::ustring | get_folder_path (environment::special_folder folder, environment::special_folder_option option) |
Gets the path to the system special folder that is identified by the specified enumeration, and uses a specified option for accessing special folders. More... | |
static xtd::collections::specialized::string_vector | get_logical_drives () |
Returns an array of string containing the names of the logical drives on the current computer. More... | |
static bool | is_64_bit_operating_system () |
Determines whether the current operating system is a 64-bit operating system. More... | |
static bool | is_64_bit_process () |
Determines whether the current process is a 64-bit process. More... | |
static xtd::ustring | machine_name () |
Gets the NetBIOS name of this local computer. More... | |
static xtd::ustring | new_line () |
Gets the newline string defined for this environment. More... | |
template<class Char , class Traits > | |
static std::basic_ostream< Char, Traits > & | new_line (std::basic_ostream< Char, Traits > &os) |
Inserts a new-line character and flushes the stream. More... | |
static xtd::operating_system | os_version () |
Gets an operating_system object that contains the current platform identifier and version number. More... | |
static uint32_t | processor_count () |
Gets the number of processors on the current machine. More... | |
static xtd::processor | processor_information () |
Gets an operating_system object that contains the current platform identifier and version number. More... | |
static void | set_environment_variable (const xtd::ustring &variable, const xtd::ustring &value) |
Creates, modifies, or deletes an environment variable stored in the current process. More... | |
static void | set_environment_variable (const xtd::ustring &variable, const xtd::ustring &value, environment_variable_target target) |
Creates, modifies, or deletes an environment variable stored in the current process or in the Windows operating system registry key reserved for the current user or local machine. More... | |
static xtd::ustring | stack_trace () |
Gets current stack trace information. More... | |
static xtd::ustring | system_directory () |
Gets the fully qualified path of the system directory. More... | |
static size_t | system_page_size () |
Gets the number of bytes in the operating system's memory page. More... | |
static std::chrono::milliseconds | tick_count () |
Gets the number of milliseconds elapsed since the system started. More... | |
static xtd::ustring | user_domain_name () |
Gets the network domain name associated with the current user. More... | |
static bool | user_interactive () |
Gets a value indicating whether the current process is running in user interactive mode. More... | |
static xtd::ustring | user_name () |
Gets the user name of the person who is currently logged on to the operating system. More... | |
static xtd::version | version () |
Gets a version consisting of the major, minor, build, and revision numbers of the xtd framework. More... | |
|
strong |
Specifies enumerated constants used to retrieve directory paths to system special folders.
Name | android | iOS | Linux | macOS | Windows |
---|---|---|---|---|---|
desktop | /home/${User}/Desktop | /Users/${User}/Desktop | /home/${User}/Desktop | /Users/${User}/Desktop | C:\Users\${User}\Desktop |
programs | C:\Users\${User}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs | ||||
my_documents | /home/${User} | /Users/${User} | /home/${User} | /Users/${User} | C:\Users\${User}\Documents |
personal | /home/${User} | /Users/${User} | /home/${User} | /Users/${User} | C:\Users\${User}\Documents |
favorites | /Users/${User}/Library/Favorites | /Users/${User}/Library/Favorites | C:\Users\${User}\Favorites | ||
startup | C:\Users\${User}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup | ||||
recent | C:\Users\${User}\AppData\Roaming\Microsoft\Windows\Recent | ||||
send_to | C:\Users\${User}\AppData\Roaming\Microsoft\Windows\SendTo | ||||
start_menu | C:\Users\${User}\AppData\Roaming\Microsoft\Windows\Start Menu | ||||
my_music | /home/${User}/Music | /Users/${User}/Music | /home/${User}/Music | /Users/${User}/Music | C:\Users\${User}\Music |
my_videos | /home/${User}/Videos | /Users/${User}/Videos | /home/${User}/Videos | /Users/${User}/Videos | C:\Users\${User}\Videos |
desktop_directory | /home/${User}/Desktop | /Users/${User}/Desktop | /home/${User}/Desktop | /Users/${User}/Desktop | C:\Users\${User}\Desktop |
my_computer | |||||
network_shortcuts | C:\Users\${User}\AppData\Roaming\Microsoft\Windows\Network Shortcuts | ||||
fonts | /home/${User}/.fonts | /Users/${User}/Library/Fonts | /home/${User}/.fonts | /Users/${User}/Library/Fonts | C:\Windows\Fonts |
templates | /home/${User}/Templates | /Users/${User}/Templates | /home/${User}/Templates | /Users/${User}/Templates | C:\Users\${User}\AppData\Roaming\Microsoft\Windows\Templates |
common_start_menu | C:\ProgramData\Microsoft\Windows\Start Menu | ||||
common_programs | C:\ProgramData\Microsoft\Windows\Start Menu\Programs | ||||
common_startup | C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup | ||||
common_desktop_directory | C:\Users\Public\Desktop | ||||
application_data | /home/${User}/.config | /Users/${User}/.config | /home/${User}/.config | /Users/${User}/.config | C:\Users\${User}\AppData\Roaming |
printer_shortcuts | C:\Users\${User}\AppData\Roaming\Microsoft\Windows\Printer Shortcuts | ||||
local_application_data | /home/${User}/.local/share | /Users/${User}/.local/share | /home/${User}/.local/share | /Users/${User}/.local/share | C:\Users\${User}\AppData\Local |
internet_cache | /Users/${User}/Library/Caches | /Users/${User}/Library/Caches | C:\Users\${User}\AppData\Local\Microsoft\Windows\Temporary Internet Files | ||
cookies | C:\Users\${User}\AppData\Roaming\Microsoft\Windows\Cookies | ||||
history | C:\Users\${User}\AppData\Local\Microsoft\Windows\History | ||||
common_application_data | /usr/share | /usr/share | /usr/share | /usr/share | C:\ProgramData |
windows | C:\Windows | ||||
system | /System | C:\Windows\system32 | |||
program_files | /Applications | /Applications | C:\Program Files (x86) | ||
my_pictures | /home/${User}/Pictures | /Users/${User}/Pictures | /home/${User}/Pictures | /Users/${User}/Pictures | C:\Users\${User}\Pictures |
user_profile | /home/${User} | /Users/${User} | /home/${User} | /Users/${User} | C:\Users\${User} |
system_x86 | C:\Windows\SysWOW64 | ||||
program_files_x86 | C:\Program Files (x86) | ||||
common_program_files | C:\Program Files (x86)\Common Files | ||||
common_program_files_x86 | C:\Program Files (x86)\Common Files | ||||
common_templates | /usr/share/templates | /usr/share/templates | /usr/share/templates | /usr/share/templates | C:\ProgramData\Microsoft\Windows\Templates |
common_documents | C:\Users\Public\Documents | ||||
common_admin_tools | C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools | ||||
admin_tools | C:\Users\${User}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Administrative Tools | ||||
common_music | C:\Users\Public\Music | ||||
common_pictures | C:\Users\Public\Pictures | ||||
common_videos | C:\Users\Public\Videos | ||||
resources | C:\Windows\resources | ||||
localized_resources | |||||
common_oem_links | |||||
cd_burning | C:\Users\${User}\AppData\Local\Microsoft\Windows\Burn\Burn |
|
strong |
Specifies options to use for getting the path to a special folder.
|
inlinestatic |
Gets the command line for this process.
|
inlinestatic |
Gets an cpp_standard object that contains the current c++ standard identifier and version number.
|
inlinestatic |
Gets an cpp_standard object that contains the current c++ standard identifier and version number.
|
static |
Gets the fully qualified path of the current working directory.
|
static |
Sets the fully qualified path of the current working directory.
directory_name | A string containing a directory path. |
|
inlinestatic |
Gets a unique identifier for the current thread.
|
inlinestatic |
Terminates this process and returns an exit code to the operating system.
exit_code | The exit code to return to the operating system. Use 0 (zero) to indicate that the process completed successfully. |
|
static |
Gets the exit code of the process.
|
static |
Sets the exit code of the process.
value | A 32-bit signed integer containing the exit code. The default value is 0 (zero), which indicates that the process completed successfully. |
|
inlinestatic |
Replaces the name of each environment variable embedded in the specified string with the string equivalent of the value of the variable, then returns the resulting string.
name | A string containing the names of zero or more environment variables. Each environment variable is quoted with the percent sign character (%). |
|
static |
Returns a string array containing the command-line arguments for the current process.
Input at the command line | Resulting command line arguments |
---|---|
MyApp alpha beta | MyApp, alpha, beta |
MyApp "alpha with spaces" "beta with spaces" | MyApp, alpha with spaces, beta with spaces |
MyApp 'alpha with spaces' beta | MyApp, 'alpha, with, spaces', beta |
MyApp \\alpha \\"beta | MyApp, \\alpha, \beta |
MyApp \\"alpha "beta | MyApp, \"alpha, "beta |
|
inlinestatic |
Retrieves the value of an environment variable from the current process.
variable | The name of the environment variable. |
|
static |
Retrieves the value of an environment variable from the current process or from the Windows operating system registry key for the current user or local machine.
variable | The name of an environment variable. |
target | One of the EnvironmentVariableTarget values. |
std::invalid_argument | target is not a valid environment_variable_target value. |
|
inlinestatic |
Retrieves all environment variable names and their values from the current process.
|
static |
Retrieves all environment variable names and their values from the current process, or from the Windows operating system registry key for the current user or local machine.
target | One of the environment_variable_target values. |
std::invalid_argument | target is not a valid environment_variable_target value. |
|
inlinestatic |
Gets the path to the system special folder that is identified by the specified enumeration.
folder | One of enumeration values that identifies a system special folder. |
|
static |
Gets the path to the system special folder that is identified by the specified enumeration, and uses a specified option for accessing special folders.
folder | One of the enumeration values that identifies a system special folder. |
option | One of the enumeration values that specifies options to use for accessing a special folder. |
|
inlinestatic |
Returns an array of string containing the names of the logical drives on the current computer.
|
inlinestatic |
Determines whether the current operating system is a 64-bit operating system.
|
inlinestatic |
Determines whether the current process is a 64-bit process.
|
static |
Gets the NetBIOS name of this local computer.
|
static |
Gets the newline string defined for this environment.
|
inlinestatic |
Inserts a new-line character and flushes the stream.
os | Output stream object affected. Because this function is a manipulator, it is designed to be used alone with no arguments in conjunction with the insertion (<<) operations on output streams (see example below). |
|
static |
Gets an operating_system object that contains the current platform identifier and version number.
|
inlinestatic |
Gets the number of processors on the current machine.
|
static |
Gets an operating_system object that contains the current platform identifier and version number.
|
inlinestatic |
Creates, modifies, or deletes an environment variable stored in the current process.
variable | The name of an environment variable. |
value | A value to assign to variable. |
|
static |
Creates, modifies, or deletes an environment variable stored in the current process or in the Windows operating system registry key reserved for the current user or local machine.
variable | The name of an environment variable. |
value | A value to assign to variable. |
|
inlinestatic |
Gets current stack trace information.
|
inlinestatic |
Gets the fully qualified path of the system directory.
|
static |
Gets the number of bytes in the operating system's memory page.
|
static |
Gets the number of milliseconds elapsed since the system started.
|
static |
Gets the network domain name associated with the current user.
|
inlinestatic |
Gets a value indicating whether the current process is running in user interactive mode.
|
static |
Gets the user name of the person who is currently logged on to the operating system.
|
static |
Gets a version consisting of the major, minor, build, and revision numbers of the xtd framework.