JFile seems to work well now.

This commit is contained in:
Brad Arant 2025-12-09 08:46:33 -08:00
parent ffa3361fd2
commit ab748802ee
5 changed files with 3 additions and 24 deletions

View File

@ -19,8 +19,8 @@ namespace coreutils {
}
MString CGIFormData::operator[](ZString name) {
if(contentType == "application/x-www-form-urlencoded")
return formdata[name];
// if(contentType == "application/x-www-form-urlencoded")
// return formdata[name];
return name;
}

View File

@ -7,7 +7,6 @@ namespace coreutils {
MFile::MFile(coreutils::MString fileName) : fileName(fileName) {
inFile.open(fileName.c_str());
*this << inFile;
// inFile >> *this;
inFile.close();
}

BIN
testing/jfile_test Executable file

Binary file not shown.

View File

@ -6,14 +6,8 @@
int main(int argc, char **argv) {
coreutils::MString test0("{ \"Number\": \"0\", \"id\": \"XXXXX\" }");
coreutils::JFile test1("jfile_test.data");
coreutils::JString test9;
test1 = test0;
std::cout << test1 << std::endl;
std::cout << test1["id"] << std::endl;
test1["name"] = "Cohen";
@ -31,9 +25,6 @@ int main(int argc, char **argv) {
// test1["age"] = 64; future
std::cout << test1 << std::endl;
coreutils::ZString test2 = test1["name"];
std::cout << test2 << std::endl;
std::cout << test1["name"] << std::endl;
std::cout << test1["health"] << std::endl;
@ -50,17 +41,6 @@ int main(int argc, char **argv) {
std::cout << test1["array[1]"] << std::endl;
std::cout << test1["array[2]"] << std::endl;
std::string string1 = test1["tester"];
std::cout << "from string: " << string1 << std::endl;
coreutils::MString testout;
testout << "this is a test: " << test1["comment"];
std::cout << testout << std::endl;
test9 = test1["object1"];
std::cout << test9 << std::endl;
std::cout << test9["attr3"] << std::endl;
std::cout << test1.pretty() << std::endl;
return 0;

View File

@ -1 +1 @@
{}
{"name":"Cohen","health":"100","comment":"this is a comment","racex":"elvin","race":"human","array":["test1","test2","test3"],"tester":"test field","object1":{"attr1":"value1","attr2":{"xattr1":"xvalue1","xattr2":"xvalue2","xattr3":"xvalue3"},"attr3":"Im not an object"}}