-
Notifications
You must be signed in to change notification settings - Fork 0
/
NameValueStoreManager.cpp
51 lines (42 loc) · 1.03 KB
/
NameValueStoreManager.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/**
* SimulationManager.cpp
* Copyright (c) 2013 ROBLOX Corp. All Rights Reserved.
*/
#include "stdafx.h"
#include "NameValueStoreManager.h"
// Qt Headers
#include <QVariant>
void NameValueStoreManager::setValue(const QString& storeID, const QString& key, const QVariant &value)
{
Stores::iterator iter = store.find(storeID);
if (iter != store.end())
{
iter.value().insert(key, value);
}
else
{
Properties prop;
prop.insert(key, value);
store.insert(storeID, prop);
}
}
QVariant NameValueStoreManager::getValue(const QString&storeID, const QString& key, bool *isOK)
{
if (isOK) *isOK = false;
Stores::iterator iter = store.find(storeID);
if (iter != store.end())
{
Properties prop = iter.value();
Properties::iterator prop_iter = prop.find(key);
if (prop_iter != prop.end())
{
if (isOK) *isOK = true;
return prop_iter.value();
}
}
return QVariant();
}
bool NameValueStoreManager::clear(const QString& storeID)
{ return store.remove(storeID); }
void NameValueStoreManager::clearAll()
{ store.clear(); }