From 6caf433936a32dbcb0faad18dc16fec31475af74 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Wed, 14 Jan 2015 21:10:23 +0100 Subject: [PATCH] [DEV] update new exml interface --- .travis.yml | 16 ++++++---------- external/ege | 2 +- external/ejson | 2 +- external/esvg | 2 +- external/exml | 2 +- sources/ewol/compositing/TextBase.cpp | 16 ++++++++-------- sources/ewol/compositing/TextBase.h | 2 +- sources/ewol/object/Object.cpp | 6 +++--- sources/ewol/object/Object.h | 4 ++-- sources/ewol/widget/Composer.cpp | 16 ++++++++-------- sources/ewol/widget/Container.cpp | 7 +++---- sources/ewol/widget/Container.h | 2 +- sources/ewol/widget/Container2.cpp | 12 ++++++------ sources/ewol/widget/Container2.h | 2 +- sources/ewol/widget/ContainerN.cpp | 10 +++++----- sources/ewol/widget/ContainerN.h | 2 +- sources/ewol/widget/Image.cpp | 16 ++++++++-------- sources/ewol/widget/Image.h | 2 +- sources/ewol/widget/Label.cpp | 4 ++-- sources/ewol/widget/Label.h | 2 +- sources/ewol/widget/Widget.cpp | 2 +- sources/ewol/widget/Widget.h | 2 +- 22 files changed, 63 insertions(+), 68 deletions(-) diff --git a/.travis.yml b/.travis.yml index c52e8ecc..030cea52 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,10 +18,12 @@ branches: before_script: - git submodule init - git submodule update + - if [ "$CXX" == "clang++" ]; then BUILDER=clang; else BUILDER=gcc; fi install: - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y - sudo apt-get update -qq + - sudo apt-get install -qq libstdc++-4.9-dev - sudo apt-get install -qq g++-4.8 - sudo rm /usr/bin/gcc /usr/bin/g++ - sudo ln -s /usr/bin/gcc-4.8 /usr/bin/gcc @@ -29,16 +31,10 @@ install: # build sequence with Lutin : script: - - 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/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/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/ejson_test; fi + - ./build/lutin.py -C -P -c$BUILDER -mdebug -p ewol etk_test exml_test ejson_test enettest + - ./out/Linux_x86_64/debug/staging/$BUILDER/etk_test/usr/bin/etk_test + - ./out/Linux_x86_64/debug/staging/$BUILDER/ejson_test/usr/bin/ejson_test + - ./out/Linux_x86_64/debug/staging/$BUILDER/exml_test/usr/bin/exml_test #send e-mail on compilation result: notifications: diff --git a/external/ege b/external/ege index 1cc5144a..be7abd40 160000 --- a/external/ege +++ b/external/ege @@ -1 +1 @@ -Subproject commit 1cc5144acc846170090b8ef57185d9bf65f38d66 +Subproject commit be7abd40a14ac37ca2afc8e8e14bc7f6f2ce7ba5 diff --git a/external/ejson b/external/ejson index b3b7d90b..dd2c3b15 160000 --- a/external/ejson +++ b/external/ejson @@ -1 +1 @@ -Subproject commit b3b7d90b418241bf05b32df14c9262d8a3f1ccf4 +Subproject commit dd2c3b15e9def7818acc5ab42c43ba1d3f5569c1 diff --git a/external/esvg b/external/esvg index 738ee25f..d61f0b96 160000 --- a/external/esvg +++ b/external/esvg @@ -1 +1 @@ -Subproject commit 738ee25fb8016e9fd7a3d62ac28a85eb99b4f197 +Subproject commit d61f0b9607fa31a0a817c350889b7259f4d1d516 diff --git a/external/exml b/external/exml index 479921d3..c3b20ceb 160000 --- a/external/exml +++ b/external/exml @@ -1 +1 @@ -Subproject commit 479921d3475fe3fd7a72bbd9e1772f70d284f774 +Subproject commit c3b20ceb8f78516bd29dd3fa02c4c5428e7e7a78 diff --git a/sources/ewol/compositing/TextBase.cpp b/sources/ewol/compositing/TextBase.cpp index ccd27d60..9977d3c8 100644 --- a/sources/ewol/compositing/TextBase.cpp +++ b/sources/ewol/compositing/TextBase.cpp @@ -245,7 +245,7 @@ void ewol::compositing::TextBase::print(const std::string& _text) { } -void ewol::compositing::TextBase::parseHtmlNode(exml::Element* _element) { +void ewol::compositing::TextBase::parseHtmlNode(const std::shared_ptr& _element) { // get the static real pointer if (_element == nullptr) { EWOL_ERROR( "Error Input node does not existed ..."); @@ -254,15 +254,15 @@ void ewol::compositing::TextBase::parseHtmlNode(exml::Element* _element) { if (_element->getType(iii) == exml::typeComment) { // nothing to do ... } else if (_element->getType(iii) == exml::typeText) { - exml::Node* child = _element->getNode(iii); + std::shared_ptr child = _element->getNode(iii); htmlAddData(etk::to_u32string(child->getValue())); EWOL_VERBOSE("XML add : " << child->getValue()); continue; - } else if (_element->getType(iii)!=exml::typeElement) { + } else if (_element->getType(iii) != exml::typeElement) { EWOL_ERROR("(l "<< _element->getNode(iii)->getPos() << ") node not suported type : " << _element->getType(iii) << " val=\""<< _element->getNode(iii)->getValue() << "\"" ); continue; } - exml::Element* elem = _element->getElement(iii); + std::shared_ptr elem = _element->getElement(iii); if (elem == nullptr) { EWOL_ERROR("Cast error ..."); continue; @@ -373,13 +373,13 @@ void ewol::compositing::TextBase::printHTML(const std::string& _text) { return; } - exml::Element* root = (exml::Element*)doc.getNamed( "html" ); + std::shared_ptr root = doc.getNamed( "html" ); if (root == nullptr) { EWOL_ERROR( "can not load XML: main node not find: \"html\""); doc.display(); return; } - exml::Element* bodyNode = (exml::Element*)root->getNamed( "body" ); + std::shared_ptr bodyNode = root->getNamed( "body" ); if (root == nullptr) { EWOL_ERROR( "can not load XML: main node not find: \"body\""); return; @@ -401,13 +401,13 @@ void ewol::compositing::TextBase::printHTML(const std::u32string& _text) { return; } - exml::Element* root = (exml::Element*)doc.getNamed( "html" ); + std::shared_ptr root = doc.getNamed( "html" ); if (root == nullptr) { EWOL_ERROR( "can not load XML: main node not find: \"html\""); doc.display(); return; } - exml::Element* bodyNode = (exml::Element*)root->getNamed( "body" ); + std::shared_ptr bodyNode = root->getNamed( "body" ); if (root == nullptr) { EWOL_ERROR( "can not load XML: main node not find: \"body\""); return; diff --git a/sources/ewol/compositing/TextBase.h b/sources/ewol/compositing/TextBase.h index 698fc5e5..57a89c7a 100644 --- a/sources/ewol/compositing/TextBase.h +++ b/sources/ewol/compositing/TextBase.h @@ -357,7 +357,7 @@ namespace ewol { * @brief This parse a tinyXML node (void pointer to permit to hide tiny XML in include). * @param[in] _element the exml element. */ - void parseHtmlNode(exml::Element* _element); + void parseHtmlNode(const std::shared_ptr& _element); public: /** * @brief This generate the possibility to generate the big text property diff --git a/sources/ewol/object/Object.cpp b/sources/ewol/object/Object.cpp index 99f5e8bc..baa5bc16 100644 --- a/sources/ewol/object/Object.cpp +++ b/sources/ewol/object/Object.cpp @@ -108,8 +108,8 @@ bool ewol::Object::isTypeCompatible(const std::string& _type) { return false; } -bool ewol::Object::loadXML(exml::Element* _node) { - if (nullptr == _node) { +bool ewol::Object::loadXML(const std::shared_ptr& _node) { + if (_node == nullptr) { return false; } bool errorOccured = false; @@ -126,7 +126,7 @@ bool ewol::Object::loadXML(exml::Element* _node) { return errorOccured; } -bool ewol::Object::storeXML(exml::Element* _node) const { +bool ewol::Object::storeXML(const std::shared_ptr& _node) const { if (nullptr == _node) { return false; } diff --git a/sources/ewol/object/Object.h b/sources/ewol/object/Object.h index 2a0cebdf..549edadf 100644 --- a/sources/ewol/object/Object.h +++ b/sources/ewol/object/Object.h @@ -168,14 +168,14 @@ namespace ewol { * @return true : All has been done corectly. * @return false : An error occured. */ - virtual bool loadXML(exml::Element* _node); + virtual bool loadXML(const std::shared_ptr& _node); /** * @brief store properties in this XML node. * @param[in,out] _node Pointer on the tinyXML node. * @return true : All has been done corectly. * @return false : An error occured. */ - virtual bool storeXML(exml::Element* _node) const; + virtual bool storeXML(const std::shared_ptr& _node) const; public: /** * @breif get the current Object manager. diff --git a/sources/ewol/widget/Composer.cpp b/sources/ewol/widget/Composer.cpp index ec41cc39..6747bc52 100644 --- a/sources/ewol/widget/Composer.cpp +++ b/sources/ewol/widget/Composer.cpp @@ -40,15 +40,15 @@ ewol::widget::Composer::~Composer() { } bool ewol::widget::Composer::loadFromFile(const std::string& _fileName) { - exml::Document doc; - if (doc.load(_fileName) == false) { + std::shared_ptr doc = exml::Document::create(); + if (doc->load(_fileName) == false) { EWOL_ERROR(" can not load file XML : " << _fileName); return false; } - exml::Element* root = (exml::Element*)doc.getNamed("composer"); + std::shared_ptr root = doc->getNamed("composer"); if (root == nullptr) { // Maybe a multiple node XML for internal config: - root = doc.toElement(); + root = doc->toElement(); if (root == nullptr) { EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} (l ?) main node not find: \"composer\" ..."); return false; @@ -65,15 +65,15 @@ bool ewol::widget::Composer::loadFromFile(const std::string& _fileName) { } bool ewol::widget::Composer::loadFromString(const std::string& _composerXmlString) { - exml::Document doc; - if (doc.parse(_composerXmlString) == false) { + std::shared_ptr doc = exml::Document::create(); + if (doc->parse(_composerXmlString) == false) { EWOL_ERROR(" can not load file XML string..."); return false; } - exml::Element* root = (exml::Element*)doc.getNamed("composer"); + std::shared_ptr root = doc->getNamed("composer"); if (root == nullptr) { // Maybe a multiple node XML for internal config: - root = doc.toElement(); + root = doc->toElement(); if (root == nullptr) { EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} (l ?) main node not find: \"composer\" ..."); return false; diff --git a/sources/ewol/widget/Container.cpp b/sources/ewol/widget/Container.cpp index 957c766c..68c22dde 100644 --- a/sources/ewol/widget/Container.cpp +++ b/sources/ewol/widget/Container.cpp @@ -143,18 +143,17 @@ std::shared_ptr ewol::widget::Container::getWidgetAtPos(const vec2 }; -bool ewol::widget::Container::loadXML(exml::Element* _node) { - if (nullptr == _node) { +bool ewol::widget::Container::loadXML(const std::shared_ptr& _node) { + if (_node == nullptr) { return false; } // parse generic properties : ewol::Widget::loadXML(_node); // remove previous element : subWidgetRemove(); - // parse all the elements : for(size_t iii=0; iii< _node->size(); iii++) { - exml::Element* pNode = _node->getElement(iii); + std::shared_ptr pNode = _node->getElement(iii); if (pNode == nullptr) { // trash here all that is not element continue; diff --git a/sources/ewol/widget/Container.h b/sources/ewol/widget/Container.h index 90045a79..6b7a1564 100644 --- a/sources/ewol/widget/Container.h +++ b/sources/ewol/widget/Container.h @@ -59,7 +59,7 @@ namespace ewol { virtual void calculateMinMaxSize(); virtual std::shared_ptr getWidgetAtPos(const vec2& _pos); virtual std::shared_ptr getSubObjectNamed(const std::string& _objectName); - virtual bool loadXML(exml::Element* _node); + virtual bool loadXML(const std::shared_ptr& _node); virtual void setOffset(const vec2& _newVal); virtual void requestDestroyFromChild(const std::shared_ptr& _child); }; diff --git a/sources/ewol/widget/Container2.cpp b/sources/ewol/widget/Container2.cpp index 36f27270..e6d8afc5 100644 --- a/sources/ewol/widget/Container2.cpp +++ b/sources/ewol/widget/Container2.cpp @@ -176,8 +176,8 @@ std::shared_ptr ewol::widget::Container2::getWidgetAtPos(const vec } */ -bool ewol::widget::Container2::loadXML(exml::Element* _node) { - if (nullptr == _node) { +bool ewol::widget::Container2::loadXML(const std::shared_ptr& _node) { + if (_node == nullptr) { return false; } // parse generic properties : @@ -187,7 +187,7 @@ bool ewol::widget::Container2::loadXML(exml::Element* _node) { // parse all the elements : for(size_t iii=0; iii< _node->size(); iii++) { - exml::Element* pNode = _node->getElement(iii); + std::shared_ptr pNode = _node->getElement(iii); if (pNode == nullptr) { // trash here all that is not element continue; @@ -198,9 +198,9 @@ bool ewol::widget::Container2::loadXML(exml::Element* _node) { continue; } bool toogleMode=false; - if (nullptr != getSubWidget()) { + if (getSubWidget() != nullptr) { toogleMode=true; - if (nullptr != getSubWidgetToggle()) { + if (getSubWidgetToggle() != nullptr) { EWOL_ERROR("(l "<getPos()<<") " << __class__ << " Can only have one subWidget ??? node=\"" << widgetName << "\"" ); continue; } @@ -217,7 +217,7 @@ bool ewol::widget::Container2::loadXML(exml::Element* _node) { } else { setSubWidgetToggle(tmpWidget); } - if (false == tmpWidget->loadXML(pNode)) { + if (tmpWidget->loadXML(pNode) == false) { EWOL_ERROR ("(l "<getPos()<<") can not load widget properties : \"" << widgetName << "\""); return false; } diff --git a/sources/ewol/widget/Container2.h b/sources/ewol/widget/Container2.h index 4930d5d4..ff02ceab 100644 --- a/sources/ewol/widget/Container2.h +++ b/sources/ewol/widget/Container2.h @@ -162,7 +162,7 @@ namespace ewol { } //virtual std::shared_ptr getWidgetAtPos(const vec2& _pos); virtual std::shared_ptr getSubObjectNamed(const std::string& _objectName); - virtual bool loadXML(exml::Element* _node); + virtual bool loadXML(const std::shared_ptr& _node); virtual void setOffset(const vec2& _newVal); virtual void requestDestroyFromChild(const std::shared_ptr& _child); }; diff --git a/sources/ewol/widget/ContainerN.cpp b/sources/ewol/widget/ContainerN.cpp index ef1452d3..40854c89 100644 --- a/sources/ewol/widget/ContainerN.cpp +++ b/sources/ewol/widget/ContainerN.cpp @@ -238,8 +238,8 @@ std::shared_ptr ewol::widget::ContainerN::getWidgetAtPos(const vec }; -bool ewol::widget::ContainerN::loadXML(exml::Element* _node) { - if (nullptr == _node) { +bool ewol::widget::ContainerN::loadXML(const std::shared_ptr& _node) { + if (_node == nullptr) { return false; } // parse generic properties : @@ -258,7 +258,7 @@ bool ewol::widget::ContainerN::loadXML(exml::Element* _node) { } // parse all the elements : for (size_t iii=0; iii < _node->size(); iii++) { - exml::Element* pNode = _node->getElement(iii); + std::shared_ptr pNode = _node->getElement(iii); if (pNode == nullptr) { // trash here all that is not element continue; @@ -275,12 +275,12 @@ bool ewol::widget::ContainerN::loadXML(exml::Element* _node) { continue; } // add sub element : - if (false == invertAdding) { + if (invertAdding == false) { subWidgetAdd(subWidget); } else { subWidgetAddStart(subWidget); } - if (false == subWidget->loadXML(pNode)) { + if (subWidget->loadXML(pNode) == false) { EWOL_ERROR ("[" << getId() << "] {" << getObjectType() << "} (l "<getPos()<<") can not load widget properties : \"" << widgetName << "\""); return false; } diff --git a/sources/ewol/widget/ContainerN.h b/sources/ewol/widget/ContainerN.h index 2a7e6845..916d1b65 100644 --- a/sources/ewol/widget/ContainerN.h +++ b/sources/ewol/widget/ContainerN.h @@ -95,7 +95,7 @@ namespace ewol { virtual void calculateMinMaxSize(); virtual std::shared_ptr getWidgetAtPos(const vec2& _pos); virtual std::shared_ptr getSubObjectNamed(const std::string& _objectName); - virtual bool loadXML(exml::Element* _node); + virtual bool loadXML(const std::shared_ptr& _node); virtual void setOffset(const vec2& _newVal); virtual void requestDestroyFromChild(const std::shared_ptr& _child); }; diff --git a/sources/ewol/widget/Image.cpp b/sources/ewol/widget/Image.cpp index 5e2e0bfc..9fa8a37d 100644 --- a/sources/ewol/widget/Image.cpp +++ b/sources/ewol/widget/Image.cpp @@ -131,7 +131,7 @@ void ewol::widget::Image::calculateMinMaxSize() { bool ewol::widget::Image::onEventInput(const ewol::event::Input& _event) { //EWOL_DEBUG("Event on BT ..."); - if (1 == _event.getId()) { + if (_event.getId() == 1) { if(ewol::key::statusSingle == _event.getStatus()) { signalPressed.emit(); return true; @@ -140,15 +140,15 @@ bool ewol::widget::Image::onEventInput(const ewol::event::Input& _event) { return false; } -bool ewol::widget::Image::loadXML(exml::Element* _node) { - if (nullptr == _node) { +bool ewol::widget::Image::loadXML(const std::shared_ptr& _node) { + if (_node == nullptr) { return false; } ewol::Widget::loadXML(_node); // get internal data : std::string tmpAttributeValue = _node->getAttribute("ratio"); - if (tmpAttributeValue.size()!=0) { + if (tmpAttributeValue.size() != 0) { if (etk::compare_no_case(tmpAttributeValue, "true") == true) { m_keepRatio = true; } else if (tmpAttributeValue == "1") { @@ -158,21 +158,21 @@ bool ewol::widget::Image::loadXML(exml::Element* _node) { } } tmpAttributeValue = _node->getAttribute("size"); - if (tmpAttributeValue.size()!=0) { + if (tmpAttributeValue.size() != 0) { //EWOL_CRITICAL(" Parse SIZE : " << tmpAttributeValue); m_imageSize = tmpAttributeValue; //EWOL_CRITICAL(" == > " << m_imageSize); } tmpAttributeValue = _node->getAttribute("border"); - if (tmpAttributeValue.size()!=0) { + if (tmpAttributeValue.size() != 0) { m_border = tmpAttributeValue; } //EWOL_DEBUG("Load label:" << node->ToElement()->getText()); - if (_node->size()!=0) { + if (_node->size() != 0) { setFile(_node->getText()); } else { tmpAttributeValue = _node->getAttribute("src"); - if (tmpAttributeValue.size()!=0) { + if (tmpAttributeValue.size() != 0) { setFile(tmpAttributeValue); } } diff --git a/sources/ewol/widget/Image.h b/sources/ewol/widget/Image.h index 1fef548a..bede5c6d 100644 --- a/sources/ewol/widget/Image.h +++ b/sources/ewol/widget/Image.h @@ -166,7 +166,7 @@ namespace ewol { virtual void calculateMinMaxSize(); virtual void onRegenerateDisplay(); virtual bool onEventInput(const ewol::event::Input& _event); - virtual bool loadXML(exml::Element* _node); + virtual bool loadXML(const std::shared_ptr& _node); }; }; }; diff --git a/sources/ewol/widget/Label.cpp b/sources/ewol/widget/Label.cpp index 4c654a4f..c118c78c 100644 --- a/sources/ewol/widget/Label.cpp +++ b/sources/ewol/widget/Label.cpp @@ -131,8 +131,8 @@ bool ewol::widget::Label::onEventInput(const ewol::event::Input& _event) { return false; } -bool ewol::widget::Label::loadXML(exml::Element* _node) { - if (nullptr == _node) { +bool ewol::widget::Label::loadXML(const std::shared_ptr& _node) { + if (_node == nullptr) { return false; } ewol::Widget::loadXML(_node); diff --git a/sources/ewol/widget/Label.h b/sources/ewol/widget/Label.h index 432537d1..90013347 100644 --- a/sources/ewol/widget/Label.h +++ b/sources/ewol/widget/Label.h @@ -74,7 +74,7 @@ namespace ewol { virtual void calculateMinMaxSize(); virtual void onRegenerateDisplay(); virtual bool onEventInput(const ewol::event::Input& _event); - virtual bool loadXML(exml::Element* _node); + virtual bool loadXML(const std::shared_ptr& _node); }; }; }; diff --git a/sources/ewol/widget/Widget.cpp b/sources/ewol/widget/Widget.cpp index 2fe3cff2..af2ef2ec 100644 --- a/sources/ewol/widget/Widget.cpp +++ b/sources/ewol/widget/Widget.cpp @@ -591,7 +591,7 @@ enum ewol::context::cursorDisplay ewol::Widget::getCursor() { return m_cursorDisplay; } -bool ewol::Widget::loadXML(exml::Element* _node) { +bool ewol::Widget::loadXML(const std::shared_ptr& _node) { ewol::Object::loadXML(_node); markToRedraw(); return true; diff --git a/sources/ewol/widget/Widget.h b/sources/ewol/widget/Widget.h index 44e900d9..4fdb79aa 100644 --- a/sources/ewol/widget/Widget.h +++ b/sources/ewol/widget/Widget.h @@ -663,7 +663,7 @@ namespace ewol { */ virtual enum ewol::context::cursorDisplay getCursor(); public: // Derived function - virtual bool loadXML(exml::Element* _node); + virtual bool loadXML(const std::shared_ptr& _node); protected: // Derived function virtual void onParameterChangeValue(const ewol::parameter::Ref& _paramPointer); public: