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 += "