xtd 0.2.0
Loading...
Searching...
No Matches
xtd::operating_system Class Referencefinal
Inheritance diagram for xtd::operating_system:
xtd::object

Definition

Represents information about an operating system, such as the version and platform identifier. This class cannot be inherited.

Namespace
xtd
Library
xtd.core
Remarks
The operating_system class contains information about an operating system.
For information about the current runtime operating system, retrieve the operating_system object returned by the xtd::environment::os_version method.
By design, the operating_system class is not a general purpose means of describing an operating system, and you cannot derive a more inclusive type from the operating_system class. If you need a type to contain other information about an operating system, create your own type, then include a field of type operating_system and any additional fields or methods that you require.

Public Constructors

 operating_system (xtd::platform_id platform, const xtd::version &version)
 Initializes a new instance of the operating_system class, using the specified platform identifier value and version object.
 
 operating_system (xtd::platform_id platform, const xtd::version &version, const xtd::string &service_pack)
 Initializes a new instance of the operating_system class, using the specified platform identifier value and version object.
 
 operating_system (xtd::platform_id platform, const xtd::version &version, const xtd::string &service_pack, const xtd::string &desktop_environment)
 Initializes a new instance of the operating_system class, using the specified platform identifier value and version object.
 
 operating_system (xtd::platform_id platform, const xtd::version &version, const xtd::string &service_pack, const xtd::string &desktop_environment, const xtd::string &desktop_theme)
 Initializes a new instance of the operating_system class, using the specified platform identifier value and version object.
 
 operating_system (xtd::platform_id platform, const xtd::version &version, const xtd::string &service_pack, const xtd::string &desktop_environment, const xtd::string &desktop_theme, bool is_64_bit)
 Initializes a new instance of the operating_system class, using the specified platform identifier value and version object.
 
 operating_system (xtd::platform_id platform, const xtd::version &version, const xtd::string &service_pack, const xtd::string &desktop_environment, const xtd::string &desktop_theme, bool is_64_bit, const xtd::distribution &distribution)
 Initializes a new instance of the operating_system class, using the specified platform identifier value and version object.
 

Public Properties

xtd::string desktop_environment () const noexcept
 Gets the desktop environment.
 
xtd::string desktop_theme () const noexcept
 Gets the desktop theme.
 
xtd::distribution distribution () const noexcept
 Gets the distribution.
 
xtd::string name () const noexcept
 Gets the concatenated string representation of the platform identifier.
 
xtd::platform_id platform () const noexcept
 Gets a xtd::platform_id enumeration value that identifies the operating system platform.
 
xtd::string service_pack () const noexcept
 Gets the service pack version represented by this operating_system object.
 
const xtd::versionversion () const noexcept
 Gets a xtd::version object that identifies the operating system.
 
xtd::string version_string () const noexcept
 Gets the concatenated string representation of the platform identifier, version, and service pack that are currently installed on the operating system.
 

Public Methods

bool is_64_bit () const noexcept
 Determines whether the current operating system is a 64-bit operating system.
 
bool is_android () const noexcept
 Determines whether the current platform is Android.
 
bool is_free_bsd () const noexcept
 Determines whether the current platform is FreeBSD.
 
bool is_ios () const noexcept
 Determines whether the current platform is iOS.
 
bool is_linux () const noexcept
 Determines whether the current platform is Linux.
 
bool is_macos () const noexcept
 Determines whether the current platform is macOS.
 
bool is_macos_platform () const noexcept
 Determines whether the current platform is macOS family.
 
bool is_mingw () const noexcept
 Determines whether the current platform is MINGW.
 
bool is_msys () const noexcept
 Determines whether the current platform is MSYS.
 
bool is_posix () const noexcept
 Determines whether the current platform is Posix.
 
bool is_posix_platform () const noexcept
 Determines whether the current platform is Posix family.
 
bool is_unix_platform () const noexcept
 Determines whether the current platform is Unix family.
 
bool is_tvos () const noexcept
 Determines whether the current platform is tvOS family.
 
