[DEV] update the ejson interface

This commit is contained in:
Edouard DUPIN 2015-01-12 22:14:36 +01:00
parent 673ccb3726
commit 832d73d4da
8 changed files with 23 additions and 28 deletions

View File

@ -1,5 +1,7 @@
# language type:
language: cpp
language:
- cpp
- Objective-c
# compilator system:
compiler:
@ -27,16 +29,16 @@ install:
# build sequence with Lutin :
script:
- if [ "$CXX" == "clang++" ]; then ./build/lutin.py -C -P -cclang -mdebug -p ewol etktest exmltest ejsontest enettest; fi
- if [ "$CXX" == "g++" ]; then ./build/lutin.py -C -P -cgcc -mdebug -p ewol etktest exmltest ejsontest enettest; fi
- if [ "$CXX" == "clang++" ]; then ./build/lutin.py -C -P -cclang -mdebug -p ewol etk_test exmltest ejson_test enettest; fi
- if [ "$CXX" == "g++" ]; then ./build/lutin.py -C -P -cgcc -mdebug -p ewol etk_test exmltest ejson_test enettest; fi
after_script:
- if [ "$CXX" == "clang++" ]; then ./out/Linux_x86_64/debug/staging/clang/etktest/usr/bin/etktest; fi
- if [ "$CXX" == "clang++" ]; then ./out/Linux_x86_64/debug/staging/clang/etktest/usr/bin/etk_test; fi
- if [ "$CXX" == "clang++" ]; then ./out/Linux_x86_64/debug/staging/clang/exmltest/usr/bin/exmltest; fi
- if [ "$CXX" == "clang++" ]; then ./out/Linux_x86_64/debug/staging/clang/ejsontest/usr/bin/ejsontest; fi
- if [ "$CXX" == "g++" ]; then ./out/Linux_x86_64/debug/staging/gcc/etktest/usr/bin/etktest; fi
- if [ "$CXX" == "clang++" ]; then ./out/Linux_x86_64/debug/staging/clang/ejsontest/usr/bin/ejson_test; fi
- if [ "$CXX" == "g++" ]; then ./out/Linux_x86_64/debug/staging/gcc/etktest/usr/bin/etk_test; fi
- if [ "$CXX" == "g++" ]; then ./out/Linux_x86_64/debug/staging/gcc/exmltest/usr/bin/exmltest; fi
- if [ "$CXX" == "g++" ]; then ./out/Linux_x86_64/debug/staging/gcc/ejsontest/usr/bin/ejsontest; fi
- if [ "$CXX" == "g++" ]; then ./out/Linux_x86_64/debug/staging/gcc/ejsontest/usr/bin/ejson_test; fi
#send e-mail on compilation result:
notifications:

2
external/eaudiofx vendored

@ -1 +1 @@
Subproject commit 79042c57e5f3306f1dcd576d47f7890e39769faf
Subproject commit 5b858de808d471ac09d8fae20f6abc7d3acbe671

2
external/ejson vendored

@ -1 +1 @@
Subproject commit bcab8b07067cc15a81e14234d302dc945b5b2471
Subproject commit b3b7d90b418241bf05b32df14c9262d8a3f1ccf4

2
external/etk vendored

@ -1 +1 @@
Subproject commit cc807465f88a272d6e61a3c41c5f4e7277c5ee2f
Subproject commit b00b7aa7b37eb7baf4eda50ad447b3ee1d6fe94f

View File

