1*caf5cd79SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*caf5cd79SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*caf5cd79SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*caf5cd79SAndrew Rist  * distributed with this work for additional information
6*caf5cd79SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*caf5cd79SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*caf5cd79SAndrew Rist  * "License"); you may not use this file except in compliance
9*caf5cd79SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*caf5cd79SAndrew Rist  *
11*caf5cd79SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*caf5cd79SAndrew Rist  *
13*caf5cd79SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*caf5cd79SAndrew Rist  * software distributed under the License is distributed on an
15*caf5cd79SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*caf5cd79SAndrew Rist  * KIND, either express or implied.  See the License for the
17*caf5cd79SAndrew Rist  * specific language governing permissions and limitations
18*caf5cd79SAndrew Rist  * under the License.
19*caf5cd79SAndrew Rist  *
20*caf5cd79SAndrew Rist  *************************************************************/
21*caf5cd79SAndrew Rist 
22*caf5cd79SAndrew Rist 
23cdf0e10cSrcweir #ifndef CONNECTIVITY_TKEYVALUE_HXX
24cdf0e10cSrcweir #define CONNECTIVITY_TKEYVALUE_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include "connectivity/FValue.hxx"
27cdf0e10cSrcweir #include "connectivity/dbtoolsdllapi.hxx"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir namespace connectivity
30cdf0e10cSrcweir {
31cdf0e10cSrcweir 	class OOO_DLLPUBLIC_DBTOOLS OKeyValue
32cdf0e10cSrcweir 	{
33cdf0e10cSrcweir 	private:
34cdf0e10cSrcweir 		::std::vector<ORowSetValueDecoratorRef> m_aKeys;
35cdf0e10cSrcweir 		sal_Int32 m_nValue;
36cdf0e10cSrcweir 
37cdf0e10cSrcweir 	protected:
38cdf0e10cSrcweir 		OKeyValue();
39cdf0e10cSrcweir 		OKeyValue(sal_Int32 nVal);
40cdf0e10cSrcweir 	public:
41cdf0e10cSrcweir 
42cdf0e10cSrcweir 		~OKeyValue();
43cdf0e10cSrcweir 
operator new(size_t nSize)44cdf0e10cSrcweir 		inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW( () )
45cdf0e10cSrcweir 			{ return ::rtl_allocateMemory( nSize ); }
operator new(size_t,void * _pHint)46cdf0e10cSrcweir 		inline static void * SAL_CALL operator new( size_t,void* _pHint ) SAL_THROW( () )
47cdf0e10cSrcweir 			{ return _pHint; }
operator delete(void * pMem)48cdf0e10cSrcweir 		inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW( () )
49cdf0e10cSrcweir 			{ ::rtl_freeMemory( pMem ); }
operator delete(void *,void *)50cdf0e10cSrcweir 		inline static void SAL_CALL operator delete( void *,void* ) SAL_THROW( () )
51cdf0e10cSrcweir 			{  }
52cdf0e10cSrcweir 
53cdf0e10cSrcweir 		static OKeyValue* createKeyValue(sal_Int32 nVal);
54cdf0e10cSrcweir 		//	static OKeyValue* createEmptyKeyValue();
55cdf0e10cSrcweir 
pushKey(const ORowSetValueDecoratorRef & _aValueRef)56cdf0e10cSrcweir 		inline void pushKey(const ORowSetValueDecoratorRef& _aValueRef)
57cdf0e10cSrcweir 		{
58cdf0e10cSrcweir 			m_aKeys.push_back(_aValueRef);
59cdf0e10cSrcweir 		}
setValue(sal_Int32 nVal)60cdf0e10cSrcweir 		inline void setValue(sal_Int32 nVal) { m_nValue = nVal; }
61cdf0e10cSrcweir 
getKeyString(::std::vector<ORowSetValueDecoratorRef>::size_type i) const62cdf0e10cSrcweir 		::rtl::OUString	getKeyString(::std::vector<ORowSetValueDecoratorRef>::size_type i) const
63cdf0e10cSrcweir 		{
64cdf0e10cSrcweir 			OSL_ENSURE(m_aKeys.size() > i,"Wrong index for KEyValue");
65cdf0e10cSrcweir 			return m_aKeys[i]->getValue();
66cdf0e10cSrcweir 		}
getKeyDouble(::std::vector<ORowSetValueDecoratorRef>::size_type i) const67cdf0e10cSrcweir 		double			getKeyDouble(::std::vector<ORowSetValueDecoratorRef>::size_type i) const
68cdf0e10cSrcweir 		{
69cdf0e10cSrcweir 			OSL_ENSURE(m_aKeys.size() > i,"Wrong index for KEyValue");
70cdf0e10cSrcweir 			return m_aKeys[i]->getValue();
71cdf0e10cSrcweir 		}
72cdf0e10cSrcweir 
getValue() const73cdf0e10cSrcweir 		inline sal_Int32 getValue() const { return m_nValue; }
74cdf0e10cSrcweir 	};
75cdf0e10cSrcweir }
76cdf0e10cSrcweir 
77cdf0e10cSrcweir #endif // CONNECTIVITY_TKEYVALUE_HXX
78cdf0e10cSrcweir 
79