xtd 0.2.0
Loading...
Searching...
No Matches
xtd::native::environment Class Referencefinal

Definition

Contains environment native API.

Namespace
xtd::native
Library
xtd.core.native
Warning
Internal use only

Protected Static Methods

static int32_t at_quick_exit (void(*on_quick_exit)(void))
 Registers the function pointed to by func to be called on quick program termination (via xtd::native::environment::quick_exit).
 
static std::vector< std::string > get_command_line_args ()
 Returns a string array containing the command-line arguments for the current process.
 
static std::string get_desktop_environment ()
 Gets the desktop environment name.
 
static std::string get_desktop_theme ()
 Gets the desktop theme name.
 
static std::string get_distribution_bug_report ()
 Gets the distribution bug report url.
 
static std::string get_distribution_code_name ()
 Gets the distribution code name.
 
static std::string get_distribution_description ()
 Gets the distribution description.
 
static std::string get_distribution_home ()
 Gets the distribution home url.
 
static std::string get_distribution_id ()
 Gets the distribution identifier.
 
static std::vector< std::string > get_distribution_like_ids ()
 Gets the distribution like identifiers array.
 
static std::string get_distribution_name ()
 Gets the distribution name.
 
static void get_distribution_version (int32_t &major, int32_t &minor, int32_t &build, int32_t &revision)
 Gets a xtd::version object that identifies the distribution.
 
static std::string get_distribution_version_string ()
 Gets the distribution version string.
 
