PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: RegistryImpl.h * 00003 * 00004 * Copyright (C) 2002-2012 The PixelLight Team (http://www.pixellight.org/) 00005 * 00006 * This file is part of PixelLight. 00007 * 00008 * PixelLight is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as published by 00010 * the Free Software Foundation, either version 3 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * PixelLight is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public License 00019 * along with PixelLight. If not, see <http://www.gnu.org/licenses/>. 00020 \*********************************************************/ 00021 00022 00023 #ifndef __PLCORE_REGISTRY_IMPL_H__ 00024 #define __PLCORE_REGISTRY_IMPL_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include "PLCore/String/String.h" 00032 00033 00034 //[-------------------------------------------------------] 00035 //[ Namespace ] 00036 //[-------------------------------------------------------] 00037 namespace PLCore { 00038 00039 00040 //[-------------------------------------------------------] 00041 //[ Classes ] 00042 //[-------------------------------------------------------] 00043 /** 00044 * @brief 00045 * Abstract base class for platform specific 'Registry' implementations 00046 */ 00047 class RegistryImpl { 00048 00049 00050 //[-------------------------------------------------------] 00051 //[ Friends ] 00052 //[-------------------------------------------------------] 00053 friend class Registry; 00054 00055 00056 //[-------------------------------------------------------] 00057 //[ Protected functions ] 00058 //[-------------------------------------------------------] 00059 protected: 00060 /** 00061 * @brief 00062 * Constructor 00063 */ 00064 RegistryImpl(); 00065 00066 /** 00067 * @brief 00068 * Destructor 00069 */ 00070 virtual ~RegistryImpl(); 00071 00072 00073 //[-------------------------------------------------------] 00074 //[ Protected virtual RegistryImpl functions ] 00075 //[-------------------------------------------------------] 00076 protected: 00077 /** 00078 * @brief 00079 * Get type of registry 00080 * 00081 * @return 00082 * Type of registry ('RegistryNone' if no registry is available on your system!) (type: "Registry::ERegistry") 00083 */ 00084 virtual uint32 GetRegistryType() const = 0; 00085 00086 /** 00087 * @brief 00088 * Open registry key 00089 * 00090 * @param[in] nKey 00091 * Registry key (type: "Registry::EKey") 00092 * @param[in] sSubKey 00093 * Name of subkey 00094 * @param[in] nAccess 00095 * Access modes (combination of 'EAccess' values) 00096 * 00097 * @return 00098 * 'true' if all went fine, else 'false' 00099 */ 00100 virtual bool Open(uint32 nKey, const String &sSubKey, uint32 nAccess) = 0; 00101 00102 /** 00103 * @brief 00104 * Create a new registry key 00105 * 00106 * @param[in] nKey 00107 * Registry key (type: "Registry::EKey") 00108 * @param[in] sSubKey 00109 * Name of subkey 00110 * @param[in] nAccess 00111 * Access modes (combination of 'EAccess' values) 00112 * 00113 * @return 00114 * 'true' if all went fine, else 'false' 00115 */ 00116 virtual bool Create(uint32 nKey, const String &sSubKey, uint32 nAccess) = 0; 00117 00118 /** 00119 * @brief 00120 * Delete the registry key 00121 * 00122 * @return 00123 * 'true' if all went fine, else 'false' 00124 */ 00125 virtual bool Delete() = 0; 00126 00127 /** 00128 * @brief 00129 * Close registry key 00130 */ 00131 virtual void Close() = 0; 00132 00133 /** 00134 * @brief 00135 * Get ID of opened registry key 00136 * 00137 * @return 00138 * Key ID (type: "Registry::EKey") 00139 */ 00140 virtual uint32 GetOpenKey() const = 0; 00141 00142 /** 00143 * @brief 00144 * Get name of opened sub-key 00145 * 00146 * @return 00147 * Name of sub-key 00148 */ 00149 virtual String GetOpenSubKey() const = 0; 00150 00151 /** 00152 * @brief 00153 * Get access mode 00154 * 00155 * @return 00156 * Access mode 00157 */ 00158 virtual uint32 GetOpenAccessMode() const = 0; 00159 00160 /** 00161 * @brief 00162 * Returns the number of sub-keys 00163 * 00164 * @return 00165 * Number of sub-keys 00166 */ 00167 virtual uint32 GetNumOfSubKeys() const = 0; 00168 00169 /** 00170 * @brief 00171 * Get a sub-key of the opened registry key 00172 * 00173 * @param[in] nIndex 00174 * Index of the sub-key 00175 * 00176 * @return 00177 * Name of the sub-key, or "" if no more sub-keys are present 00178 */ 00179 virtual String GetSubKey(uint32 nIndex) const = 0; 00180 00181 /** 00182 * @brief 00183 * Returns the number of values 00184 * 00185 * @return 00186 * Number of values 00187 */ 00188 virtual uint32 GetNumOfValues() const = 0; 00189 00190 /** 00191 * @brief 00192 * Get a value of the opened registry key 00193 * 00194 * @param[in] nIndex 00195 * Index of the value 00196 * 00197 * @return 00198 * Name of the value, or "" if no more values are present 00199 */ 00200 virtual String GetValue(uint32 nIndex) const = 0; 00201 00202 /** 00203 * @brief 00204 * Get the type of a given value 00205 * 00206 * @param[in] sName 00207 * Name of the value 00208 * 00209 * @return 00210 * Type of the value (type: "Registry::EType") 00211 */ 00212 virtual uint32 GetValueType(const String &sName) const = 0; 00213 00214 /** 00215 * @brief 00216 * Get a value of type string 00217 * 00218 * @param[in] sName 00219 * Name of the value 00220 * 00221 * @return 00222 * String value 00223 */ 00224 virtual String GetValueString(const String &sName) const = 0; 00225 00226 /** 00227 * @brief 00228 * Get a value of type 'dword' 00229 * 00230 * @param[in] sName 00231 * Name of the value 00232 * 00233 * @return 00234 * Value 00235 */ 00236 virtual uint32 GetValueDWord(const String &sName) const = 0; 00237 00238 /** 00239 * @brief 00240 * Get a value of type binary 00241 * 00242 * @param[in] sName 00243 * Name of the value 00244 * @param[out] pBuffer 00245 * Buffer to receive the value, if a null pointer, returns the number of bytes required 00246 * @param[in] nSize 00247 * Size of the given buffer in bytes, ignored if 'pBuffer' is a null pointer 00248 * 00249 * @return 00250 * Number of bytes written to the buffer 00251 */ 00252 virtual uint32 GetValueBinary(const String &sName, uint8 *pBuffer, uint32 nSize) const = 0; 00253 00254 /** 00255 * @brief 00256 * Set a value of type string 00257 * 00258 * @param[in] sName 00259 * Name of the value 00260 * @param[in] sValue 00261 * String value to set 00262 * 00263 * @return 00264 * 'true' if all went fine, else 'false' 00265 */ 00266 virtual bool SetValueString(const String &sName, const String &sValue) = 0; 00267 00268 /** 00269 * @brief 00270 * Set a value of type 'dword' 00271 * 00272 * @param[in] sName 00273 * Name of the value 00274 * @param[in] nValue 00275 * Value to set 00276 * 00277 * @return 00278 * 'true' if all went fine, else 'false' 00279 */ 00280 virtual bool SetValueDWord(const String &sName, uint32 nValue) = 0; 00281 00282 /** 00283 * @brief 00284 * Set a value of type binary 00285 * 00286 * @param[in] sName 00287 * Name of the value 00288 * @param[in] pBuffer 00289 * Buffer containing the value to set (if a null pointer, the function fails) 00290 * @param[in] nSize 00291 * Size of the given buffer in bytes 00292 * 00293 * @return 00294 * 'true' if all went fine, else 'false' 00295 */ 00296 virtual bool SetValueBinary(const String &sName, const uint8 *pBuffer, uint32 nSize) = 0; 00297 00298 /** 00299 * @brief 00300 * Write all values to the registry 00301 */ 00302 virtual void Flush() = 0; 00303 00304 00305 }; 00306 00307 00308 //[-------------------------------------------------------] 00309 //[ Namespace ] 00310 //[-------------------------------------------------------] 00311 } // PLCore 00312 00313 00314 #endif // __PLCORE_REGISTRY_IMPL_H__
|