swift
orderable.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2015 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_MISC_ORDERABLE_H
7 #define SWIFT_MISC_ORDERABLE_H
8 
9 #include <QString>
10 #include <QVariant>
11 
12 #include "misc/propertyindexref.h"
13 #include "misc/swiftmiscexport.h"
14 
15 namespace swift::misc
16 {
19  {
20  public:
23  {
24  IndexOrder = CPropertyIndexRef::GlobalIndexIOrderable,
25  IndexOrderString
26  };
27 
29  int getOrder() const { return m_order; }
30 
32  QString getOrderAsString() const;
33 
35  void setOrder(int order) { m_order = order; }
36 
38  bool hasValidOrder() const;
39 
41  static bool isAnyOrderIndex(int index);
42 
43  protected:
45  static bool canHandleIndex(CPropertyIndexRef index);
46 
48  IOrderable();
49 
51  IOrderable(int order);
52 
54  QVariant propertyByIndex(CPropertyIndexRef index) const;
55 
57  void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant);
58 
60  int comparePropertyByIndex(CPropertyIndexRef index, const IOrderable &compareValue) const;
61 
62  int m_order = -1;
63  };
64 } // namespace swift::misc
65 
66 #endif // SWIFT_MISC_ORDERABLE_H
Non-owning reference to a CPropertyIndex with a subset of its features.
Entity with order attribute (can be manually ordered in views)
Definition: orderable.h:19
void setOrder(int order)
Set order.
Definition: orderable.h:35
ColumnIndex
Properties by index.
Definition: orderable.h:23
int getOrder() const
Order.
Definition: orderable.h:29
Free functions in swift::misc.
#define SWIFT_MISC_EXPORT
Export a class or function from the library.