summaryrefslogtreecommitdiffstats
path: root/common/typeindex.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/typeindex.cpp')
-rw-r--r--common/typeindex.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/common/typeindex.cpp b/common/typeindex.cpp
index 816e7ee..64c2a01 100644
--- a/common/typeindex.cpp
+++ b/common/typeindex.cpp
@@ -66,7 +66,7 @@ QByteArray TypeIndex::indexName(const QByteArray &property, const QByteArray &so
66template <> 66template <>
67void TypeIndex::addProperty<QByteArray>(const QByteArray &property) 67void TypeIndex::addProperty<QByteArray>(const QByteArray &property)
68{ 68{
69 auto indexer = [this, property](const QByteArray &identifier, const QVariant &value, Sink::Storage::Transaction &transaction) { 69 auto indexer = [this, property](const QByteArray &identifier, const QVariant &value, Sink::Storage::DataStore::Transaction &transaction) {
70 // SinkTrace() << "Indexing " << mType + ".index." + property << value.toByteArray(); 70 // SinkTrace() << "Indexing " << mType + ".index." + property << value.toByteArray();
71 Index(indexName(property), transaction).add(getByteArray(value), identifier); 71 Index(indexName(property), transaction).add(getByteArray(value), identifier);
72 }; 72 };
@@ -77,7 +77,7 @@ void TypeIndex::addProperty<QByteArray>(const QByteArray &property)
77template <> 77template <>
78void TypeIndex::addProperty<QString>(const QByteArray &property) 78void TypeIndex::addProperty<QString>(const QByteArray &property)
79{ 79{
80 auto indexer = [this, property](const QByteArray &identifier, const QVariant &value, Sink::Storage::Transaction &transaction) { 80 auto indexer = [this, property](const QByteArray &identifier, const QVariant &value, Sink::Storage::DataStore::Transaction &transaction) {
81 // SinkTrace() << "Indexing " << mType + ".index." + property << value.toByteArray(); 81 // SinkTrace() << "Indexing " << mType + ".index." + property << value.toByteArray();
82 Index(indexName(property), transaction).add(getByteArray(value), identifier); 82 Index(indexName(property), transaction).add(getByteArray(value), identifier);
83 }; 83 };
@@ -88,7 +88,7 @@ void TypeIndex::addProperty<QString>(const QByteArray &property)
88template <> 88template <>
89void TypeIndex::addProperty<QDateTime>(const QByteArray &property) 89void TypeIndex::addProperty<QDateTime>(const QByteArray &property)
90{ 90{
91 auto indexer = [this, property](const QByteArray &identifier, const QVariant &value, Sink::Storage::Transaction &transaction) { 91 auto indexer = [this, property](const QByteArray &identifier, const QVariant &value, Sink::Storage::DataStore::Transaction &transaction) {
92 //SinkTrace() << "Indexing " << mType + ".index." + property << getByteArray(value); 92 //SinkTrace() << "Indexing " << mType + ".index." + property << getByteArray(value);
93 Index(indexName(property), transaction).add(getByteArray(value), identifier); 93 Index(indexName(property), transaction).add(getByteArray(value), identifier);
94 }; 94 };
@@ -99,7 +99,7 @@ void TypeIndex::addProperty<QDateTime>(const QByteArray &property)
99template <> 99template <>
100void TypeIndex::addPropertyWithSorting<QByteArray, QDateTime>(const QByteArray &property, const QByteArray &sortProperty) 100void TypeIndex::addPropertyWithSorting<QByteArray, QDateTime>(const QByteArray &property, const QByteArray &sortProperty)
101{ 101{
102 auto indexer = [=](const QByteArray &identifier, const QVariant &value, const QVariant &sortValue, Sink::Storage::Transaction &transaction) { 102 auto indexer = [=](const QByteArray &identifier, const QVariant &value, const QVariant &sortValue, Sink::Storage::DataStore::Transaction &transaction) {
103 const auto date = sortValue.toDateTime(); 103 const auto date = sortValue.toDateTime();
104 const auto propertyValue = getByteArray(value); 104 const auto propertyValue = getByteArray(value);
105 Index(indexName(property, sortProperty), transaction).add(propertyValue + toSortableByteArray(date), identifier); 105 Index(indexName(property, sortProperty), transaction).add(propertyValue + toSortableByteArray(date), identifier);
@@ -108,7 +108,7 @@ void TypeIndex::addPropertyWithSorting<QByteArray, QDateTime>(const QByteArray &
108 mSortedProperties.insert(property, sortProperty); 108 mSortedProperties.insert(property, sortProperty);
109} 109}
110 110
111void TypeIndex::add(const QByteArray &identifier, const Sink::ApplicationDomain::BufferAdaptor &bufferAdaptor, Sink::Storage::Transaction &transaction) 111void TypeIndex::add(const QByteArray &identifier, const Sink::ApplicationDomain::BufferAdaptor &bufferAdaptor, Sink::Storage::DataStore::Transaction &transaction)
112{ 112{
113 for (const auto &property : mProperties) { 113 for (const auto &property : mProperties) {
114 const auto value = bufferAdaptor.getProperty(property); 114 const auto value = bufferAdaptor.getProperty(property);
@@ -123,7 +123,7 @@ void TypeIndex::add(const QByteArray &identifier, const Sink::ApplicationDomain:
123 } 123 }
124} 124}
125 125
126void TypeIndex::remove(const QByteArray &identifier, const Sink::ApplicationDomain::BufferAdaptor &bufferAdaptor, Sink::Storage::Transaction &transaction) 126void TypeIndex::remove(const QByteArray &identifier, const Sink::ApplicationDomain::BufferAdaptor &bufferAdaptor, Sink::Storage::DataStore::Transaction &transaction)
127{ 127{
128 for (const auto &property : mProperties) { 128 for (const auto &property : mProperties) {
129 const auto value = bufferAdaptor.getProperty(property); 129 const auto value = bufferAdaptor.getProperty(property);
@@ -159,7 +159,7 @@ static QVector<QByteArray> indexLookup(Index &index, Query::Comparator filter)
159 return keys; 159 return keys;
160} 160}
161 161
162QVector<QByteArray> TypeIndex::query(const Sink::Query &query, QSet<QByteArray> &appliedFilters, QByteArray &appliedSorting, Sink::Storage::Transaction &transaction) 162QVector<QByteArray> TypeIndex::query(const Sink::Query &query, QSet<QByteArray> &appliedFilters, QByteArray &appliedSorting, Sink::Storage::DataStore::Transaction &transaction)
163{ 163{
164 QVector<QByteArray> keys; 164 QVector<QByteArray> keys;
165 for (auto it = mSortedProperties.constBegin(); it != mSortedProperties.constEnd(); it++) { 165 for (auto it = mSortedProperties.constBegin(); it != mSortedProperties.constEnd(); it++) {
@@ -185,7 +185,7 @@ QVector<QByteArray> TypeIndex::query(const Sink::Query &query, QSet<QByteArray>
185 return keys; 185 return keys;
186} 186}
187 187
188QVector<QByteArray> TypeIndex::lookup(const QByteArray &property, const QVariant &value, Sink::Storage::Transaction &transaction) 188QVector<QByteArray> TypeIndex::lookup(const QByteArray &property, const QVariant &value, Sink::Storage::DataStore::Transaction &transaction)
189{ 189{
190 SinkTrace() << "Index lookup on property: " << property << mSecondaryProperties.keys() << mProperties; 190 SinkTrace() << "Index lookup on property: " << property << mSecondaryProperties.keys() << mProperties;
191 if (mProperties.contains(property)) { 191 if (mProperties.contains(property)) {
@@ -218,19 +218,19 @@ QVector<QByteArray> TypeIndex::lookup(const QByteArray &property, const QVariant
218} 218}
219 219
220template <> 220template <>
221void TypeIndex::index<QByteArray, QByteArray>(const QByteArray &leftName, const QByteArray &rightName, const QVariant &leftValue, const QVariant &rightValue, Sink::Storage::Transaction &transaction) 221void TypeIndex::index<QByteArray, QByteArray>(const QByteArray &leftName, const QByteArray &rightName, const QVariant &leftValue, const QVariant &rightValue, Sink::Storage::DataStore::Transaction &transaction)
222{ 222{
223 Index(indexName(leftName + rightName), transaction).add(getByteArray(leftValue), getByteArray(rightValue)); 223 Index(indexName(leftName + rightName), transaction).add(getByteArray(leftValue), getByteArray(rightValue));
224} 224}
225 225
226template <> 226template <>
227void TypeIndex::index<QString, QByteArray>(const QByteArray &leftName, const QByteArray &rightName, const QVariant &leftValue, const QVariant &rightValue, Sink::Storage::Transaction &transaction) 227void TypeIndex::index<QString, QByteArray>(const QByteArray &leftName, const QByteArray &rightName, const QVariant &leftValue, const QVariant &rightValue, Sink::Storage::DataStore::Transaction &transaction)
228{ 228{
229 Index(indexName(leftName + rightName), transaction).add(getByteArray(leftValue), getByteArray(rightValue)); 229 Index(indexName(leftName + rightName), transaction).add(getByteArray(leftValue), getByteArray(rightValue));
230} 230}
231 231
232template <> 232template <>
233QVector<QByteArray> TypeIndex::secondaryLookup<QByteArray>(const QByteArray &leftName, const QByteArray &rightName, const QVariant &value, Sink::Storage::Transaction &transaction) 233QVector<QByteArray> TypeIndex::secondaryLookup<QByteArray>(const QByteArray &leftName, const QByteArray &rightName, const QVariant &value, Sink::Storage::DataStore::Transaction &transaction)
234{ 234{
235 QVector<QByteArray> keys; 235 QVector<QByteArray> keys;
236 Index index(indexName(leftName + rightName), transaction); 236 Index index(indexName(leftName + rightName), transaction);
@@ -242,7 +242,7 @@ QVector<QByteArray> TypeIndex::secondaryLookup<QByteArray>(const QByteArray &lef
242} 242}
243 243
244template <> 244template <>
245QVector<QByteArray> TypeIndex::secondaryLookup<QString>(const QByteArray &leftName, const QByteArray &rightName, const QVariant &value, Sink::Storage::Transaction &transaction) 245QVector<QByteArray> TypeIndex::secondaryLookup<QString>(const QByteArray &leftName, const QByteArray &rightName, const QVariant &value, Sink::Storage::DataStore::Transaction &transaction)
246{ 246{
247 QVector<QByteArray> keys; 247 QVector<QByteArray> keys;
248 Index index(indexName(leftName + rightName), transaction); 248 Index index(indexName(leftName + rightName), transaction);