JFile seems to work well now.
This commit is contained in:
parent
ffa3361fd2
commit
ab748802ee
@ -19,8 +19,8 @@ namespace coreutils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MString CGIFormData::operator[](ZString name) {
|
MString CGIFormData::operator[](ZString name) {
|
||||||
if(contentType == "application/x-www-form-urlencoded")
|
// if(contentType == "application/x-www-form-urlencoded")
|
||||||
return formdata[name];
|
// return formdata[name];
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,6 @@ namespace coreutils {
|
|||||||
MFile::MFile(coreutils::MString fileName) : fileName(fileName) {
|
MFile::MFile(coreutils::MString fileName) : fileName(fileName) {
|
||||||
inFile.open(fileName.c_str());
|
inFile.open(fileName.c_str());
|
||||||
*this << inFile;
|
*this << inFile;
|
||||||
// inFile >> *this;
|
|
||||||
inFile.close();
|
inFile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
BIN
testing/jfile_test
Executable file
BIN
testing/jfile_test
Executable file
Binary file not shown.
@ -6,14 +6,8 @@
|
|||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
coreutils::MString test0("{ \"Number\": \"0\", \"id\": \"XXXXX\" }");
|
|
||||||
coreutils::JFile test1("jfile_test.data");
|
coreutils::JFile test1("jfile_test.data");
|
||||||
coreutils::JString test9;
|
|
||||||
|
|
||||||
test1 = test0;
|
|
||||||
std::cout << test1 << std::endl;
|
std::cout << test1 << std::endl;
|
||||||
|
|
||||||
std::cout << test1["id"] << std::endl;
|
|
||||||
|
|
||||||
test1["name"] = "Cohen";
|
test1["name"] = "Cohen";
|
||||||
|
|
||||||
@ -31,9 +25,6 @@ int main(int argc, char **argv) {
|
|||||||
// test1["age"] = 64; future
|
// test1["age"] = 64; future
|
||||||
|
|
||||||
std::cout << test1 << std::endl;
|
std::cout << test1 << std::endl;
|
||||||
|
|
||||||
coreutils::ZString test2 = test1["name"];
|
|
||||||
std::cout << test2 << std::endl;
|
|
||||||
|
|
||||||
std::cout << test1["name"] << std::endl;
|
std::cout << test1["name"] << std::endl;
|
||||||
std::cout << test1["health"] << 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[1]"] << std::endl;
|
||||||
std::cout << test1["array[2]"] << 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;
|
std::cout << test1.pretty() << std::endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@ -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"}}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user