1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 // RegistryValueImpl.h: Schnittstelle f�r die Klasse RegistryValueImpl.
23 //
24 //////////////////////////////////////////////////////////////////////
25 
26 #ifndef _REGISTRYVALUEIMPL_HXX_
27 #define _REGISTRYVALUEIMPL_HXX_
28 
29 #include <memory>
30 #include <string>
31 
32 class RegistryValueImpl
33 {
34 public:
35 
36 	//#################################
37 	// Creation/Destruction
38 	//#################################
39 
40 	RegistryValueImpl(const std::wstring& Name, int Value);
41 
42 	RegistryValueImpl(const std::wstring& Name, const std::wstring& Value);
43 
44 	RegistryValueImpl(const std::wstring& Name, const std::string& Value);
45 
46 	#if (_MSC_VER >= 1300)
47 	RegistryValueImpl::RegistryValueImpl(const RegistryValueImpl& s);
48 	#endif
49 
50 	virtual ~RegistryValueImpl();
51 
52 
53 	//#################################
54 	// Query
55 	//#################################
56 
57 
58 	/** Returns the name of the value
59 	*/
60 	std::wstring GetName() const;
61 
62 	/** Return the size of data held
63 	*/
64 	size_t GetDataSize() const;
65 
66 	/** Get a pointer to the data buffer
67 		in order to copy the data
68 	*/
69 	const void* GetDataBuffer() const;
70 
71 	/** Returns the data as unicode string
72 
73 		@precond GetType = STRING
74 	*/
75 	std::wstring GetDataAsUniString() const;
76 
77 	/** Returns the data as ansi string
78 
79 		@precond GetType = STRING
80 	*/
81 	std::string GetDataAsAnsiString() const;
82 
83 	/** Returns the data as number
84 
85 		@precond GetType = NUMBER
86 	*/
87 	int GetDataAsInt() const;
88 
89 	/** Returns the type of the data
90 	*/
91 	int GetType() const;
92 
93 	//#################################
94 	// Command
95 	//#################################
96 
97 
98 	/** Set a new name
99 	*/
100 	void SetName(const std::wstring& NewName);
101 
102 	/**
103 	*/
104 	void SetValue(const std::wstring& NewValue);
105 
106 	/**
107 	*/
108 	void SetValue(const std::string& NewValue);
109 
110 	/**
111 	*/
112 	void SetValue(int NewValue);
113 
114 	//#################################
115 	// Private data
116 	//#################################
117 
118 private:
119 	std::wstring	m_Name;
120 	int				m_Type;
121 	std::wstring	m_StringData;
122 	int				m_IntData;
123 };
124 
125 
126 typedef std::auto_ptr<RegistryValueImpl> RegistryValue;
127 
128 
129 #endif
130