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