static std::map< std::string, std::string > & get_environment_variables (int32_t 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.
 
static std::string get_environment_variable (const std::string &variable, int32_t target)
 Retrieves the value of an environment variable from the current process.
 
static std::string get_know_folder_path (int32_t csidl)
 Gets the path to the system special folder that is identified by the specified enumeration.
 
static std::string get_machine_name ()
 Gets the NetBIOS name of this local computer.
 
static int32_t get_os_platform_id ()
 Gets a platform id that identifies the operating system platform.
 
static void get_os_version (int32_t &major, int32_t &minor, int32_t &build, int32_t &revision)
 Gets a xtd::version object that identifies the operating system.
 
static uint32_t get_processor_count ()
 Gets the number of processors on the current machine.
 
static std::string get_resources_path (bool gui_app)
 Gets the path of the resources folder.
 
static std::string get_service_pack ()
 Gets the service pack version represented by this operating_system object.
 
static size_t get_system_page_size ()
 Gets the number of bytes in the operating system's memory page.
 
static uint32_t get_tick_count ()
 Gets the number of milliseconds elapsed since the system started.
 
static bool get_user_administrator ()
 Gets a value indicating whether the current user is an administrator.
 
static std::string get_user_domain_name ()
 Gets the network domain name associated with the current user.
 
static std::string get_user_name ()
 Gets the user name of the person who is currently logged on to the operating system.
 
static bool has_shutdown_started ()
 Gets a value that indicates whether the current application domain is shutting down.
 
static bool is_processor_arm ()
 Determines whether the current processor is arm.
 
static bool is_os_64_bit ()
 Determines whether the current operating system is a 64-bit operating system.
 
static std::string new_line ()
 Gets the newline string defined for this environment.
 
static void quick_exit (int32_t exit_code) noexcept
 Terminates this process and returns an exit code to the operating system without completely cleaning the resources..
 
static void set_environment_variable (const std::string &name, const std::string &value, int32_t target)
 Creates or modifies an environment variable stored in the current process.
 
static void unset_environment_variable (const std::string &name, int32_t target)
 Deletes an environment variable stored in the current process.
 
static int64_t working_set ()
 Gets the amount of physical memory mapped to the process context.
 

Member Function Documentation

◆ at_quick_exit()

static int32_t xtd::native::environment::at_quick_exit ( void(*)(void)  on_quick_exit)
staticprotected

Registers the function pointed to by func to be called on quick program termination (via xtd::native::environment::quick_exit).

Parameters
on_quick_exitpointer to a function to be called on quick program termination.
Returns
0​ if the registration succeeds, nonzero value otherwise.
Warning
Internal use only

◆ get_command_line_args()

static std::vector< std::string > xtd::native::environment::get_command_line_args ( )
staticprotected

Returns a string array containing the command-line arguments for the current process.

Returns
An array of string where each element contains a command-line argument. The first element is the executable file name, and the following zero or more elements contain the remaining command-line arguments.
Warning
Internal use only

◆ get_desktop_environment()

static std::string xtd::native::environment::get_desktop_environment ( )
staticprotected

Gets the desktop environment name.

Returns
std::string A string containing desktop environment name.
Remarks
Returns "windows" on Windows, "macos" on macOS, "budgie" or "cinnamon" or "deepin" or "Enlightenment", "étoilé" or "gnome" or "kde" or "lxqt" or "mate" or "pantheon" or "razor" or "unity" or "xfce" on linux.
Return "" if not found or defined.
Warning
Internal use only

◆ get_desktop_theme()

static std::string xtd::native::environment::get_desktop_theme ( )
staticprotected

Gets the desktop theme name.

Returns
std::string A string containing desktop theme name.
Remarks
Returns a string, such as "Adwaita", "Breeze", "windows dark", "macos dark", ...
Return "" if not found or defined.
Warning
Internal use only

◆ get_distribution_bug_report()

static std::string xtd::native::environment::get_distribution_bug_report ( )
staticprotected

Gets the distribution bug report url.

Returns
std::string A string containing distribution bug report url.
Remarks
Return "" if not found or defined.
Warning
Internal use only

◆ get_distribution_code_name()

static std::string xtd::native::environment::get_distribution_code_name ( )
staticprotected

Gets the distribution code name.

Returns
std::string A string containing distribution code name.
Remarks
Return "" if not found or defined.
Warning
Internal use only

◆ get_distribution_description()

static std::string xtd::native::environment::get_distribution_description ( )
staticprotected

Gets the distribution description.

Returns
std::string A string containing distribution description.
Remarks
Return "" if not found or defined.
Warning
Internal use only

◆ get_distribution_home()

static std::string xtd::native::environment::get_distribution_home ( )
staticprotected

Gets the distribution home url.

Returns
std::string A string containing distribution home url.
Remarks
Returns "Windows" on Windows, "macOS" on macOS, "Ubuntu", "Rocky Linux", ...
Return "" if not found or defined.
Warning
Internal use only

◆ get_distribution_id()

static std::string xtd::native::environment::get_distribution_id ( )
staticprotected

Gets the distribution identifier.

Returns
std::string A string containing distribution identifier.
Remarks
Return "" if not found or defined.
Warning
Internal use only

◆ get_distribution_like_ids()

static std::vector< std::string > xtd::native::environment::get_distribution_like_ids ( )
staticprotected

Gets the distribution like identifiers array.

Returns
std::string A string containing distribution like identifiers array.
Remarks
Return {} if not found or defined.
Warning
Internal use only

◆ get_distribution_name()

static std::string xtd::native::environment::get_distribution_name ( )
staticprotected

Gets the distribution name.

Returns
std::string A string containing distribution name.
Remarks
Returns "Windows" on Windows, "macOS" on macOS, "Ubuntu", "Rocky Linux", ...
Return "" if not found or defined.
Warning
Internal use only

◆ get_distribution_version()

static void xtd::native::environment::get_distribution_version ( int32_t &  major,
int32_t &  minor,
int32_t &  build,
int32_t &  revision 
)
staticprotected

Gets a xtd::version object that identifies the distribution.

Parameters
majorreturn the major version.
minorreturn the minor version, build, and revision numbers for the distribution.
buildreturn the build.
revisionreturn the revision numbers for the distribution.
Warning
Internal use only

◆ get_distribution_version_string()

static std::string xtd::native::environment::get_distribution_version_string ( )
staticprotected

Gets the distribution version string.

Returns
std::string A string containing distribution version string.
Remarks
Return "" if not found or defined.
Warning
Internal use only

◆ get_environment_variables()

static std::map< std::string, std::string > & xtd::native::environment::get_environment_variables ( int32_t  target)
staticprotected

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.

Parameters
targetThe environment variable target (see environment_variable_target.h file).
Returns
std::map A dictionary that contains all environment variable names and their values from the source specified by the target parameter; otherwise, an empty dictionary if no environment variables are found.
Warning
Internal use only

◆ get_environment_variable()

static std::string xtd::native::environment::get_environment_variable ( const std::string &  variable,
int32_t  target 
)
staticprotected

Retrieves the value of an environment variable from the current process.

Parameters
variableThe name of the environment variable.
Returns
std::string The value of the environment variable specified by variable, or empty "" if the environment variable is not found.
Warning
Internal use only

◆ get_know_folder_path()

static std::string xtd::native::environment::get_know_folder_path ( int32_t  csidl)
staticprotected

Gets the path to the system special folder that is identified by the specified enumeration.

Parameters
csidlSystem special folder identifier (see constant_special_item_id_list.h file).
Returns
The path to the specified system special folder, if that folder physically exists on your computer; otherwise, an empty string ("").
Warning
Internal use only

◆ get_machine_name()

static std::string xtd::native::environment::get_machine_name ( )
staticprotected

Gets the NetBIOS name of this local computer.

Returns
A string containing the name of this computer.
Warning
Internal use only

◆ get_os_platform_id()

static int32_t xtd::native::environment::get_os_platform_id ( )
staticprotected

Gets a platform id that identifies the operating system platform.

Returns
Operating system platform identifier (see platform_ids.h file).
Warning
Internal use only

◆ get_os_version()

static void xtd::native::environment::get_os_version ( int32_t &  major,
int32_t &  minor,
int32_t &  build,
int32_t &  revision 
)
staticprotected

Gets a xtd::version object that identifies the operating system.

Parameters
majorreturn the major version.
minorreturn the minor version, build, and revision numbers for the operating system.
buildreturn the build.
revisionreturn the revision numbers for the operating system.
Warning
Internal use only

◆ get_processor_count()

static uint32_t xtd::native::environment::get_processor_count ( )
staticprotected

Gets the number of processors on the current machine.

Returns
The 32-bit unsigned integer that specifies the number of processors on the current machine. There is no default. If the current machine contains multiple processor groups, this property returns the number of logical processors that are available for use.
Warning
Internal use only

◆ get_resources_path()

static std::string xtd::native::environment::get_resources_path ( bool  gui_app)
staticprotected

Gets the path of the resources folder.

Returns
A string that represents the path of the resources folder.
Warning
Internal use only

◆ get_service_pack()

static std::string xtd::native::environment::get_service_pack ( )
staticprotected

Gets the service pack version represented by this operating_system object.

Returns
string The service pack version, if service packs are supported and at least one is installed; otherwise, an empty string ("").
Warning
Internal use only

◆ get_system_page_size()

static size_t xtd::native::environment::get_system_page_size ( )
staticprotected

Gets the number of bytes in the operating system's memory page.

Returns
The number of bytes in the system memory page.
Warning
Internal use only

◆ get_tick_count()

static uint32_t xtd::native::environment::get_tick_count ( )
staticprotected

Gets the number of milliseconds elapsed since the system started.

Returns
A 32-bit unsigned integer containing the amount of time in milliseconds that has passed since the last time the computer was started.
Warning
Internal use only

◆ get_user_administrator()

static bool xtd::native::environment::get_user_administrator ( )
staticprotected

Gets a value indicating whether the current user is an administrator.

Returns
bool true if the current user is an administrator; otherwise, false.
Warning
Internal use only

◆ get_user_domain_name()

static std::string xtd::native::environment::get_user_domain_name ( )
staticprotected

Gets the network domain name associated with the current user.

Returns
The network domain name associated with the current user.
Warning
Internal use only

◆ get_user_name()

static std::string xtd::native::environment::get_user_name ( )
staticprotected

Gets the user name of the person who is currently logged on to the operating system.

Returns
The user name of the person who is logged on to the operating system.
Warning
Internal use only

◆ has_shutdown_started()

static bool xtd::native::environment::has_shutdown_started ( )
staticprotected

Gets a value that indicates whether the current application domain is shutting down.

Returns
bool true if the current application domain is shutting down; otherwise, false.
Warning
Internal use only

◆ is_processor_arm()

static bool xtd::native::environment::is_processor_arm ( )
staticprotected

Determines whether the current processor is arm.

Returns
true if the processor is is arm; otherwise, false.
Warning
Internal use only

◆ is_os_64_bit()

static bool xtd::native::environment::is_os_64_bit ( )
staticprotected

Determines whether the current operating system is a 64-bit operating system.

Returns
true if the operating system is 64-bit; otherwise, false.
Warning
Internal use only

◆ new_line()

static std::string xtd::native::environment::new_line ( )
staticprotected

Gets the newline string defined for this environment.

Returns
A string containing "\r\n" for non-Unix platforms, or a string containing "\n" for Unix platforms.
Warning
Internal use only

◆ quick_exit()

static void xtd::native::environment::quick_exit ( int32_t  exit_code)
staticprotectednoexcept

Terminates this process and returns an exit code to the operating system without completely cleaning the resources..

Parameters
exit_codeThe exit code to return to the operating system. Use 0 (zero) to indicate that the process completed successfully.
Warning
Internal use only

◆ set_environment_variable()

static void xtd::native::environment::set_environment_variable ( const std::string &  name,
const std::string &  value,
int32_t  target 
)
staticprotected

Creates or modifies an environment variable stored in the current process.

Parameters
variableThe name of an environment variable.
valueA value to assign to variable.
Warning
Internal use only

◆ unset_environment_variable()

static void xtd::native::environment::unset_environment_variable ( const std::string &  name,
int32_t  target 
)
staticprotected

Deletes an environment variable stored in the current process.

Parameters
variableThe name of an environment variable.
Warning
Internal use only

◆ working_set()

static int64_t xtd::native::environment::working_set ( )
staticprotected

Gets the amount of physical memory mapped to the process context.

Returns
Int64 A 64-bit signed integer containing the number of bytes of physical memory mapped to the process context.
Warning
Internal use only

The documentation for this class was generated from the following file: