Compare commits
4 Commits
f7a78efba4
...
9598490012
Author | SHA1 | Date | |
---|---|---|---|
9598490012 | |||
871da9506a | |||
7fe6b15b23 | |||
f327765a04 |
@ -21,7 +21,7 @@ File to read: "read.json"
|
|||||||
Reading a file is done like this:
|
Reading a file is done like this:
|
||||||
@snippet read.cpp ejson_sample_read_file
|
@snippet read.cpp ejson_sample_read_file
|
||||||
|
|
||||||
The file naming is manage by @ref etk::FSNode that provide "DATA:" start string for internal application asset. You can use external path like "./plop/file.json" too.
|
The file naming is manage by @ref etk::FSNode that provide "DATA:///" start string for internal application asset. You can use external path like "./plop/file.json" too.
|
||||||
|
|
||||||
|
|
||||||
Read an JSON Stream {#ejson_tutorial_read_stream}
|
Read an JSON Stream {#ejson_tutorial_read_stream}
|
||||||
|
@ -85,7 +85,7 @@ bool ejson::internal::Document::store(const etk::Uri& _uri) {
|
|||||||
EJSON_ERROR("Can not open (r) the file : " << _uri);
|
EJSON_ERROR("Can not open (r) the file : " << _uri);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fileIo->fileWriteAll(createData);
|
fileIo->writeAll(createData);
|
||||||
fileIo->close();
|
fileIo->close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import lutin.debug as debug
|
import realog.debug as debug
|
||||||
import lutin.tools as tools
|
import lutin.tools as tools
|
||||||
|
|
||||||
def get_type():
|
def get_type():
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import lutin.debug as debug
|
import realog.debug as debug
|
||||||
import lutin.tools as tools
|
import lutin.tools as tools
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import lutin.debug as debug
|
import realog.debug as debug
|
||||||
import lutin.tools as tools
|
import lutin.tools as tools
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ static void readFromFile() {
|
|||||||
ejson::Document doc;
|
ejson::Document doc;
|
||||||
//! [ejson_sample_declare_doc]
|
//! [ejson_sample_declare_doc]
|
||||||
//! [ejson_sample_read_file]
|
//! [ejson_sample_read_file]
|
||||||
bool retParse = doc.load("DATA:read.json");
|
bool retParse = doc.load(etk::Uri("DATA:///read.json"));
|
||||||
//! [ejson_sample_read_file]
|
//! [ejson_sample_read_file]
|
||||||
TEST_INFO("parse ret = " << retParse);
|
TEST_INFO("parse ret = " << retParse);
|
||||||
TEST_INFO("Debug display of the tree:");
|
TEST_INFO("Debug display of the tree:");
|
||||||
@ -76,7 +76,7 @@ static void readFromString2() {
|
|||||||
static void readFull() {
|
static void readFull() {
|
||||||
ejson::Document doc;
|
ejson::Document doc;
|
||||||
TEST_INFO("parse");
|
TEST_INFO("parse");
|
||||||
bool retParse = doc.load("DATA:read.json");
|
bool retParse = doc.load(etk::Uri("DATA:///read.json"));
|
||||||
TEST_INFO("parse ret = " << retParse);
|
TEST_INFO("parse ret = " << retParse);
|
||||||
TEST_INFO("Debug display of the tree:");
|
TEST_INFO("Debug display of the tree:");
|
||||||
doc.display();
|
doc.display();
|
||||||
|
@ -16,10 +16,10 @@ static void writeToFile() {
|
|||||||
doc.add("D", ejson::Array());
|
doc.add("D", ejson::Array());
|
||||||
TEST_INFO("store");
|
TEST_INFO("store");
|
||||||
//! [ejson_sample_write_file]
|
//! [ejson_sample_write_file]
|
||||||
bool retGenerate = doc.store("generate.json");
|
bool retGenerate = doc.store(etk::Path("generate.json"));
|
||||||
//! [ejson_sample_write_file]
|
//! [ejson_sample_write_file]
|
||||||
//! [ejson_sample_write_file_safe_mode]
|
//! [ejson_sample_write_file_safe_mode]
|
||||||
retGenerate = doc.storeSafe("generate.json");
|
retGenerate = doc.storeSafe(etk::Path("generate.json"));
|
||||||
//! [ejson_sample_write_file_safe_mode]
|
//! [ejson_sample_write_file_safe_mode]
|
||||||
TEST_INFO("parse ret = " << retGenerate);
|
TEST_INFO("parse ret = " << retGenerate);
|
||||||
TEST_INFO("Debug display of the tree:");
|
TEST_INFO("Debug display of the tree:");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user