xtd 0.2.0
xtd::operating_system Class Referencefinal

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.

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. More...
 
 operating_system (xtd::platform_id platform, const xtd::version &version, const xtd::ustring &service_pack)
 Initializes a new instance of the operating_system class, using the specified platform identifier value and version object. More...
 
 operating_system (xtd::platform_id platform, const xtd::version &version, const xtd::ustring &service_pack, const xtd::ustring &desktop_environment)
 Initializes a new instance of the operating_system class, using the specified platform identifier value and version object. More...
 
 operating_system (xtd::platform_id platform, const xtd::version &version, const xtd::ustring &service_pack, const xtd::ustring &desktop_environment, const xtd::ustring &desktop_theme)
 Initializes a new instance of the operating_system class, using the specified platform identifier value and version object. More...
 
 operating_system (xtd::platform_id platform, const xtd::version &version, const xtd::ustring &service_pack, const xtd::ustring &desktop_environment, const xtd::ustring &desktop_theme, bool is_64_bit)
 Initializes a new instance of the operating_system class, using the specified platform identifier value and version object. More...
 
 operating_system (xtd::platform_id platform, const xtd::version &version, const xtd::ustring &service_pack, const xtd::ustring &desktop_environment, const xtd::ustring &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. More...
 

Properties

xtd::ustring desktop_environment () const noexcept
 Gets the desktop environment. More...
 
xtd::ustring desktop_theme () const noexcept
 Gets the desktop theme. More...
 
xtd::distribution distribution () const noexcept
 Gets the distribution. More...
 
xtd::ustring name () const noexcept
 Gets the concatenated string representation of the platform identifier. More...
 
xtd::platform_id platform () const noexcept
 Gets a xtd::platform_id enumeration value that identifies the operating system platform. More...
 
xtd::ustring service_pack () const noexcept
 Gets the service pack version represented by this operating_system object. More...
 
const xtd::versionversion () const noexcept
 Gets a xtd::version object that identifies the operating system. More...
 
xtd::ustring 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. More...
 

Methods

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

Additional Inherited Members

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

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::ustring 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::ustring service_pack,
const xtd::ustring 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::ustring service_pack,
const xtd::ustring desktop_environment,
const xtd::ustring 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::ustring service_pack,
const xtd::ustring desktop_environment,
const xtd::ustring 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::ustring service_pack,
const xtd::ustring desktop_environment,
const xtd::ustring 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::ustring 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".

◆ desktop_theme()

xtd::ustring 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.

◆ 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_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_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_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_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.

◆ name()

xtd::ustring 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::ustring 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.

◆ to_string()

xtd::ustring 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.

◆ 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::ustring 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.

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