xref: /trunk/main/setup_native/source/win32/customactions/reg4msdoc/registryvalueimpl.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 // RegistryValueImpl.h: Schnittstelle f�r die Klasse RegistryValueImpl.
2 //
3 //////////////////////////////////////////////////////////////////////
4 
5 #ifndef _REGISTRYVALUEIMPL_HXX_
6 #define _REGISTRYVALUEIMPL_HXX_
7 
8 #include <memory>
9 #include <string>
10 
11 class RegistryValueImpl
12 {
13 public:
14 
15     //#################################
16     // Creation/Destruction
17     //#################################
18 
19     RegistryValueImpl(const std::wstring& Name, int Value);
20 
21     RegistryValueImpl(const std::wstring& Name, const std::wstring& Value);
22 
23     RegistryValueImpl(const std::wstring& Name, const std::string& Value);
24 
25     #if (_MSC_VER >= 1300)
26     RegistryValueImpl::RegistryValueImpl(const RegistryValueImpl& s);
27     #endif
28 
29     virtual ~RegistryValueImpl();
30 
31 
32     //#################################
33     // Query
34     //#################################
35 
36 
37     /** Returns the name of the value
38     */
39     std::wstring GetName() const;
40 
41     /** Return the size of data held
42     */
43     size_t GetDataSize() const;
44 
45     /** Get a pointer to the data buffer
46         in order to copy the data
47     */
48     const void* GetDataBuffer() const;
49 
50     /** Returns the data as unicode string
51 
52         @precond GetType = STRING
53     */
54     std::wstring GetDataAsUniString() const;
55 
56     /** Returns the data as ansi string
57 
58         @precond GetType = STRING
59     */
60     std::string GetDataAsAnsiString() const;
61 
62     /** Returns the data as number
63 
64         @precond GetType = NUMBER
65     */
66     int GetDataAsInt() const;
67 
68     /** Returns the type of the data
69     */
70     int GetType() const;
71 
72     //#################################
73     // Command
74     //#################################
75 
76 
77     /** Set a new name
78     */
79     void SetName(const std::wstring& NewName);
80 
81     /**
82     */
83     void SetValue(const std::wstring& NewValue);
84 
85     /**
86     */
87     void SetValue(const std::string& NewValue);
88 
89     /**
90     */
91     void SetValue(int NewValue);
92 
93     //#################################
94     // Private data
95     //#################################
96 
97 private:
98     std::wstring    m_Name;
99     int             m_Type;
100     std::wstring    m_StringData;
101     int             m_IntData;
102 };
103 
104 
105 typedef std::auto_ptr<RegistryValueImpl> RegistryValue;
106 
107 
108 #endif
109