@ -47,13 +47,13 @@ void ewol::resource::ColorFile::reload() {
EWOL_ERROR("Can not load file : '" << m_name << "' = " << etk::FSNode(m_name).getFileSystemName());
return;
}
ejson::Array* baseArray = doc.getArray("color");
std::shared_ptr<ejson::Array> baseArray = doc.getArray("color");
if (baseArray == nullptr) {
EWOL_ERROR("Can not get basic array : 'color'");
return;
}
for (size_t iii = 0; iii < baseArray->size(); ++iii) {
ejson::Object* tmpObj = baseArray->getObject(iii);
std::shared_ptr<ejson::Object> tmpObj = baseArray->getObject(iii);
if (tmpObj == nullptr) {
EWOL_DEBUG(" can not get object in 'color' id=" << iii);
continue;

View File

@ -16,7 +16,7 @@
#include <stdexcept>
#undef __class__
#define __class__ "resource::ConfigFile"
#define __class__ "resource::ConfigFile"
ewol::resource::ConfigFile::ConfigFile() :
@ -32,13 +32,6 @@ void ewol::resource::ConfigFile::init(const std::string& _filename) {
ewol::resource::ConfigFile::~ConfigFile() {
// remove all element
for (int32_t iii=0; iii<m_list.size(); iii++){
if (nullptr != m_list[iii]) {
delete(m_list[iii]);
m_list[iii] = nullptr;
}
}
m_list.clear();
}
@ -76,7 +69,7 @@ double ewol::resource::ConfigFile::getNumber(int32_t _id) {
|| m_list[_id] == nullptr) {
return 0.0;
}
ejson::Number* tmp = m_list[_id]->toNumber();
std::shared_ptr<ejson::Number> tmp = m_list[_id]->toNumber();
if (tmp == nullptr) {
return 0.0;
}
@ -89,7 +82,7 @@ const std::string& ewol::resource::ConfigFile::getString(int32_t _id) {
|| m_list[_id] == nullptr) {
return errorString;
}
ejson::String* tmp = m_list[_id]->toString();
std::shared_ptr<ejson::String> tmp = m_list[_id]->toString();
if (tmp == nullptr) {
return errorString;
}
@ -101,7 +94,7 @@ bool ewol::resource::ConfigFile::getBoolean(int32_t _id) {
|| m_list[_id] == nullptr) {
return false;
}
ejson::Boolean* tmp = m_list[_id]->toBoolean();
std::shared_ptr<ejson::Boolean> tmp = m_list[_id]->toBoolean();
if (tmp == nullptr) {
return false;
}

View File

@ -20,7 +20,7 @@ namespace ewol {
class ConfigFile : public ewol::Resource {
private:
ejson::Document m_doc;
etk::Hash<ejson::Value*> m_list;
etk::Hash<std::shared_ptr<ejson::Value>> m_list;
protected:
ConfigFile();
void init(const std::string& _filename);

View File

@ -342,13 +342,13 @@ ewol::GlyphProperty* ewol::resource::DistanceFieldFont::getGlyphPointer(const ch
void ewol::resource::DistanceFieldFont::exportOnFile() {
EWOL_DEBUG("EXPORT: DistanceFieldFont : file : '" << m_fileName << ".json'");
ejson::Document doc;
ejson::Array* tmpList = new ejson::Array();
std::shared_ptr<ejson::Array> tmpList = ejson::Array::create();
if (tmpList == nullptr) {
EWOL_ERROR("nullptr pointer");
return;
}
for (size_t iii=0; iii<m_listElement.size(); ++iii) {
ejson::Object* tmpObj = new ejson::Object();
std::shared_ptr<ejson::Object> tmpObj = ejson::Object::create();
if (tmpObj == nullptr) {
continue;
}
@ -391,14 +391,14 @@ bool ewol::resource::DistanceFieldFont::importFromFile() {
m_lastRawHeigh = doc.getNumberValue("m_lastRawHeigh", 0);
m_borderSize = doc.getNumberValue("m_borderSize", 2);
m_textureBorderSize = doc.addString("m_textureBorderSize", "0,0");
ejson::Array* tmpList = doc.getArray("m_listElement");
std::shared_ptr<ejson::Array> tmpList = doc.getArray("m_listElement");
if (tmpList == nullptr) {
EWOL_ERROR("nullptr pointer array");
return false;
}
m_listElement.clear();
for (size_t iii=0; iii<tmpList->size(); ++iii) {
ejson::Object* tmpObj = tmpList->getObject(iii);
std::shared_ptr<ejson::Object> tmpObj = tmpList->getObject(iii);
if (tmpObj == nullptr) {
continue;
}