Serious work on JString and some minor MString ajustments.

This commit is contained in:
barant committed 2024-12-11 16:58:34 -08:00
1 parent 7531c885a7
commit c6e0486c14
8 files changed
+51 -13

No files matched your search

+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash
#g++ -g -std=c++20 -o zstring_test zstring_test.cpp -I.. -L.. -lCoreUtils
#g++ -g -std=c++20 -o mstring_test mstring_test.cpp -I.. -L.. -lCoreUtils
g++ -g -std=c++20 -o mstring_test mstring_test.cpp -I.. -L.. -lCoreUtils
g++ -o jstring_test jstring_test.cpp -I.. -L.. -lCoreUtils
Binary file not shown.
+15 -2
View File
@@ -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;
}
+3
View File
@@ -8,8 +8,11 @@ int main(int argc, char **argv) {
std::cout << "char * operator=: [" << test1 << "]." << std::endl;
test1 = "new value.";
std::cout << "char * operator=: [" << test1 << "]." << std::endl;
std::cout << "001" << std::endl;
std::string test11 = "this is a test";
std::cout << "002" << std::endl;
coreutils::MString test12 = test11;
std::cout << "003" << std::endl;
std::cout << "assign from std::string: [" << test12 << "]." << std::endl;
coreutils::MString test2("this is another test.");