bool is_watchos () const noexcept
 Determines whether the current platform is watchOS.
 
bool is_windows () const noexcept
 Determines whether the current platform is Windows.
 
bool is_windows_ce () const noexcept
 Determines whether the current platform is Windows CE.
 
bool is_windows_platform () const noexcept
 Determines whether the current platform is Windows family.
 
bool is_xbox () const noexcept
 Determines whether the current platform is xbox.
 
xtd::string to_string () const noexcept override
 Converts the value of this operating_system object to its equivalent string representation.
 

Additional Inherited Members

- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object.
 
virtual bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object.
 
virtual size_t get_hash_code () const noexcept
 Serves as a hash function for a particular type.
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance.
 
template<typename object_t >
xtd::uptr< object_t > memberwise_clone () const
 Creates a shallow copy of the current object.
 
- Static Public Member Functions inherited from xtd::object
template<typename object_a_t , typename object_b_t >
static bool equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 
template<typename object_a_t , typename object_b_t >
static bool reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are the same instance.
 

Constructor & Destructor Documentation

◆ operating_system() [1/6]

xtd::operating_system::operating_system ( xtd::platform_id  platform,
const xtd::version version 
)

Initializes a new instance of the operating_system class, using the specified platform identifier value and version object.

Parameters
platformOne of the xtd::platform_id values that indicates the operating system platform.
versionA Version object that indicates the version of the operating system.
Exceptions
ArgumentNullExceptionversion is null.
ArgumentExceptionplatform is not a xtd::platform_id enumeration value.

◆ operating_system() [2/6]

xtd::operating_system::operating_system ( xtd::platform_id  platform,
const xtd::version version,
const xtd::string service_pack 
)

Initializes a new instance of the operating_system class, using the specified platform identifier value and version object.

Parameters
platformOne of the xtd::platform_id values that indicates the operating system platform.
versionA Version object that indicates the version of the operating system.
service_packA string, such as "Service Pack 3", that represent the service pack. If no Service Pack has been installed, the string must be empty.
Exceptions
ArgumentNullExceptionversion is null.
ArgumentExceptionplatform is not a xtd::platform_id enumeration value.

◆ operating_system() [3/6]

xtd::operating_system::operating_system ( xtd::platform_id  platform,
const xtd::version version,
const xtd::string service_pack,
const xtd::string desktop_environment 
)

Initializes a new instance of the operating_system class, using the specified platform identifier value and version object.

Parameters
platformOne of the xtd::platform_id values that indicates the operating system platform.
versionA Version object that indicates the version of the operating system.
service_packA string, such as "Service Pack 3", that represent the service pack. If no Service Pack has been installed, the string must be empty.
desktop_environmentA string, such as "gnome", "kde", "windows", "macos".
Exceptions
ArgumentNullExceptionversion is null.
ArgumentExceptionplatform is not a xtd::platform_id enumeration value.

◆ operating_system() [4/6]

xtd::operating_system::operating_system ( xtd::platform_id  platform,
const xtd::version version,
const xtd::string service_pack,
const xtd::string desktop_environment,
const xtd::string desktop_theme 
)

Initializes a new instance of the operating_system class, using the specified platform identifier value and version object.

Parameters
platformOne of the xtd::platform_id values that indicates the operating system platform.
versionA Version object that indicates the version of the operating system.
service_packA string, such as "Service Pack 3", that represent the service pack. If no Service Pack has been installed, the string must be empty.
desktop_environmentA string, such as "gnome", "kde", "windows", "macos".
desktop_themeA string, such as "Adwaita", "Breeze", "windows dark", "macos dark", ...
Exceptions
ArgumentNullExceptionversion is null.
ArgumentExceptionplatform is not a xtd::platform_id enumeration value.

◆ operating_system() [5/6]

xtd::operating_system::operating_system ( xtd::platform_id  platform,
const xtd::version version,
const xtd::string service_pack,
const xtd::string desktop_environment,
const xtd::string desktop_theme,
bool  is_64_bit 
)

