xtd 1.0.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

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

Public Methods

auto is_64_bit () const noexcept -> bool
 Determines whether the current operating system is a 64-bit operating system.
auto is_aix () const noexcept -> bool
 Determines whether the current platform is AIX.
auto is_android () const noexcept -> bool
 Determines whether the current platform is Android.
auto is_apple_platform () const noexcept -> bool
 Determines whether the current platform belongs to the Apple ecosystem (macOS, iOS, tvOS, or watchOS).
auto is_bsd_platform () const noexcept -> bool
 Determines whether the current platform is BSD (FreeBSD, or Darwin).
auto is_darwin () const noexcept -> bool
 Determines whether the current platform is Darwin (macOS, iOS, tvOS, or watchOS).
auto is_free_bsd () const noexcept -> bool
 Determines whether the current platform is FreeBSD.
auto is_haiku () const noexcept -> bool
 Determines whether the current platform is Haiku.
auto is_serenityos () const noexcept -> bool
 Determines whether the current platform is SerenityOS.
auto is_ios () const noexcept -> bool
 Determines whether the current platform is iOS.
auto is_linux () const noexcept -> bool
 Determines whether the current platform is Linux.
auto is_macos () const noexcept -> bool
 Determines whether the current platform is macOS.
auto is_macos_platform () const noexcept -> bool
 Determines whether the current platform is part of the macOS family (including macOS, iOS, tvOS, or watchOS).
auto is_mingw () const noexcept -> bool
 Determines whether the current platform is MINGW.
auto is_msys () const noexcept -> bool
 Determines whether the current platform is MSYS.
auto is_posix () const noexcept -> bool
 Determines whether the current platform is Posix.
auto is_posix_platform () const noexcept -> bool
 Determines whether the current platform is Posix family.
auto is_unix_platform () const noexcept -> bool
 Determines whether the current platform is Unix family.
auto is_tvos () const noexcept -> bool
 Determines whether the current platform is tvOS family.
auto is_watchos () const noexcept -> bool
 Determines whether the current platform is watchOS.
auto is_windows () const noexcept -> bool
 Determines whether the current platform is Windows.
auto is_windows_ce () const noexcept -> bool
 Determines whether the current platform is Windows CE.
auto is_windows_platform () const noexcept -> bool
 Determines whether the current platform is Windows family.
auto is_xbox () const noexcept -> bool
 Determines whether the current platform is xbox.
auto get_hash_code () const noexcept -> xtd::usize override
 Serves as a hash function for a particular type.
auto to_string () const noexcept -> xtd::string override
 Converts the value of this operating_system object to its equivalent string representation.

Additional Inherited Members

 object ()=default
 Create a new instance of the ultimate base class object.
virtual auto equals (const object &obj) const noexcept -> bool
 Determines whether the specified object is equal to the current object.
virtual auto get_type () const noexcept -> type_object
 Gets the type of the current instance.
template<typename object_t>
auto memberwise_clone () const -> xtd::unique_ptr_object< object_t >
 Creates a shallow copy of the current object.
template<typename object_a_t, typename object_b_t>
static auto equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool
 Determines whether the specified object instances are considered equal.
template<typename object_a_t, typename object_b_t>
static auto reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool
 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
xtd::argument_exceptionplatform 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
xtd::argument_exceptionplatform 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
xtd::argument_exceptionplatform 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
xtd::argument_exceptionplatform 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
xtd::argument_exceptionplatform 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
xtd::argument_exceptionplatform is not a xtd::platform_id enumeration value.

Member Function Documentation

◆ desktop_environment()

auto xtd::operating_system::desktop_environment ( ) const -> xtd::string
nodiscardnoexcept

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()

auto xtd::operating_system::desktop_theme ( ) const -> xtd::string
nodiscardnoexcept

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()

auto xtd::operating_system::distribution ( ) const -> xtd::distribution
nodiscardnoexcept

Gets the distribution.

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

◆ name()

auto xtd::operating_system::name ( ) const -> xtd::string
nodiscardnoexcept

Gets the concatenated string representation of the platform identifier.

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

◆ platform()

auto xtd::operating_system::platform ( ) const -> xtd::platform_id
nodiscardnoexcept

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()

auto xtd::operating_system::service_pack ( ) const -> xtd::string
nodiscardnoexcept

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()

auto xtd::operating_system::version ( ) const -> const xtd::version &
nodiscardnoexcept

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()

auto xtd::operating_system::version_string ( ) const -> xtd::string
nodiscardnoexcept

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()

auto xtd::operating_system::is_64_bit ( ) const -> bool
nodiscardnoexcept

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

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

◆ is_aix()

auto xtd::operating_system::is_aix ( ) const -> bool
nodiscardnoexcept

Determines whether the current platform is AIX.

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

◆ is_android()

auto xtd::operating_system::is_android ( ) const -> bool
nodiscardnoexcept

Determines whether the current platform is Android.

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

◆ is_apple_platform()

auto xtd::operating_system::is_apple_platform ( ) const -> bool
nodiscardnoexcept

Determines whether the current platform belongs to the Apple ecosystem (macOS, iOS, tvOS, or watchOS).

