From 240147561dff796070c13f7b4d6b4ee30005ac73 Mon Sep 17 00:00:00 2001 From: Edouard Dupin Date: Fri, 21 Jun 2013 22:25:24 +0200 Subject: [PATCH] [DEV] rename files ==> simplify visibility and api --- exml/{EXmlAttribute.cpp => Attribute.cpp} | 24 ++-- exml/{EXmlAttribute.h => Attribute.h} | 14 +-- exml/{EXmlComment.cpp => Comment.cpp} | 10 +- exml/{EXmlComment.h => Comment.h} | 12 +- exml/{EXmlDeclaration.cpp => Declaration.cpp} | 12 +- exml/{EXmlDeclaration.h => Declaration.h} | 12 +- exml/Document.cpp | 112 ++++++++++++++++++ exml/{EXmlDocument.h => Document.h} | 12 +- exml/EXmlDocument.cpp | 72 ----------- exml/EXmlElement.h | 54 --------- exml/{EXmlElement.cpp => Element.cpp} | 63 +++++----- exml/Element.h | 54 +++++++++ exml/{EXmlNode.cpp => Node.cpp} | 13 +- exml/{EXmlNode.h => Node.h} | 45 +++---- exml/{EXmlText.cpp => Text.cpp} | 18 +-- exml/{EXmlText.h => Text.h} | 18 +-- exml/exml.h | 2 +- exml/{EXmlTest.cpp => test.cpp} | 4 +- exml/{EXmlTest.h => test.h} | 4 +- lutin_exml.py | 14 +-- lutin_exmltest.py | 2 +- 21 files changed, 317 insertions(+), 254 deletions(-) rename exml/{EXmlAttribute.cpp => Attribute.cpp} (79%) rename exml/{EXmlAttribute.h => Attribute.h} (67%) rename exml/{EXmlComment.cpp => Comment.cpp} (74%) rename exml/{EXmlComment.h => Comment.h} (66%) rename exml/{EXmlDeclaration.cpp => Declaration.cpp} (76%) rename exml/{EXmlDeclaration.h => Declaration.h} (65%) create mode 100644 exml/Document.cpp rename exml/{EXmlDocument.h => Document.h} (88%) delete mode 100644 exml/EXmlDocument.cpp delete mode 100644 exml/EXmlElement.h rename exml/{EXmlElement.cpp => Element.cpp} (85%) create mode 100644 exml/Element.h rename exml/{EXmlNode.cpp => Node.cpp} (79%) rename exml/{EXmlNode.h => Node.h} (66%) rename exml/{EXmlText.cpp => Text.cpp} (76%) rename exml/{EXmlText.h => Text.h} (67%) rename exml/{EXmlTest.cpp => test.cpp} (93%) rename exml/{EXmlTest.h => test.h} (80%) diff --git a/exml/EXmlAttribute.cpp b/exml/Attribute.cpp similarity index 79% rename from exml/EXmlAttribute.cpp rename to exml/Attribute.cpp index 6da20bc..f09f97b 100644 --- a/exml/EXmlAttribute.cpp +++ b/exml/Attribute.cpp @@ -6,25 +6,27 @@ * @license BSD v3 (see license file) */ -#include +#include #include -exml::EXmlAttribute::EXmlAttribute(const etk::UString& _name, const etk::UString& _value) : - exml::EXmlNode(_value), +exml::Attribute::Attribute(const etk::UString& _name, const etk::UString& _value) : + exml::Node(_value), m_name(_name) { } -bool exml::EXmlAttribute::Parse(const etk::UString& _data, int32_t& _pos, bool _caseSensitive, ivec2& _filePos) +bool exml::Attribute::Parse(const etk::UString& _data, int32_t& _pos, bool _caseSensitive, ivec2& _filePos) { EXML_DEBUG("start parse : 'attribute'"); // search end of the comment : int32_t lastElementName = _pos; for (int32_t iii=_pos; iii<_data.Size(); iii++) { _filePos += ivec2(1,0); - DrawElementParsed(_data[iii], _filePos); + #ifdef ENABLE_DISPLAY_PARSED_ELEMENT + DrawElementParsed(_data[iii], _filePos); + #endif if (_data[iii] == '\n') { _filePos.setValue(1, _filePos.y()+1); EXML_ERROR("unexpected '\\n' in an attribute parsing"); @@ -56,7 +58,9 @@ bool exml::EXmlAttribute::Parse(const etk::UString& _data, int32_t& _pos, bool _ int32_t lastAttributePos = lastElementName+3; for (int32_t iii=lastElementName+2; iii<_data.Size(); iii++) { _filePos += ivec2(1,0); - DrawElementParsed(_data[iii], _filePos); + #ifdef ENABLE_DISPLAY_PARSED_ELEMENT + DrawElementParsed(_data[iii], _filePos); + #endif if (_data[iii] == '\n') { _filePos.setValue(1, _filePos.y()+1); EXML_ERROR("unexpected '\\n' in an attribute parsing"); @@ -77,7 +81,9 @@ bool exml::EXmlAttribute::Parse(const etk::UString& _data, int32_t& _pos, bool _ int32_t lastAttributePos = lastElementName+3; for (int32_t iii=lastElementName+3; iii<_data.Size(); iii++) { _filePos += ivec2(1,0); - DrawElementParsed(_data[iii], _filePos); + #ifdef ENABLE_DISPLAY_PARSED_ELEMENT + DrawElementParsed(_data[iii], _filePos); + #endif if (_data[iii] == '\n') { _filePos.setValue(1, _filePos.y()+1); EXML_ERROR("unexpected '\\n' in an attribute parsing"); @@ -91,11 +97,11 @@ bool exml::EXmlAttribute::Parse(const etk::UString& _data, int32_t& _pos, bool _ } m_value = _data.Extract(lastElementName+3, lastAttributePos+1); - _pos = lastAttributePos+1; + _pos = lastAttributePos; return true; } -bool exml::EXmlAttribute::Generate(etk::UString& _data, int32_t _indent) const +bool exml::Attribute::Generate(etk::UString& _data, int32_t _indent) const { _data += " "; _data += m_name; diff --git a/exml/EXmlAttribute.h b/exml/Attribute.h similarity index 67% rename from exml/EXmlAttribute.h rename to exml/Attribute.h index 1c97f35..7bb2183 100644 --- a/exml/EXmlAttribute.h +++ b/exml/Attribute.h @@ -9,17 +9,17 @@ #ifndef __ETK_XML_ATTRIBUTE_H__ #define __ETK_XML_ATTRIBUTE_H__ -#include +#include #include namespace exml { - class EXmlAttribute : public EXmlNode + class Attribute : public Node { public: - EXmlAttribute(void) { }; - EXmlAttribute(const etk::UString& _name, const etk::UString& _value); - virtual ~EXmlAttribute(void) { }; + Attribute(void) { }; + Attribute(const etk::UString& _name, const etk::UString& _value); + virtual ~Attribute(void) { }; virtual nodeType_te GetType(void) const { return exml::typeAttribute; }; virtual bool Parse(const etk::UString& _data, int32_t& _pos, bool _caseSensitive, ivec2& _filePos); virtual bool Generate(etk::UString& _data, int32_t _indent) const; @@ -28,8 +28,8 @@ namespace exml public: virtual void SetName(etk::UString _name) { m_name = _name; }; virtual const etk::UString& GetName(void) const { return m_name; }; - virtual operator exml::EXmlAttribute* () { return this; }; - virtual operator const exml::EXmlAttribute* () const { return this; }; + virtual operator exml::Attribute* () { return this; }; + virtual operator const exml::Attribute* () const { return this; }; }; }; diff --git a/exml/EXmlComment.cpp b/exml/Comment.cpp similarity index 74% rename from exml/EXmlComment.cpp rename to exml/Comment.cpp index 6fb6445..a912f55 100644 --- a/exml/EXmlComment.cpp +++ b/exml/Comment.cpp @@ -6,16 +6,18 @@ * @license BSD v3 (see license file) */ -#include +#include #include -bool exml::EXmlComment::Parse(const etk::UString& _data, int32_t& _pos, bool _caseSensitive, ivec2& _filePos) +bool exml::Comment::Parse(const etk::UString& _data, int32_t& _pos, bool _caseSensitive, ivec2& _filePos) { EXML_DEBUG("start parse : 'comment'"); // search end of the comment : for (int32_t iii=_pos; iii+2<_data.Size(); iii++) { _filePos += ivec2(1,0); - DrawElementParsed(_data[iii], _filePos); + #ifdef ENABLE_DISPLAY_PARSED_ELEMENT + DrawElementParsed(_data[iii], _filePos); + #endif if (_data[iii] == '\n') { _filePos.setValue(1, _filePos.y()+1); continue; @@ -35,7 +37,7 @@ bool exml::EXmlComment::Parse(const etk::UString& _data, int32_t& _pos, bool _ca return false; } -bool exml::EXmlComment::Generate(etk::UString& _data, int32_t _indent) const +bool exml::Comment::Generate(etk::UString& _data, int32_t _indent) const { AddIndent(_data, _indent); _data += "