Initializes a new instance of the operating_system class, using the specified platform identifier value and version object.

Parameters
platformOne of the xtd::platform_id values that indicates the operating system platform.
versionA Version object that indicates the version of the operating system.
service_packA string, such as "Service Pack 3", that represent the service pack. If no Service Pack has been installed, the string must be empty.
desktop_environmentA string, such as "gnome", "kde", "windows", "macos".
desktop_themeA string, such as "Adwaita", "Breeze", "windows dark", "macos dark", ...
is_64_bitTrue if Operating System is 64 bits; otherwise false.
Exceptions
ArgumentNullExceptionversion is null.
ArgumentExceptionplatform is not a xtd::platform_id enumeration value.

◆ operating_system() [6/6]

xtd::operating_system::operating_system ( xtd::platform_id  platform,
const xtd::version version,
const xtd::string service_pack,
const xtd::string desktop_environment,
const xtd::string desktop_theme,
bool  is_64_bit,
const xtd::distribution distribution 
)

Initializes a new instance of the operating_system class, using the specified platform identifier value and version object.

Parameters
platformOne of the xtd::platform_id values that indicates the operating system platform.
versionA Version object that indicates the version of the operating system.
service_packA string, such as "Service Pack 3", that represent the service pack. If no Service Pack has been installed, the string must be empty.
desktop_environmentA string, such as "gnome", "kde", "windows", "macos".
desktop_themeA string, such as "Adwaita", "Breeze", "windows dark", "macos dark", ...
is_64_bitTrue if Operating System is 64 bits; otherwise false.
distributionAn xtd::distribution that contains the operating system distribution informations.
Exceptions
ArgumentNullExceptionversion is null.
ArgumentExceptionplatform is not a xtd::platform_id enumeration value.

Member Function Documentation

◆ desktop_environment()

xtd::string xtd::operating_system::desktop_environment ( ) const
noexcept

Gets the desktop environment.

Returns
string The desktop environment for the operating system, if not found empty string ("").
Remarks
On Windows is always "windows".
On macOS is always "macos".
On linux it can be "budgie", "cinnamon", "deepin", "Enlightenment", "étoilé", "gnome", "kde", "lxqt", "mate", "pantheon", "razor-qt", "unity", "xfce".
Examples
strings.cpp.

◆ desktop_theme()

xtd::string xtd::operating_system::desktop_theme ( ) const
noexcept

Gets the desktop theme.

Returns
string The desktop theme for the operating system, if not found empty string ("").
Remarks
On Windows is "windows" or "windows dark".
On macOS is "macos" or 'macos dark'.
On linux it can be "Adwaita", "Adwaita-dark", "Breeze", "Breeze-Dark", "Yaru", "Yaru-dark", "Yaru-light", ...

◆ distribution()

xtd::distribution xtd::operating_system::distribution ( ) const
noexcept

Gets the distribution.

Returns
An xtd::distribution that contains the operating system distribution informations.

◆ name()

xtd::string xtd::operating_system::name ( ) const
noexcept

Gets the concatenated string representation of the platform identifier.

Returns
The string representation of the values returned by the platform.

◆ platform()

xtd::platform_id xtd::operating_system::platform ( ) const
noexcept

Gets a xtd::platform_id enumeration value that identifies the operating system platform.

Returns
xtd::platform_id One of the xtd::platform_id values.

◆ service_pack()

xtd::string xtd::operating_system::service_pack ( ) const
noexcept

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 ("").
Remarks
A service pack is used to distribute software updates for the operating system on which it is installed. However, not every operating system uses service packs.
The service pack version, if available, is already correctly formatted for display.

◆ version()

const xtd::version & xtd::operating_system::version ( ) const
noexcept

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

Returns
Version A Version object that describes the major version, minor version, build, and revision numbers for the operating system.
Remarks
For Window system only: See http://msdn.microsoft.com/library/windows/desktop/ms724832.aspx on the Windows Dev Center for a list of Windows operating system versions and their corresponding version numbers.

◆ version_string()

