Files
TCPlayerbotCore/dep/include/g3dlite/G3D/RegistryUtil.h
T

88 lines
2.5 KiB
C++
Raw Normal View History

2008-10-02 16:23:55 -05:00
/**
@file RegistryUtil.h
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
@created 2006-04-06
@edited 2006-04-06
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
Copyright 2000-2006, Morgan McGuire.
All rights reserved.
*/
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
#ifndef G3D_REGISTRYUTIL_H
#define G3D_REGISTRYUTIL_H
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
#include "G3D/platform.h"
#include "G3D/g3dmath.h"
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
// This file is only used on Windows
#ifdef G3D_WIN32
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
#include <string>
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
namespace G3D {
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
/**
2008-10-02 16:23:55 -05:00
Provides generalized Windows registry querying.
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
All key names are one string in the format:
"[base key]\[sub-keys]\value"
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
[base key] can be any of the following:
HKEY_CLASSES_ROOT
HKEY_CURRENT_CONFIG
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_PERFORMANCE_DATA
HKEY_PERFORMANCE_NLSTEXT
HKEY_PERFORMANCE_TEXT
HKEY_USERS
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
keyExists() should be used to validate a key before reading or writing
to ensure that a debug assert or false return is for a different error.
*/
class RegistryUtil {
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
public:
/** returns true if the key exists */
static bool keyExists(const std::string& key);
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
/** returns false if the key could not be read for any reason. */
static bool readInt32(const std::string& key, int32& valueData);
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
/**
2008-10-02 16:23:55 -05:00
Reads an arbitrary amount of data from a binary registry key.
returns false if the key could not be read for any reason.
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
@beta
@param valueData pointer to the output buffer of sufficient size. Pass NULL as valueData in order to have available data size returned in dataSize.
@param dataSize size of the output buffer. When NULL is passed for valueData, contains the size of available data on successful return.
*/
static bool readBytes(const std::string& key, uint8* valueData, uint32& dataSize);
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
/** returns false if the key could not be read for any reason. */
static bool readString(const std::string& key, std::string& valueData);
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
/** returns false if the key could not be written for any reason. */
static bool writeInt32(const std::string& key, int32 valueData);
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
/**
2008-10-02 16:23:55 -05:00
Writes an arbitrary amount of data to a binary registry key.
returns false if the key could not be written for any reason.
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
@param valueData pointer to the input buffer
@param dataSize size of the input buffer that should be written
*/
static bool writeBytes(const std::string& key, const uint8* valueData, uint32 dataSize);
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
/** returns false if the key could not be written for any reason. */
static bool writeString(const std::string& key, const std::string& valueData);
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
};
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
} // namespace G3D
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
#endif // G3D_WIN32
2009-10-17 15:51:44 -07:00
2009-02-17 20:07:49 -06:00
#endif // G3D_REGISTRYTUIL_H