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.
Public Member Functions | List of all members
xtd::operating_system Class Referencefinal

#include <operating_system.h>

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.

Inherits xtd::object.

Public Member Functions

 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, bool is_64_bit)
 Initializes a new instance of the operating_system class, using the specified platform identifier value and version object. More...
 
xtd::ustring desktop_environment () const
 Gets the desktop environment . More...
 
bool is_64_bit () const noexcept
 Determines whether the current operating system is a 64-bit operating system. More...
 
bool is_linux_platform () const noexcept
 Determines whether the current platform is Unix family. More...
 
bool is_macos_platform () const noexcept
 Determines whether the current platform is macOS family. More...
 
bool is_windows_platform () const noexcept
 Determines whether the current platform is Windows family. 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...
 
xtd::ustring to_string () const noexcept
 Converts the value of this operating_system object to its equivalent string representation. 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...
 
- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object. More...
 
virtual 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...
 
template<typename object_t >
std::unique_ptr< object_t > memberwise_clone () const
 Gets the type of the current instance. More...
 

Additional Inherited Members

- 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/4]

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

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/4]

xtd::operating_system::operating_system ( xtd::platform_id  platform,
const xtd::version version,
const xtd::ustring service_pack 
)
inline

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/4]

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

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/4]

xtd::operating_system::operating_system ( xtd::platform_id  platform,
const xtd::version version,
const xtd::ustring service_pack,
const xtd::ustring desktop_environment,
bool  is_64_bit 
)
inline

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.

Member Function Documentation

◆ desktop_environment()

xtd::ustring xtd::operating_system::desktop_environment ( ) const
inline

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".

◆ is_64_bit()

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

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

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

◆ is_linux_platform()

bool xtd::operating_system::is_linux_platform ( ) const
inlinenoexcept

Determines whether the current platform is Unix family.

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

◆ is_macos_platform()

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

Determines whether the current platform is macOS family.

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

◆ is_windows_platform()

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

Determines whether the current platform is Windows family.

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

◆ name()

xtd::ustring xtd::operating_system::name ( ) const
inlinenoexcept

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
inlinenoexcept

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
inlinenoexcept

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
inlinevirtualnoexcept

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
inlinenoexcept

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
inlinenoexcept

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: