update dev300-m58
[ooovba.git] / connectivity / source / inc / TKeyValue.hxx
blob2432b9ff583d69cdf1b0dca744005a2f4fb87c82
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: TKeyValue.hxx,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef CONNECTIVITY_TKEYVALUE_HXX
31 #define CONNECTIVITY_TKEYVALUE_HXX
33 #include "connectivity/FValue.hxx"
34 #include "connectivity/dbtoolsdllapi.hxx"
36 namespace connectivity
38 class OOO_DLLPUBLIC_DBTOOLS OKeyValue
40 private:
41 ::std::vector<ORowSetValueDecoratorRef> m_aKeys;
42 sal_Int32 m_nValue;
44 protected:
45 OKeyValue();
46 OKeyValue(sal_Int32 nVal);
47 public:
49 ~OKeyValue();
51 inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW( () )
52 { return ::rtl_allocateMemory( nSize ); }
53 inline static void * SAL_CALL operator new( size_t,void* _pHint ) SAL_THROW( () )
54 { return _pHint; }
55 inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW( () )
56 { ::rtl_freeMemory( pMem ); }
57 inline static void SAL_CALL operator delete( void *,void* ) SAL_THROW( () )
58 { }
60 static OKeyValue* createKeyValue(sal_Int32 nVal);
61 // static OKeyValue* createEmptyKeyValue();
63 inline void pushKey(const ORowSetValueDecoratorRef& _aValueRef)
65 m_aKeys.push_back(_aValueRef);
67 inline void setValue(sal_Int32 nVal) { m_nValue = nVal; }
69 ::rtl::OUString getKeyString(::std::vector<ORowSetValueDecoratorRef>::size_type i) const
71 OSL_ENSURE(m_aKeys.size() > i,"Wrong index for KEyValue");
72 return m_aKeys[i]->getValue();
74 double getKeyDouble(::std::vector<ORowSetValueDecoratorRef>::size_type i) const
76 OSL_ENSURE(m_aKeys.size() > i,"Wrong index for KEyValue");
77 return m_aKeys[i]->getValue();
80 inline sal_Int32 getValue() const { return m_nValue; }
84 #endif // CONNECTIVITY_TKEYVALUE_HXX