Lines Matching defs:std

39 using namespace std::chrono;
45 std::string GetTypeName()
51 std::string GetTypeName<int>()
57 std::string GetTypeName<bool>()
63 std::string GetTypeName<int64_t>()
69 std::string GetTypeName<uint64_t>()
75 std::string GetTypeName<float>()
81 std::string GetTypeName<double>()
87 std::string GetTypeName<std::string>()
93 std::string GetTypeName<std::vector<std::string>>()
99 std::string GetTypeName<std::vector<double>>()
105 std::string GetTypeName<std::vector<bool>>()
111 std::string GetTypeName<std::vector<uint8_t>>()
117 std::string GetTypeName<Object>()
123 std::string GetTypeName<BigInt>()
133 queue_ = std::make_shared<SafeBlockQueue<uint64_t>>(1);
153 return (executorPool_.Execute(std::move(task)) == ExecutorPool::INVALID_TASK_ID) ? false : true;
157 void PreferencesImpl::LoadFromDisk(std::shared_ptr<PreferencesImpl> pref)
162 std::lock_guard<std::mutex> lock(pref->mutex_);
178 std::unique_lock<std::mutex> lock(mutex_);
180 cond_.wait_for(lock, std::chrono::seconds(WAIT_TIME), [this] { return loaded_.load(); });
188 PreferencesValue PreferencesImpl::Get(const std::string &key, const PreferencesValue &defValue)
203 std::map<std::string, PreferencesValue> PreferencesImpl::GetAll()
212 if constexpr (std::is_same<T, bool>::value) {
214 } else if constexpr (std::is_same<T, std::string>::value) {
216 } else if constexpr (std::is_same<T, std::monostate>::value) {
217 value = std::monostate();
219 std::stringstream ss;
226 static void Convert2PrefValue(const Element &element, std::vector<T> &values)
256 static void Convert2PrefValue(const Element &element, std::vector<uint8_t> &value)
281 bool Convert2PrefValue(const Element &element, std::variant<Types...> &value)
286 void ReadXmlElement(const Element &element, std::map<std::string, PreferencesValue> &prefMap)
290 prefMap.insert(std::make_pair(element.key_, value));
294 bool PreferencesImpl::ReadSettingXml(std::shared_ptr<PreferencesImpl> pref)
296 std::vector<Element> settings;
302 std::map<std::string, PreferencesValue> values;
306 pref->valuesCache_ = std::move(values);
314 if constexpr (std::is_same<T, bool>::value) {
316 } else if constexpr (std::is_same<T, std::string>::value) {
318 } else if constexpr (std::is_same<T, std::monostate>::value) {
321 elem.value_ = std::to_string(value);
326 void Convert2Element(Element &elem, const std::vector<T> &value)
328 elem.tag_ = GetTypeName<std::vector<T>>();
336 void Convert2Element(Element &elem, const std::vector<uint8_t> &value)
338 elem.tag_ = GetTypeName<std::vector<uint8_t>>();
369 auto *val = std::get_if<First>(&value);
376 template<typename... Types> void Convert2Element(Element &elem, const std::variant<Types...> &value)
387 const Options &options, const std::map<std::string, PreferencesValue> &writeToDiskMap)
389 std::vector<Element> settings;
402 bool PreferencesImpl::HasKey(const std::string &key)
412 int PreferencesImpl::Put(const std::string &key, const PreferencesValue &value)
435 int PreferencesImpl::Delete(const std::string &key)
459 int PreferencesImpl::WriteToDiskFile(std::shared_ptr<PreferencesImpl> pref)
461 std::list<std::string> keysModified;
462 std::map<std::string, PreferencesValue> writeToDiskMap;
464 [pref, &writeToDiskMap, &keysModified](const std::map<std::string, PreferencesValue> &map) {
466 keysModified = std::move(pref->modifiedKeys_);
468 writeToDiskMap = std::move(map);
487 std::weak_ptr<SafeBlockQueue<uint64_t>> queue = queue_;
495 std::lock_guard<std::mutex> lock(realThis->mutex_);
501 executorPool_.Schedule(std::chrono::milliseconds(TASK_EXEC_TIME), std::move(task));
513 std::lock_guard<std::mutex> lock(mutex_);
522 std::pair<int, PreferencesValue> PreferencesImpl::GetValue(const std::string &key, const PreferencesValue &defValue)
526 return std::make_pair(errCode, defValue);
532 return std::make_pair(E_OK, iter.second);
534 return std::make_pair(E_NO_DATA, defValue);
537 std::pair<int, std::map<std::string, PreferencesValue>> PreferencesImpl::GetAllData()
540 return std::make_pair(E_OK, valuesCache_.Clone());
543 void PreferencesImpl::NotifyPreferencesObserver(const std::list<std::string> &keysModified,
544 const std::map<std::string, PreferencesValue> &writeToDiskMap)
550 std::shared_lock<std::shared_mutex> autoLock(obseverMetux_);
552 std::map<std::string, PreferencesValue> records;
568 if (std::shared_ptr<PreferencesObserver> sharedPtr = weakPrt.lock()) {
577 std::weak_ptr<PreferencesObserver> weakPreferencesObserver = *it;
578 if (std::shared_ptr<PreferencesObserver> sharedPreferencesObserver = weakPreferencesObserver.lock()) {