Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cSystemInfo.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cSystemInfo_H
7 #define _INC_cSystemInfo_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "cSingleton.h"
13 #include "FileName.h"
14 
15 #ifdef __linux__
16 #include <sys/utsname.h> // uname()
17 #endif
18 
19 namespace Gray
20 {
22 #ifdef _MFC_VER
23 #if defined(USE_64BIT)
24 #define GRAY_BUILD_NAME "WinMFC64"
25 #else
26 #define GRAY_BUILD_NAME "WinMFC"
27 #endif
28 #elif defined(UNDER_CE)
29 #define GRAY_BUILD_NAME "WinCE" // What CPU?
30 #elif defined(_WIN64)
31 #define GRAY_BUILD_NAME "Win64"
32 #elif defined(_WIN32)
33 #define GRAY_BUILD_NAME "Win32"
34 #elif defined(_BSD) // FREEBSD
35 #define GRAY_BUILD_NAME "FreeBSD" // Apple/MAC BSD system ? use clang ?
36 #elif defined(__linux__)
37 #ifdef USE_64BIT
38 #define GRAY_BUILD_NAME "Linux64"
39 #else
40 #define GRAY_BUILD_NAME "Linux32"
41 #endif
42 #else
43 #error NOOS
44 #endif
45 
46  class GRAYCORE_LINK cSystemInfo : public cSingleton < cSystemInfo >
47  {
51 
52  friend class cSingleton < cSystemInfo >;
53 
54 #ifdef _WIN32
55  public:
56  SYSTEM_INFO m_SystemInfo;
57  OSVERSIONINFOEXW m_OsInfo;
58 #elif defined(__linux__)
59  protected:
60  struct utsname m_utsname;
61  UINT m_nOSVer;
62  UINT m_nNumberOfProcessors;
63 #else
64 #error NOOS
65 #endif
66 #ifndef USE_64BIT
67  bool m_bOS64Bit;
68 #endif
69 
70  protected:
71  cSystemInfo();
72  ~cSystemInfo();
73 
74  public:
75  UINT get_NumberOfProcessors() const; // SMP issues ?
76  bool isOS64Bit() const;
77 
78  UINT get_OSVer() const;
79 
80 #ifdef _WIN32
81  bool isOSNTAble() const;
82  bool isOSXPAble() const;
83 #endif
84 #ifdef __linux__
85  bool isVer3_17_plus() const;
86 #endif
87 
88  static StrLen_t GRAYCALL GetSystemDir(FILECHAR_t* pszDir, StrLen_t iLenMax);
89  static HRESULT GRAYCALL GetSystemName(FILECHAR_t* pszName, StrLen_t iLenMax);
90 
91  static bool GRAYCALL SystemShutdown(bool bReboot);
92  static void GRAYCALL SystemBeep();
93 
96  };
97 }
98 
99 #endif // _INC_cSystemInfo_H
#define GRAYCORE_LINK
Definition: GrayCore.h:47
#define GRAYCALL
declare calling convention for static functions so everyone knows the arg passing scheme....
Definition: GrayCore.h:36
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
#define CHEAPOBJECT_IMPL
Definition: cHeapObject.h:32
#define UNITTEST_FRIEND(n)
Define this in the class body to be unit tested. Allow the unit test to access private/protected stuf...
Definition: cUnitTestDecl.h:17
Definition: cSingleton.h:127
OS build type name. OS target known at compile time. Actually run environment may vary of course.
Definition: cSystemInfo.h:47
< The main namespace for all Core functions.
Definition: GrayCore.cpp:14
int StrLen_t
the length of a string in chars (bytes for UTF8, wchar_t for UNICODE). or offset in characters....
Definition: StrConst.h:32
char FILECHAR_t
a UTF8 char in a file name. like TCHAR
Definition: FileName.h:22