Changeset View
Changeset View
Standalone View
Standalone View
common/domain/typeimplementations_p.h
Show First 20 Lines • Show All 120 Lines • ▼ Show 20 Line(s) | 116 | public: | |||
---|---|---|---|---|---|
121 | 121 | | |||
122 | template <typename EntityType> | 122 | template <typename EntityType> | ||
123 | static QMap<QByteArray, int> databases() | 123 | static QMap<QByteArray, int> databases() | ||
124 | { | 124 | { | ||
125 | return Indexer::databases(); | 125 | return Indexer::databases(); | ||
126 | } | 126 | } | ||
127 | }; | 127 | }; | ||
128 | 128 | | |||
129 | template <typename RangeBeginProperty, typename RangeEndProperty> | ||||
130 | class SampledPeriodIndex | ||||
131 | { | ||||
132 | static_assert(std::is_same<typename RangeBeginProperty::Type, QDateTime>::value && | ||||
133 | std::is_same<typename RangeEndProperty::Type, QDateTime>::value, | ||||
134 | "Date range index is not supported for types other than 'QDateTime's"); | ||||
135 | | ||||
136 | public: | ||||
137 | static void configure(TypeIndex &index) | ||||
138 | { | ||||
139 | index.addSampledPeriodIndex<RangeBeginProperty, RangeEndProperty>(); | ||||
140 | } | ||||
141 | | ||||
142 | template <typename EntityType> | ||||
143 | static QMap<QByteArray, int> databases() | ||||
144 | { | ||||
145 | return {{QByteArray{EntityType::name} +".index." + RangeBeginProperty::name + ".range." + RangeEndProperty::name, 1}}; | ||||
146 | } | ||||
147 | }; | ||||
148 | | ||||
129 | template <typename EntityType, typename ... Indexes> | 149 | template <typename EntityType, typename ... Indexes> | ||
130 | class IndexConfig | 150 | class IndexConfig | ||
131 | { | 151 | { | ||
132 | template <typename T> | 152 | template <typename T> | ||
133 | static void applyIndex(TypeIndex &index) | 153 | static void applyIndex(TypeIndex &index) | ||
134 | { | 154 | { | ||
135 | T::configure(index); | 155 | T::configure(index); | ||
136 | } | 156 | } | ||
Show All 34 Lines |