Ocean
platform/win/System.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_PLATFORM_WIN_SYSTEM_H
9 #define META_OCEAN_PLATFORM_WIN_SYSTEM_H
10 
11 #include "ocean/platform/win/Win.h"
12 
13 #include "ocean/io/Directory.h"
14 
15 namespace Ocean
16 {
17 
18 namespace Platform
19 {
20 
21 namespace Win
22 {
23 
24 /**
25  * This class provides basic system functionalities on windows platforms.
26  * @ingroup platformwin
27  */
28 class OCEAN_PLATFORM_WIN_EXPORT System
29 {
30  public:
31 
32  /**
33  * Returns the current directory used for this process.
34  * @return Current directory
35  */
37 
38  /**
39  * Returns the process directory used for this process.
40  * @return Process directory
41  */
43 
44  /**
45  * Returns the handle to the calling module (a runtime library).
46  * This function returns nullptr if the calling module is an application.<br>
47  * Every valid module handle must be released by an explicit FreeLibrary() call.<br>
48  * @return The handle of the calling module library, nullptr otherwise
49  */
50  static HMODULE currentLibraryModule();
51 
52  /**
53  * Returns the corresponding name (the filename) of a given module handle.
54  * @param handle The handle for that the corresponding name is returned
55  * @return Resulting handle handle, if any
56  */
57  static std::wstring moduleName(const HMODULE handle);
58 
59  /**
60  * Returns a defined environment variable.
61  * @param variable Environment variable to return
62  * @param removeQuotes Determines whether all beginning and ending quotes are removed from the environment variable, if existent
63  * @return Specified environment variable
64  */
65  static std::string environmentVariable(const std::string& variable, const bool removeQuotes = true);
66 };
67 
68 }
69 
70 }
71 
72 }
73 
74 #endif // META_OCEAN_PLATFORM_WIN_SYSTEM_H
This class holds a directory.
Definition: Directory.h:36
This class provides basic system functionalities on windows platforms.
Definition: platform/win/System.h:29
static IO::Directory processDirectory()
Returns the process directory used for this process.
static std::wstring moduleName(const HMODULE handle)
Returns the corresponding name (the filename) of a given module handle.
static std::string environmentVariable(const std::string &variable, const bool removeQuotes=true)
Returns a defined environment variable.
static IO::Directory currentDirectory()
Returns the current directory used for this process.
static HMODULE currentLibraryModule()
Returns the handle to the calling module (a runtime library).
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15