exml/exml/Element.h

54 lines
1.5 KiB
C++

/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __ETK_XML_ELEMENT_H__
#define __ETK_XML_ELEMENT_H__
#include <exml/Node.h>
#include <etk/Vector.h>
#include <exml/AttributeList.h>
namespace exml
{
class Element : public AttributeList
{
public:
Element(void) { };
Element(const etk::UString& _value) { m_value = _value; };
virtual ~Element(void) { };
virtual nodeType_te GetType(void) const { return typeElement; };
protected:
etk::Vector<exml::Node*> m_listSub;
public:
int32_t Size(void) const { return m_listSub.Size(); };
void Append(Node* _node);
nodeType_te GetType(int32_t _id);
const nodeType_te GetType(int32_t _id) const;
Node* GetNode(int32_t _id);
const Node* GetNode(int32_t _id) const;
Element* GetElement(int32_t _id);
const Element* GetElement(int32_t _id) const;
Element* GetNamed(const etk::UString& _name);
const Element* GetNamed(const etk::UString& _name) const;
public:
etk::UString GetText(void);
public:
virtual bool Parse(const etk::UString& _data, int32_t& _pos, bool _caseSensitive, ivec2& _filePos);
virtual bool Generate(etk::UString& _data, int32_t _indent) const;
protected:
bool SubParse(const etk::UString& _data, int32_t& _pos, bool _caseSensitive, ivec2& _filePos, bool _mainNode=false);
virtual exml::Element* ToElement(void) { return this; };
virtual const exml::Element* ToElement(void) const { return this; };
};
};
#endif