LibreOffice Module connectivity (master) 1
TSortIndex.hxx
Go to the documentation of this file.
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#pragma once
20
22#include "TKeyValue.hxx"
23
24namespace connectivity
25{
26 enum class OKeyType
27 {
28 NONE, // do not sort
29 Double, // numeric key
30 String // String Key
31 };
32
33 enum class TAscendingOrder
34 {
35 ASC = 1, // ascending
36 DESC = -1 // otherwise
37 };
38
39 class OKeySet;
40 class OKeyValue; // simple class which holds a sal_Int32 and a std::vector<ORowSetValueDecoratorRef>
41
47 {
48 public:
49 typedef std::vector<std::pair<sal_Int32, std::unique_ptr<OKeyValue>>> TIntValuePairVector;
50 typedef std::vector<OKeyType> TKeyTypeVector;
51
52 private:
55 std::vector<TAscendingOrder> m_aAscending;
57
58 public:
59
60 OSortIndex( std::vector<OKeyType>&& _aKeyType,
61 std::vector<TAscendingOrder>&& _aAscending);
62 OSortIndex(OSortIndex const &) = delete; // MSVC2015 workaround
63 OSortIndex& operator=(OSortIndex const &) = delete; // MSVC2015 workaround
64
66
73 void AddKeyValue(std::unique_ptr<OKeyValue> pKeyValue);
74
78 void Freeze();
79
84 ::rtl::Reference<OKeySet> CreateKeySet();
85
86 const std::vector<OKeyType>& getKeyType() const { return m_aKeyType; }
87 TAscendingOrder getAscending(std::vector<TAscendingOrder>::size_type _nPos) const { return m_aAscending[_nPos]; }
88
89 };
90
91 // MSVC hack to avoid multiply defined std::vector-related symbols:
92 class OKeySet_Base: public ORefVector<sal_Int32> {};
93
99 {
101 public:
103 : m_bFrozen(false){}
104
105 bool isFrozen() const { return m_bFrozen; }
106 void setFrozen() { m_bFrozen = true; }
107 };
108}
109
110/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
The class OKeySet is a refcountable vector which also has a state.
Definition: TSortIndex.hxx:99
bool isFrozen() const
Definition: TSortIndex.hxx:105
The class OSortIndex can be used to implement a sorted index.
Definition: TSortIndex.hxx:47
TKeyTypeVector m_aKeyType
Definition: TSortIndex.hxx:54
std::vector< OKeyType > TKeyTypeVector
Definition: TSortIndex.hxx:50
std::vector< TAscendingOrder > m_aAscending
Definition: TSortIndex.hxx:55
OSortIndex(OSortIndex const &)=delete
std::vector< std::pair< sal_Int32, std::unique_ptr< OKeyValue > > > TIntValuePairVector
Definition: TSortIndex.hxx:49
OSortIndex & operator=(OSortIndex const &)=delete
TIntValuePairVector m_aKeyValues
Definition: TSortIndex.hxx:53
const std::vector< OKeyType > & getKeyType() const
Definition: TSortIndex.hxx:86
TAscendingOrder getAscending(std::vector< TAscendingOrder >::size_type _nPos) const
Definition: TSortIndex.hxx:87
#define OOO_DLLPUBLIC_DBTOOLS
Type m_aKeyType
NONE
sal_Int32 _nPos