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 :
20 : #ifndef _DBAUI_INDEXES_HXX_
21 : #define _DBAUI_INDEXES_HXX_
22 :
23 : #include <tools/string.hxx>
24 : #include <comphelper/stl_types.hxx>
25 :
26 : //......................................................................
27 : namespace dbaui
28 : {
29 : //......................................................................
30 : //==================================================================
31 : //= OIndexField
32 : //==================================================================
33 0 : struct OIndexField
34 : {
35 : String sFieldName;
36 : sal_Bool bSortAscending;
37 :
38 0 : OIndexField() : bSortAscending(sal_True) { }
39 : };
40 :
41 : DECLARE_STL_VECTOR( OIndexField, IndexFields );
42 :
43 : //==================================================================
44 : //= OIndex
45 : //==================================================================
46 : struct GrantIndexAccess
47 : {
48 : friend class OIndexCollection;
49 : private:
50 0 : GrantIndexAccess() { }
51 : };
52 :
53 : //..................................................................
54 0 : struct OIndex
55 : {
56 : protected:
57 : ::rtl::OUString sOriginalName;
58 : sal_Bool bModified;
59 :
60 : public:
61 : ::rtl::OUString sName;
62 : ::rtl::OUString sDescription;
63 : sal_Bool bPrimaryKey;
64 : sal_Bool bUnique;
65 : IndexFields aFields;
66 :
67 : public:
68 0 : OIndex(const ::rtl::OUString& _rOriginalName)
69 0 : : sOriginalName(_rOriginalName), bModified(sal_False), sName(_rOriginalName), bPrimaryKey(sal_False), bUnique(sal_False)
70 : {
71 0 : }
72 :
73 0 : const ::rtl::OUString& getOriginalName() const { return sOriginalName; }
74 :
75 0 : sal_Bool isModified() const { return bModified; }
76 0 : void setModified(sal_Bool _bModified) { bModified = _bModified; }
77 0 : void clearModified() { setModified(sal_False); }
78 :
79 0 : sal_Bool isNew() const { return getOriginalName().isEmpty(); }
80 0 : void flagAsNew(const GrantIndexAccess&) { sOriginalName = ::rtl::OUString(); }
81 0 : void flagAsCommitted(const GrantIndexAccess&) { sOriginalName = sName; }
82 :
83 :
84 : private:
85 : OIndex(); // not implemented
86 : };
87 :
88 : DECLARE_STL_VECTOR( OIndex, Indexes );
89 :
90 : //......................................................................
91 : } // namespace dbaui
92 : //......................................................................
93 :
94 : #endif // _DBAUI_INDEXES_HXX_
95 :
96 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|