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 
23 #ifndef CONNECTIVITY_TKEYVALUE_HXX
24 #define CONNECTIVITY_TKEYVALUE_HXX
25 
26 #include "connectivity/FValue.hxx"
27 #include "connectivity/dbtoolsdllapi.hxx"
28 
29 namespace connectivity
30 {
31 	class OOO_DLLPUBLIC_DBTOOLS OKeyValue
32 	{
33 	private:
34 		::std::vector<ORowSetValueDecoratorRef> m_aKeys;
35 		sal_Int32 m_nValue;
36 
37 	protected:
38 		OKeyValue();
39 		OKeyValue(sal_Int32 nVal);
40 	public:
41 
42 		~OKeyValue();
43 
operator new(size_t nSize)44 		inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW( () )
45 			{ return ::rtl_allocateMemory( nSize ); }
operator new(size_t,void * _pHint)46 		inline static void * SAL_CALL operator new( size_t,void* _pHint ) SAL_THROW( () )
47 			{ return _pHint; }
operator delete(void * pMem)48 		inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW( () )
49 			{ ::rtl_freeMemory( pMem ); }
operator delete(void *,void *)50 		inline static void SAL_CALL operator delete( void *,void* ) SAL_THROW( () )
51 			{  }
52 
53 		static OKeyValue* createKeyValue(sal_Int32 nVal);
54 		//	static OKeyValue* createEmptyKeyValue();
55 
pushKey(const ORowSetValueDecoratorRef & _aValueRef)56 		inline void pushKey(const ORowSetValueDecoratorRef& _aValueRef)
57 		{
58 			m_aKeys.push_back(_aValueRef);
59 		}
setValue(sal_Int32 nVal)60 		inline void setValue(sal_Int32 nVal) { m_nValue = nVal; }
61 
getKeyString(::std::vector<ORowSetValueDecoratorRef>::size_type i) const62 		::rtl::OUString	getKeyString(::std::vector<ORowSetValueDecoratorRef>::size_type i) const
63 		{
64 			OSL_ENSURE(m_aKeys.size() > i,"Wrong index for KEyValue");
65 			return m_aKeys[i]->getValue();
66 		}
getKeyDouble(::std::vector<ORowSetValueDecoratorRef>::size_type i) const67 		double			getKeyDouble(::std::vector<ORowSetValueDecoratorRef>::size_type i) const
68 		{
69 			OSL_ENSURE(m_aKeys.size() > i,"Wrong index for KEyValue");
70 			return m_aKeys[i]->getValue();
71 		}
72 
getValue() const73 		inline sal_Int32 getValue() const { return m_nValue; }
74 	};
75 }
76 
77 #endif // CONNECTIVITY_TKEYVALUE_HXX
78 
79