[4054] added: Line of sight (vmaps) [part 1]
[mangos-git.git] / dep / include / g3dlite / G3D / RegistryUtil.h
blob97de8d06725be5e0034471856f32ef97096e52bf
1 /**
2 @file RegistryUtil.h
4 @created 2006-04-06
5 @edited 2006-04-06
7 Copyright 2000-2006, Morgan McGuire.
8 All rights reserved.
9 */
11 #ifndef G3D_REGISTRYUTIL_H
12 #define G3D_REGISTRYUTIL_H
14 #include "G3D/platform.h"
15 #include "G3D/g3dmath.h"
17 // This file is only used on Windows
18 #ifdef G3D_WIN32
20 #include <string>
22 namespace G3D {
24 /**
25 Provides generalized Windows registry querying.
27 All key names are one string in the format:
28 "[base key]\[sub-keys]\value"
30 [base key] can be any of the following:
31 HKEY_CLASSES_ROOT
32 HKEY_CURRENT_CONFIG
33 HKEY_CURRENT_USER
34 HKEY_LOCAL_MACHINE
35 HKEY_PERFORMANCE_DATA
36 HKEY_PERFORMANCE_NLSTEXT
37 HKEY_PERFORMANCE_TEXT
38 HKEY_USERS
40 keyExists() should be used to validate a key before reading or writing
41 to ensure that a debug assert or false return is for a different error.
43 class RegistryUtil {
45 public:
46 /** returns true if the key exists */
47 static bool keyExists(const std::string& key);
49 /** returns false if the key could not be read for any reason. */
50 static bool readInt32(const std::string& key, int32& valueData);
52 /**
53 Reads an arbitrary amount of data from a binary registry key.
54 returns false if the key could not be read for any reason.
56 @beta
57 @param valueData pointer to the output buffer of sufficient size. Pass NULL as valueData in order to have available data size returned in dataSize.
58 @param dataSize size of the output buffer. When NULL is passed for valueData, contains the size of available data on successful return.
60 static bool readBytes(const std::string& key, uint8* valueData, uint32& dataSize);
62 /** returns false if the key could not be read for any reason. */
63 static bool readString(const std::string& key, std::string& valueData);
65 /** returns false if the key could not be written for any reason. */
66 static bool writeInt32(const std::string& key, int32 valueData);
68 /**
69 Writes an arbitrary amount of data to a binary registry key.
70 returns false if the key could not be written for any reason.
72 @param valueData pointer to the input buffer
73 @param dataSize size of the input buffer that should be written
75 static bool writeBytes(const std::string& key, const uint8* valueData, uint32 dataSize);
77 /** returns false if the key could not be written for any reason. */
78 static bool writeString(const std::string& key, const std::string& valueData);
82 } // namespace G3D
84 #endif // G3D_WIN32
86 #endif // G3D_REGISTRYTUIL_H