1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_INDEXCOLLECTION_HXX
21 #define INCLUDED_DBACCESS_SOURCE_UI_INC_INDEXCOLLECTION_HXX
23 #include <com/sun/star/container/XNameAccess.hpp>
24 #include <com/sun/star/sdbc/SQLException.hpp>
25 #include <com/sun/star/beans/XPropertySet.hpp>
26 #include "indexes.hxx"
32 class OIndexCollection
35 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>
44 OIndexCollection(const OIndexCollection
& _rSource
);
45 // OIndexCollection(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxIndexes);
47 const OIndexCollection
& operator=(const OIndexCollection
& _rSource
);
49 // iterating through the collection
50 typedef OIndex
* iterator
;
51 typedef OIndex
const* const_iterator
;
53 /// get access to the first element of the index collection
54 Indexes::const_iterator
begin() const { return m_aIndexes
.begin(); }
55 /// get access to the first element of the index collection
56 Indexes::iterator
begin() { return m_aIndexes
.begin(); }
57 /// get access to the (last + 1st) element of the index collection
58 Indexes::const_iterator
end() const { return m_aIndexes
.end(); }
59 /// get access to the (last + 1st) element of the index collection
60 Indexes::iterator
end() { return m_aIndexes
.end(); }
63 Indexes::const_iterator
find(const OUString
& _rName
) const;
64 Indexes::iterator
find(const OUString
& _rName
);
65 Indexes::const_iterator
findOriginal(const OUString
& _rName
) const;
66 Indexes::iterator
findOriginal(const OUString
& _rName
);
68 // inserting without committing
69 // the OriginalName of the newly inserted index will be empty, thus indicating that it's new
70 Indexes::iterator
insert(const OUString
& _rName
);
71 // commit a new index, which is already part if the collection, but does not have an equivalent in the
73 void commitNewIndex(const Indexes::iterator
& _rPos
);
75 // reset the data for the given index
76 void resetIndex(const Indexes::iterator
& _rPos
);
78 // attach to a new key container
79 void attach(const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>& _rxIndexes
);
80 // detach from the container
83 // is the object valid?
84 bool isValid() const { return m_xIndexes
.is(); }
85 // number of contained indexes
86 sal_Int32
size() const { return m_aIndexes
.size(); }
88 /// drop an index, and remove it from the collection
89 bool drop(const Indexes::iterator
& _rPos
);
90 /// simply drop the index described by the name, but don't remove the descriptor from the collection
91 bool dropNoRemove(const Indexes::iterator
& _rPos
);
94 void implConstructFrom(const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>& _rxIndexes
);
95 static void implFillIndexInfo(OIndex
& _rIndex
, ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> _rxDescriptor
);
96 void implFillIndexInfo(OIndex
& _rIndex
);
101 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_INDEXCOLLECTION_HXX
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */