1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: TKeyValue.hxx,v $
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
41 ::std::vector
<ORowSetValueDecoratorRef
> m_aKeys
;
46 OKeyValue(sal_Int32 nVal
);
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( () )
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( () )
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