Returns
true if the current platform is macOS, iOS, tvOS, or watchOS; otherwise, false.
Remarks
This includes all Apple Darwin-based systems. Use this method when you need to target Apple-specific APIs or behaviors across multiple Apple platforms.

◆ is_bsd_platform()

auto xtd::operating_system::is_bsd_platform ( ) const -> bool
nodiscardnoexcept

Determines whether the current platform is BSD (FreeBSD, or Darwin).

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

◆ is_darwin()

auto xtd::operating_system::is_darwin ( ) const -> bool
nodiscardnoexcept

Determines whether the current platform is Darwin (macOS, iOS, tvOS, or watchOS).

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

◆ is_free_bsd()

auto xtd::operating_system::is_free_bsd ( ) const -> bool
nodiscardnoexcept

Determines whether the current platform is FreeBSD.

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

◆ is_haiku()

auto xtd::operating_system::is_haiku ( ) const -> bool
nodiscardnoexcept

Determines whether the current platform is Haiku.

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

◆ is_serenityos()

auto xtd::operating_system::is_serenityos ( ) const -> bool
nodiscardnoexcept

Determines whether the current platform is SerenityOS.

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

◆ is_ios()

auto xtd::operating_system::is_ios ( ) const -> bool
nodiscardnoexcept

Determines whether the current platform is iOS.

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

◆ is_linux()

auto xtd::operating_system::is_linux ( ) const -> bool
nodiscardnoexcept

Determines whether the current platform is Linux.

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

◆ is_macos()

auto xtd::operating_system::is_macos ( ) const -> bool
nodiscardnoexcept

Determines whether the current platform is macOS.

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

◆ is_macos_platform()

auto xtd::operating_system::is_macos_platform ( ) const -> bool
nodiscardnoexcept

Determines whether the current platform is part of the macOS family (including macOS, iOS, tvOS, or watchOS).

Returns
true if the current platform is macOS, iOS, tvOS, or watchOS; otherwise, false.
Remarks
This is an alias of is_apple_platform() and exists for naming consistency. Prefer is_apple_platform() for semantic clarity.

◆ is_mingw()

auto xtd::operating_system::is_mingw ( ) const -> bool
nodiscardnoexcept

Determines whether the current platform is MINGW.

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

◆ is_msys()

auto xtd::operating_system::is_msys ( ) const -> bool
nodiscardnoexcept

Determines whether the current platform is MSYS.

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

◆ is_posix()

auto xtd::operating_system::is_posix ( ) const -> bool
nodiscardnoexcept

Determines whether the current platform is Posix.

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

◆ is_posix_platform()

auto xtd::operating_system::is_posix_platform ( ) const -> bool
nodiscardnoexcept

Determines whether the current platform is Posix family.

Returns
true if the current platform is Posix family; otherwise, false.
Remarks
Returns true if the current platform is Posix. This includes Linux, Android, macOS, iOS, tvOS, watchOS, BSD variants, Haiku, SerenityOS, Solaris, and AIX. It excludes platforms like Windows, and other non-posix environments.
Note
In this implementation, Unix and POSIX platforms overlap significantly but are semantically distinguished.

◆ is_unix_platform()

auto xtd::operating_system::is_unix_platform ( ) const -> bool
nodiscardnoexcept

Determines whether the current platform is Unix family.

Returns
true if the current platform is Unix family; otherwise, false.
Remarks
Returns true if the current platform is a Unix or Unix-like operating system. This includes Linux, macOS, iOS, tvOS, watchOS, BSD variants, Haiku, SerenityOS, Solaris, and AIX. It excludes platforms like Windows, Android, and other non-Unix environments.
Note
In this implementation, Unix and POSIX platforms overlap significantly but are semantically distinguished.

◆ is_tvos()

auto xtd::operating_system::is_tvos ( ) const -> bool
nodiscardnoexcept

Determines whether the current platform is tvOS family.

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

◆ is_watchos()

auto xtd::operating_system::is_watchos ( ) const -> bool
nodiscardnoexcept

Determines whether the current platform is watchOS.

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

◆ is_windows()

auto xtd::operating_system::is_windows ( ) const -> bool
nodiscardnoexcept

Determines whether the current platform is Windows.

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

◆ is_windows_ce()

auto xtd::operating_system::is_windows_ce ( ) const -> bool
nodiscardnoexcept

Determines whether the current platform is Windows CE.

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

◆ is_windows_platform()

auto xtd::operating_system::is_windows_platform ( ) const -> bool
nodiscardnoexcept

Determines whether the current platform is Windows family.

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

◆ is_xbox()

auto xtd::operating_system::is_xbox ( ) const -> bool
nodiscardnoexcept

Determines whether the current platform is xbox.

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

◆ get_hash_code()

auto xtd::operating_system::get_hash_code ( ) const -> xtd::usize
nodiscardoverridevirtualnoexcept

Serves as a hash function for a particular type.

Returns
A hash code for the current object.

Reimplemented from xtd::object.

◆ to_string()

auto xtd::operating_system::to_string ( ) const -> xtd::string
nodiscardoverridevirtualnoexcept

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: