Changeset View
Changeset View
Standalone View
Standalone View
common/domain/typeimplementations_p.h
Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Line(s) | 51 | public: | |||
---|---|---|---|---|---|
57 | template <typename EntityType> | 57 | template <typename EntityType> | ||
58 | static QMap<QByteArray, int> databases() | 58 | static QMap<QByteArray, int> databases() | ||
59 | { | 59 | { | ||
60 | return {{QByteArray{EntityType::name} +".index." + Property::name, 1}}; | 60 | return {{QByteArray{EntityType::name} +".index." + Property::name, 1}}; | ||
61 | } | 61 | } | ||
62 | }; | 62 | }; | ||
63 | 63 | | |||
64 | 64 | | |||
65 | template <typename Property, typename SortProperty> | 65 | template <typename Property, typename SortProperty = void> | ||
66 | class SortedIndex | 66 | class SortedIndex | ||
67 | { | 67 | { | ||
68 | public: | 68 | public: | ||
69 | static void configure(TypeIndex &index) | 69 | static void configure(TypeIndex &index) | ||
70 | { | 70 | { | ||
71 | index.addPropertyWithSorting<Property, SortProperty>(); | 71 | index.addPropertyWithSorting<Property, SortProperty>(); | ||
72 | } | 72 | } | ||
73 | 73 | | |||
74 | template <typename EntityType> | 74 | template <typename EntityType> | ||
75 | static QMap<QByteArray, int> databases() | 75 | static QMap<QByteArray, int> databases() | ||
76 | { | 76 | { | ||
77 | return {{QByteArray{EntityType::name} +".index." + Property::name + ".sort." + SortProperty::name, 1}}; | 77 | return {{QByteArray{EntityType::name} +".index." + Property::name + ".sort." + SortProperty::name, 1}}; | ||
78 | } | 78 | } | ||
79 | }; | 79 | }; | ||
80 | 80 | | |||
81 | template <typename SortProperty> | ||||
82 | class SortedIndex<SortProperty, void> | ||||
83 | { | ||||
84 | public: | ||||
85 | static void configure(TypeIndex &index) | ||||
86 | { | ||||
87 | index.addSortedProperty<SortProperty>(); | ||||
88 | } | ||||
89 | | ||||
90 | template <typename EntityType> | ||||
91 | static QMap<QByteArray, int> databases() | ||||
92 | { | ||||
93 | return {{QByteArray{EntityType::name} +".index." + SortProperty::name + ".sorted", 1}}; | ||||
94 | } | ||||
95 | }; | ||||
96 | | ||||
81 | template <typename Property, typename SecondaryProperty> | 97 | template <typename Property, typename SecondaryProperty> | ||
82 | class SecondaryIndex | 98 | class SecondaryIndex | ||
83 | { | 99 | { | ||
84 | public: | 100 | public: | ||
85 | static void configure(TypeIndex &index) | 101 | static void configure(TypeIndex &index) | ||
86 | { | 102 | { | ||
87 | index.addSecondaryProperty<Property, SecondaryProperty>(); | 103 | index.addSecondaryProperty<Property, SecondaryProperty>(); | ||
88 | } | 104 | } | ||
▲ Show 20 Lines • Show All 66 Lines • Show Last 20 Lines |