Commit 0f75989d authored by Volker Krause's avatar Volker Krause
Browse files

Compile on Android

parent 1f60bc50
......@@ -56,17 +56,20 @@ void Cache::addNegativeLocationCacheEntry(const QString &backendId, const QStrin
CacheEntry<Location> Cache::lookupLocation(const QString &backendId, const QString &cacheKey)
{
CacheEntry<Location> entry;
const auto dir = cachePath(backendId, QStringLiteral("location"));
QFile f (dir + cacheKey + QLatin1String(".json"));
if (!f.open(QFile::ReadOnly)) {
return {{}, CacheHitType::Miss };
entry.type = CacheHitType::Miss;
return entry;
}
if (f.size() == 0) {
return {{}, CacheHitType::Negative };
entry.type = CacheHitType::Negative;
return entry;
}
CacheEntry<Location> entry;
entry.type = CacheHitType::Positive;
entry.data = Location::fromJson(QJsonDocument::fromJson(f.readAll()).array());
return entry;
......
......@@ -176,7 +176,7 @@ QJsonArray Location::toJson(const std::vector<Location> &locs)
{
QJsonArray a;
//a.reserve(locs.size());
std::transform(locs.begin(), locs.end(), std::back_inserter(a), qOverload<const Location&>(&Location::toJson));
std::transform(locs.begin(), locs.end(), std::back_inserter(a), QOverload<const Location&>::of(&Location::toJson));
return a;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment