From 1d468ac35ad88d8c77cc83f25e3704d9bd7df01b Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Wed, 2 Aug 2023 18:35:35 +0200 Subject: chore: reformat Signed-off-by: Sefa Eyeoglu --- launcher/RWStorage.h | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'launcher/RWStorage.h') diff --git a/launcher/RWStorage.h b/launcher/RWStorage.h index 3028388e..5764d795 100644 --- a/launcher/RWStorage.h +++ b/launcher/RWStorage.h @@ -1,13 +1,12 @@ #pragma once -#include -#include #include +#include #include +#include template -class RWStorage -{ -public: +class RWStorage { + public: void add(K key, V value) { QWriteLocker l(&lock); @@ -17,21 +16,19 @@ public: V get(K key) { QReadLocker l(&lock); - if(cache.contains(key)) - { + if (cache.contains(key)) { return cache[key]; - } - else return V(); + } else + return V(); } bool get(K key, V& value) { QReadLocker l(&lock); - if(cache.contains(key)) - { + if (cache.contains(key)) { value = cache[key]; return true; - } - else return false; + } else + return false; } bool has(K key) { @@ -41,15 +38,14 @@ public: bool stale(K key) { QReadLocker l(&lock); - if(!cache.contains(key)) + if (!cache.contains(key)) return true; return stale_entries.contains(key); } void setStale(K key) { QWriteLocker l(&lock); - if(cache.contains(key)) - { + if (cache.contains(key)) { stale_entries.insert(key); } } @@ -59,7 +55,8 @@ public: cache.clear(); stale_entries.clear(); } -private: + + private: QReadWriteLock lock; QMap cache; QSet stale_entries; -- cgit