xtd::string xtd::operating_system::version_string ( ) const
noexcept

Gets the concatenated string representation of the platform identifier, version, and service pack that are currently installed on the operating system.

Returns
The string representation of the values returned by the platform, version, and service_pack methods.
Remarks
By default, the value returned by version_string is the same as the value returned by the to_string method.

◆ is_64_bit()

bool xtd::operating_system::is_64_bit ( ) const
noexcept

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

Returns
true if the operating system is 64-bit; otherwise, false.

◆ is_android()

bool xtd::operating_system::is_android ( ) const
noexcept

Determines whether the current platform is Android.

Returns
true if the current platform is Android; otherwise, false.

◆ is_free_bsd()

bool xtd::operating_system::is_free_bsd ( ) const
noexcept

Determines whether the current platform is FreeBSD.

Returns
true if the current platform is Android; otherwise, false.

◆ is_ios()

bool xtd::operating_system::is_ios ( ) const
noexcept

Determines whether the current platform is iOS.

Returns
true if the current platform is iOS; otherwise, false.

◆ is_linux()

bool xtd::operating_system::is_linux ( ) const
noexcept

Determines whether the current platform is Linux.

Returns
true if the current platform is Linux; otherwise, false.

◆ is_macos()

bool xtd::operating_system::is_macos ( ) const
noexcept

Determines whether the current platform is macOS.

Returns
true if the current platform is macOS; otherwise, false.

◆ is_macos_platform()

bool xtd::operating_system::is_macos_platform ( ) const
noexcept

Determines whether the current platform is macOS family.

Returns
true if the current platform is macOS family; otherwise, false.

◆ is_mingw()

bool xtd::operating_system::is_mingw ( ) const
noexcept

Determines whether the current platform is MINGW.

Returns
true if the current platform is MINGW; otherwise, false.

◆ is_msys()

bool xtd::operating_system::is_msys ( ) const
noexcept

Determines whether the current platform is MSYS.

Returns
true if the current platform is MSYS; otherwise, false.

◆ is_posix()

bool xtd::operating_system::is_posix ( ) const
noexcept

Determines whether the current platform is Posix.

Returns
true if the current platform is Posix; otherwise, false.

◆ is_posix_platform()

bool xtd::operating_system::is_posix_platform ( ) const
noexcept

Determines whether the current platform is Posix family.

Returns
true if the current platform is Posix family; otherwise, false.

◆ is_unix_platform()

bool xtd::operating_system::is_unix_platform ( ) const
noexcept

Determines whether the current platform is Unix family.

Returns
true if the current platform is Unix family; otherwise, false.

◆ is_tvos()

bool xtd::operating_system::is_tvos ( ) const
noexcept

Determines whether the current platform is tvOS family.

Returns
true if the current platform is macOS family; otherwise, false.

◆ is_watchos()

bool xtd::operating_system::is_watchos ( ) const
noexcept

Determines whether the current platform is watchOS.

Returns
true if the current platform is watchOS; otherwise, false.

◆ is_windows()

bool xtd::operating_system::is_windows ( ) const
noexcept

Determines whether the current platform is Windows.

Returns
true if the current platform is Windows; otherwise, false.

◆ is_windows_ce()

bool xtd::operating_system::is_windows_ce ( ) const
noexcept

Determines whether the current platform is Windows CE.

Returns
true if the current platform is Windows CE; otherwise, false.

◆ is_windows_platform()

bool xtd::operating_system::is_windows_platform ( ) const
noexcept

Determines whether the current platform is Windows family.

Returns
true if the current platform is Windows family; otherwise, false.

◆ is_xbox()

bool xtd::operating_system::is_xbox ( ) const
noexcept

Determines whether the current platform is xbox.

Returns
true if the current platform is xbox; otherwise, false.

◆ to_string()

xtd::string xtd::operating_system::to_string ( ) const
overridevirtualnoexcept

Converts the value of this operating_system object to its equivalent string representation.

Returns
The string representation of the values returned by the platform, version, and service_pack methods.

Reimplemented from xtd::object.


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