Ocean
OperatingSystem.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_SYSTEM_OPERATING_SYSTEM_H
9 #define META_OCEAN_SYSTEM_OPERATING_SYSTEM_H
10 
11 #include "ocean/system/System.h"
12 
13 namespace Ocean
14 {
15 
16 namespace System
17 {
18 
19 /**
20  * This class implements functions for the operating system.
21  * @ingroup system
22  */
23 class OCEAN_SYSTEM_EXPORT OperatingSystem
24 {
25  public:
26 
27  /**
28  * Definition of individual operating systems.
29  */
31  {
32  /// Unknown operating system.
34 
35  /// Windows operating system without specific version.
36  OSID_MICROSOFT_WINDOWS = 0x00001000,
37  /// Windows client operating system without specific version.
38  OSID_MICROSOFT_WINDOWS_CLIENT = OSID_MICROSOFT_WINDOWS | 0x00000001,
39  /// Windows server operating system without specific version.
40  OSID_MICROSOFT_WINDOWS_SERVER = OSID_MICROSOFT_WINDOWS | 0x00000002,
41 
42  /// Windows 2000 with any kind of service pack.
43  OSID_MICROSOFT_WINDOWS_2000 = OSID_MICROSOFT_WINDOWS_CLIENT | 0x00000020,
44  /// Windows XP with any kind of service pack.
45  OSID_MICROSOFT_WINDOWS_XP = OSID_MICROSOFT_WINDOWS_CLIENT | 0x00000030,
46  /// Windows Vista with any kind of service pack.
47  OSID_MICROSOFT_WINDOWS_VISTA = OSID_MICROSOFT_WINDOWS_CLIENT | 0x00000050,
48  /// Windows 7 with any kind of service pack.
49  OSID_MICROSOFT_WINDOWS_7 = OSID_MICROSOFT_WINDOWS_CLIENT | 0x00000070,
50  /// Windows 8 with any kind of service pack.
51  OSID_MICROSOFT_WINDOWS_8 = OSID_MICROSOFT_WINDOWS_CLIENT | 0x00000080,
52  /// Windows 8.1 with any kind of service pack.
53  OSID_MICROSOFT_WINDOWS_8_1 = OSID_MICROSOFT_WINDOWS_CLIENT | 0x00000090,
54  /// Windows 10 with any kind of service pack.
55  OSID_MICROSOFT_WINDOWS_10 = OSID_MICROSOFT_WINDOWS_CLIENT | 0x00000100,
56 
57  /// Windows Server 2003 with any kind of service pack.
58  OSID_MICROSOFT_WINDOWS_SERVER_2003 = OSID_MICROSOFT_WINDOWS_SERVER | 0x00000030,
59  /// Windows Server 2008 with any kind of service pack.
60  OSID_MICROSOFT_WINDOWS_SERVER_2008 = OSID_MICROSOFT_WINDOWS_SERVER | 0x00000050,
61  /// Windows Server 2012 with any kind of service pack.
62  OSID_MICROSOFT_WINDOWS_SERVER_2012 = OSID_MICROSOFT_WINDOWS_SERVER | 0x00000090,
63  /// Windows Server 2016 with any kind of service pack.
64  OSID_MICROSOFT_WINDOWS_SERVER_2016 = OSID_MICROSOFT_WINDOWS_SERVER | 0x00000100,
65 
66  /// Macintosh operating system without specific version.
67  OSID_MACINTOSH_OS = 0x00010000,
68  /// Macintosh OS X with any kind of service pack.
69  OSID_MACINTOSH_OS_X = OSID_MACINTOSH_OS | 0x00000001,
70 
71  /// Android operating system without specific version.
72  OSID_ANDROID = 0x00100000,
73 
74  // Linux without any specific version.
75  OSID_LINUX = 0x01000000,
76  };
77 
78 
79  public:
80 
81  /**
82  * Returns the id of the current operating system.
83  * @param version Optional resulting (detailed) version of the operating system
84  * @return The OS's id
85  */
86  static OperatingSystemId id(std::wstring* version = nullptr);
87 
88  /**
89  * Returns the name of the current operating system.
90  * @param addVersion True, to add the version of the operating system
91  * @return The OS's name
92  */
93  static std::wstring name(const bool addVersion = true);
94 };
95 
96 }
97 
98 }
99 
100 #endif // META_OCEAN_SYSTEM_OPERATING_SYSTEM_H
This class implements functions for the operating system.
Definition: OperatingSystem.h:24
static std::wstring name(const bool addVersion=true)
Returns the name of the current operating system.
OperatingSystemId
Definition of individual operating systems.
Definition: OperatingSystem.h:31
@ OSID_UNKNOWN
Unknown operating system.
Definition: OperatingSystem.h:33
static OperatingSystemId id(std::wstring *version=nullptr)
Returns the id of the current operating system.
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15