added missing #include

This commit is contained in:
jkriege2 2024-01-25 19:19:40 +01:00
parent 29bdaad85b
commit 56ecb35ce9
2 changed files with 5 additions and 4 deletions

View File

@ -33,6 +33,7 @@
#include <chrono> #include <chrono>
#include <atomic> #include <atomic>
#include <algorithm> #include <algorithm>
#include <memory>
#include <unordered_map> #include <unordered_map>
/** \brief tag type to configure JKQTPDataCache for thread-safety /** \brief tag type to configure JKQTPDataCache for thread-safety
@ -106,7 +107,7 @@ struct JKQTPDataCache {
return it->second; return it->second;
} }
if (m_maxEntries>0 && m_cache.size()>=static_cast<size_t>(m_maxEntries)) cleanCache_notThreadSafe(); if (m_maxEntries>0 && m_cache.size()>=static_cast<size_t>(m_maxEntries)) cleanCache_notThreadSafe();
m_cacheLastUseTimestamps.emplace(cacheKey, std::make_shared<std::atomic<int64_t>>(currenTimestamp())); m_cacheLastUseTimestamps.emplace(cacheKey, std::make_shared<std::atomic<int64_t> >(currenTimestamp()));
const auto newData=m_generateData(key); const auto newData=m_generateData(key);
m_cache.emplace(cacheKey,newData); m_cache.emplace(cacheKey,newData);
return newData; return newData;
@ -124,7 +125,7 @@ struct JKQTPDataCache {
if (m_maxEntries>0 && m_cache.size()>=static_cast<size_t>(m_maxEntries)) cleanCache_notThreadSafe(); if (m_maxEntries>0 && m_cache.size()>=static_cast<size_t>(m_maxEntries)) cleanCache_notThreadSafe();
const auto newData=m_generateData(key); const auto newData=m_generateData(key);
m_cache.emplace(cacheKey,newData); m_cache.emplace(cacheKey,newData);
m_cacheLastUseTimestamps.emplace(cacheKey, std::make_shared<std::atomic<int64_t>>(currenTimestamp())); m_cacheLastUseTimestamps.emplace(cacheKey, std::make_shared<std::atomic<int64_t> >(currenTimestamp()));
return newData; return newData;
} }
@ -182,7 +183,7 @@ private:
const int m_maxEntries; const int m_maxEntries;
const double m_retainFraction; const double m_retainFraction;
std::unordered_map<TKey, TData> m_cache; std::unordered_map<TKey, TData> m_cache;
std::unordered_map<TKey, std::shared_ptr<std::atomic<int64_t>>> m_cacheLastUseTimestamps; std::unordered_map<TKey, std::shared_ptr<std::atomic<int64_t> > > m_cacheLastUseTimestamps;
mutable QReadWriteLock m_mutex; mutable QReadWriteLock m_mutex;
const std::function<TData(TKeyInSignature)> m_generateData; const std::function<TData(TKeyInSignature)> m_generateData;
}; };

View File

@ -137,7 +137,7 @@ JKQTPExpected<QColor, JKQTPCSSParser::GeneralError> JKQTPCSSParser::parseColor(b
return {JKQTPUnexpected, UnconvertobleError("#"+hex, "HEX-RGB value", pos) }; return {JKQTPUnexpected, UnconvertobleError("#"+hex, "HEX-RGB value", pos) };
} }
} else if (CurrentToken.is(Token::TokenType::NAME)) { } else if (CurrentToken.is(Token::TokenType::NAME)) {
static QMap<QString,QPair<int,int>> rgbFuncs={ static QMap<QString,QPair<int,int> > rgbFuncs={
{"rgb", QPair<int,int>(3,4)}, {"rgb", QPair<int,int>(3,4)},
{"rgba",QPair<int,int>(4,4)}, {"rgba",QPair<int,int>(4,4)},
{"hsl",QPair<int,int>(3,4)}, {"hsl",QPair<int,int>(3,4)},