CppCommon  1.0.4.1
C++ Common Library
environment.h
Go to the documentation of this file.
1 
9 #ifndef CPPCOMMON_SYSTEM_ENVIRONMENT_H
10 #define CPPCOMMON_SYSTEM_ENVIRONMENT_H
11 
12 #include "errors/exceptions.h"
13 
14 #include <map>
15 #include <string>
16 
17 namespace CppCommon {
18 
20 
27 {
28 public:
29  Environment() = delete;
30  Environment(const Environment&) = delete;
31  Environment(Environment&&) = delete;
32  ~Environment() = delete;
33 
34  Environment& operator=(const Environment&) = delete;
36 
38  static bool Is32BitOS();
40  static bool Is64BitOS();
41 
43  static bool Is32BitProcess();
45  static bool Is64BitProcess();
46 
48  static bool IsDebug();
50  static bool IsRelease();
51 
53  static bool IsBigEndian();
55  static bool IsLittleEndian();
56 
58  static std::string OSVersion();
59 
61  static std::string EndLine();
62 
64  static std::string UnixEndLine();
66  static std::string WindowsEndLine();
67 
69 
72  static std::map<std::string, std::string> envars();
73 
75 
79  static std::string GetEnvar(const std::string name);
81 
85  static void SetEnvar(const std::string name, const std::string value);
87 
90  static void ClearEnvar(const std::string name);
91 };
92 
95 } // namespace CppCommon
96 
97 #endif // CPPCOMMON_SYSTEM_ENVIRONMENT_H
Environment management static class.
Definition: environment.h:27
static bool IsBigEndian()
Is big-endian system?
static bool Is64BitProcess()
Is 64-bit running process?
Definition: environment.cpp:70
static std::string UnixEndLine()
Get Unix text end line separator.
static bool Is64BitOS()
Is 64-bit OS?
Definition: environment.cpp:46
static bool Is32BitProcess()
Is 32-bit running process?
Definition: environment.cpp:65
static void SetEnvar(const std::string name, const std::string value)
Set environment variable value by the given name.
static bool IsRelease()
Is compiled in release mode?
Definition: environment.cpp:94
static void ClearEnvar(const std::string name)
Clear environment variable by the given name.
Environment(Environment &&)=delete
Environment(const Environment &)=delete
static std::map< std::string, std::string > envars()
Get all environment variables.
Environment & operator=(Environment &&)=delete
static bool IsDebug()
Is compiled in debug mode?
Definition: environment.cpp:89
static std::string OSVersion()
Get OS version string.
static bool Is32BitOS()
Is 32-bit OS?
Definition: environment.cpp:41
static bool IsLittleEndian()
Is little-endian system?
Environment & operator=(const Environment &)=delete
static std::string EndLine()
Get text end line separator.
static std::string WindowsEndLine()
Get Windows text end line separator.
static std::string GetEnvar(const std::string name)
Get environment variable value by the given name.
Exceptions definition.
C++ Common project definitions.
Definition: token_bucket.h:15