📄 win32registry.hpp
字号:
//// This file is part of the "More for C++" library//// Copyright (c) 1999-2003 by Thorsten Goertz (thorsten@goertz.com)//// The "More for C++" library is free software; you can redistribute it and/or// modify it under the terms of the license that comes with this package.//// Read "license.txt" for more details.//// THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED// WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES// OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.////////////////////////////////////////////////////////////////////////////////#ifndef MORE_OS_WIN32_WIN32REGISTRY_HPP#define MORE_OS_WIN32_WIN32REGISTRY_HPP#include <more/array.hpp>#include <more/exception.hpp>#include <more/pointer.hpp>#include <more/string.hpp>////////////////////////////////////////////////////////////////////////////////namespace more{ namespace os { namespace win32 { class Win32Registry { public: struct NumericValue { String sName; size_t nValue; NumericValue( ); NumericValue( const String& sName, size_t nValue ); }; struct StringValue { String sName; String sValue; StringValue( ); StringValue( const String& sName, const String& sValue ); }; class InvalidKey: public more::Exception { public: virtual operator const char* ( ) const; }; class KeyAlreadyExists: public more::Exception { public: virtual operator const char* ( ) const; }; class InvalidValueName: public more::Exception { public: virtual operator const char* ( ) const; }; class ValueAlreadyExists: public more::Exception { public: virtual operator const char* ( ) const; }; // Valid values for sBaseKey: // // "HKEY_CLASSES_ROOT" // "HKEY_CURRENT_CONFIG" // "HKEY_CURRENT_USER" // "HKEY_LOCAL_MACHINE" // "HKEY_PERFORMANCE_DATA" // "HKEY_USERS" static p<Win32Registry> create( const String& sBaseKey ) throw( InvalidKey ); virtual void createKey( const String& sKey ) throw( InvalidKey, KeyAlreadyExists ) = 0; virtual void destroyKey( const String& sKey ) throw( InvalidKey ) = 0; virtual Array<String> getSubKeys( const String& sKey ) throw( InvalidKey ) = 0; virtual Array<NumericValue> getNumericValues( const String& sKey ) throw( InvalidKey ) = 0; virtual Array<StringValue> getStringValues( const String& sKey ) throw( InvalidKey ) = 0; virtual void createNumericValue( const String& sKey, const NumericValue& ) throw( InvalidKey, InvalidValueName, ValueAlreadyExists ) = 0; virtual void createStringValue( const String& sKey, const StringValue& ) throw( InvalidKey, InvalidValueName, ValueAlreadyExists ) = 0; virtual void destroyValue( const String& sKey, const String& sName ) throw( InvalidKey, InvalidValueName ) = 0; virtual void setNumericValue( const String& sKey, const NumericValue& ) throw( InvalidKey, InvalidValueName ) = 0; virtual void setStringValue( const String& sKey, const StringValue& ) throw( InvalidKey, InvalidValueName ) = 0; virtual size_t getNumericValue( const String& sKey, const String& sName ) throw( InvalidKey, InvalidValueName ) = 0; virtual String getStringValue( const String& sKey, const String& sName ) throw( InvalidKey, InvalidValueName ) = 0; protected: virtual ~Win32Registry( ); }; } }}////////////////////////////////////////////////////////////////////////////////inline more::os::win32::Win32Registry::NumericValue::NumericValue( ){ this -> nValue = 0;}////////////////////////////////////////////////////////////////////////////////inline more::os::win32::Win32Registry::NumericValue::NumericValue( const String& sName_, size_t nValue_): sName( sName_ ), nValue( nValue_ ){}////////////////////////////////////////////////////////////////////////////////inline more::os::win32::Win32Registry::StringValue::StringValue( ){}////////////////////////////////////////////////////////////////////////////////inline more::os::win32::Win32Registry::StringValue::StringValue( const String& sName_, const String& sValue_): sName( sName_ ), sValue( sValue_ ){}////////////////////////////////////////////////////////////////////////////////#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -