Serious work on JString and some minor MString ajustments.
This commit is contained in:
1 parent
7531c885a7
commit
c6e0486c14
8 files changed
+51
-13
No files matched your search
@@ -3,22 +3,30 @@
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
coreutils::MString test0("{\"Number:\"0\",\"id\":\"XXXXX\"}");
|
||||
coreutils::MString test0("{\"Number\":\"0\",\"id\":\"XXXXX\"}");
|
||||
coreutils::JString test1;
|
||||
|
||||
test1 = test0;
|
||||
std::cout << test1 << std::endl;
|
||||
|
||||
std::cout << test1["id"] << std::endl;
|
||||
|
||||
test1["name"] = "Cohen";
|
||||
|
||||
std::cout << test1 << std::endl;
|
||||
|
||||
test1["health"] = "100";
|
||||
test1["comment"] = "this is a comment";
|
||||
test1["race"] = "human";
|
||||
test1["array"] = "[\"test1\",\"test2\",\"test3\"]";
|
||||
test1["tester"] = "test field";
|
||||
test1["object1"] = "{\"attr1\":\"value1\",\"attr2\":\"value2\",\"attr3\":\"value3\"}";
|
||||
test1["object1.attr2"] = "{\"xattr1\":\"xvalue1\",\"xattr2\":\"xvalue2\",\"xattr3\":\"xvalue3\"}";
|
||||
test1["object1.attr3"] = "Im not an object";
|
||||
|
||||
std::cout << test1 << std::endl;
|
||||
|
||||
coreutils::MString test2 = test1["name"];
|
||||
coreutils::ZString test2 = test1["name"];
|
||||
std::cout << test2 << std::endl;
|
||||
|
||||
std::cout << test1["name"] << std::endl;
|
||||
@@ -29,6 +37,11 @@ int main(int argc, char **argv) {
|
||||
std::cout << test1["tester"] << std::endl;
|
||||
std::cout << test1["object1"] << std::endl;
|
||||
std::cout << test1["object1.attr2"] << std::endl;
|
||||
std::cout << test1["object1.attr2.xattr3"] << std::endl;
|
||||
std::cout << test1["object1.attr3"] << std::endl;
|
||||
std::cout << test1["array[0]"] << std::endl;
|
||||
std::cout << test1["array[1]"] << std::endl;
|
||||
std::cout << test1["array[2]"] << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user