Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_TKEYVALUE_HXX
20 : #define INCLUDED_CONNECTIVITY_SOURCE_INC_TKEYVALUE_HXX
21 :
22 : #include <connectivity/FValue.hxx>
23 : #include <connectivity/dbtoolsdllapi.hxx>
24 :
25 : namespace connectivity
26 : {
27 : class OOO_DLLPUBLIC_DBTOOLS OKeyValue
28 : {
29 : private:
30 : ::std::vector<ORowSetValueDecoratorRef> m_aKeys;
31 : sal_Int32 m_nValue;
32 :
33 : protected:
34 : OKeyValue(sal_Int32 nVal);
35 : public:
36 :
37 : ~OKeyValue();
38 :
39 30 : inline static void * SAL_CALL operator new( size_t nSize )
40 30 : { return ::rtl_allocateMemory( nSize ); }
41 : inline static void * SAL_CALL operator new( size_t,void* _pHint )
42 : { return _pHint; }
43 30 : inline static void SAL_CALL operator delete( void * pMem )
44 30 : { ::rtl_freeMemory( pMem ); }
45 : inline static void SAL_CALL operator delete( void *,void* )
46 : { }
47 :
48 : static OKeyValue* createKeyValue(sal_Int32 nVal);
49 : // static OKeyValue* createEmptyKeyValue();
50 :
51 30 : inline void pushKey(const ORowSetValueDecoratorRef& _aValueRef)
52 : {
53 30 : m_aKeys.push_back(_aValueRef);
54 30 : }
55 : inline void setValue(sal_Int32 nVal) { m_nValue = nVal; }
56 :
57 178 : OUString getKeyString(::std::vector<ORowSetValueDecoratorRef>::size_type i) const
58 : {
59 : OSL_ENSURE(m_aKeys.size() > i,"Wrong index for KEyValue");
60 178 : return m_aKeys[i]->getValue();
61 : }
62 0 : double getKeyDouble(::std::vector<ORowSetValueDecoratorRef>::size_type i) const
63 : {
64 : OSL_ENSURE(m_aKeys.size() > i,"Wrong index for KEyValue");
65 0 : return m_aKeys[i]->getValue();
66 : }
67 :
68 30 : inline sal_Int32 getValue() const { return m_nValue; }
69 : };
70 : }
71 :
72 : #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_TKEYVALUE_HXX
73 :
74 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|