aboutsummaryrefslogtreecommitdiffstats
path: root/CommonLibs/ConfigurationTest.cpp
diff options
context:
space:
mode:
authorkurtis.heimerl <kurtis.heimerl@19bc5d8c-e614-43d4-8b26-e1612bc8e597>2012-10-26 06:25:56 +0000
committerkurtis.heimerl <kurtis.heimerl@19bc5d8c-e614-43d4-8b26-e1612bc8e597>2012-10-26 06:25:56 +0000
commitbcf60a8fc97afd4a028e7d588a62a3edb5bf0cf8 (patch)
treed2a9775fdbb907722926c30ae86facf97bf2fe81 /CommonLibs/ConfigurationTest.cpp
parentf60dafa4ff101800efd8b332498971ca22489bb7 (diff)
merged private Config to public: r4211:
Changes to ConfigurationTable class. Cleaner locking operations, fewer messages for normal operations, ALERT logging for truly abnormal operations. git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@4348 19bc5d8c-e614-43d4-8b26-e1612bc8e597
Diffstat (limited to 'CommonLibs/ConfigurationTest.cpp')
-rw-r--r--CommonLibs/ConfigurationTest.cpp40
1 files changed, 38 insertions, 2 deletions
diff --git a/CommonLibs/ConfigurationTest.cpp b/CommonLibs/ConfigurationTest.cpp
index ef82601..5acb9d5 100644
--- a/CommonLibs/ConfigurationTest.cpp
+++ b/CommonLibs/ConfigurationTest.cpp
@@ -28,10 +28,11 @@
#include "Configuration.h"
#include <iostream>
+#include <string>
using namespace std;
-ConfigurationTable gConfig("exampleconfig.db");
+ConfigurationTable gConfig("exampleconfig.db","test",LOG_LOCAL7);
void purgeConfig(void*,int,char const*, char const*, sqlite3_int64)
{
@@ -61,9 +62,44 @@ int main(int argc, char *argv[])
cout << "defined table[" << keys[i] << "]=" << gConfig.defines(keys[i]) << endl;
}
- gConfig.set("key5","100 200 300 400");
+ gConfig.set("key5","100 200 300 400 ");
std::vector<unsigned> vect = gConfig.getVector("key5");
cout << "vect length " << vect.size() << ": ";
for (unsigned i=0; i<vect.size(); i++) cout << " " << vect[i];
cout << endl;
+ std::vector<string> svect = gConfig.getVectorOfStrings("key5");
+ cout << "vect length " << svect.size() << ": ";
+ for (unsigned i=0; i<svect.size(); i++) cout << " " << svect[i] << ":";
+ cout << endl;
+
+ cout << "bool " << gConfig.getBool("booltest") << endl;
+ gConfig.set("booltest",1);
+ cout << "bool " << gConfig.getBool("booltest") << endl;
+ gConfig.set("booltest",0);
+ cout << "bool " << gConfig.getBool("booltest") << endl;
+
+ gConfig.getStr("newstring","new string value");
+ gConfig.getNum("numnumber",42);
+
+
+ SimpleKeyValue pairs;
+ pairs.addItems(" a=1 b=34 dd=143 ");
+ cout<< pairs.get("a") << endl;
+ cout<< pairs.get("b") << endl;
+ cout<< pairs.get("dd") << endl;
+
+ gConfig.set("fkey","123.456");
+ float fval = gConfig.getFloat("fkey");
+ cout << "fkey " << fval << endl;
+
+ cout << "search fkey:" << endl;
+ gConfig.find("fkey",cout);
+ gConfig.unset("fkey");
+ cout << "search fkey:" << endl;
+ gConfig.find("fkey",cout);
+ gConfig.remove("fkey");
+ cout << "search fkey:" << endl;
+ gConfig.find("fkey",cout);
+
+ gConfig.getNum("supposedtoabort");
}