#include <Element.hpp>

Inheritance diagram for exml::internal::Element:
exml::internal::AttributeList exml::internal::Node ememory::EnableSharedFromThis< Node > ememory::EnableSharedFromThisBase exml::internal::Document

Public Member Functions

size_t size () const
 
void append (const ememory::SharedPtr< exml::internal::Node > &_node)
 
void remove (const std::string &_nodeName)
 
enum nodeType getType (int32_t _id) const
 
ememory::SharedPtr< NodegetNode (int32_t _id)
 
const ememory::SharedPtr< NodegetNode (int32_t _id) const
 
ememory::SharedPtr< ElementgetElement (int32_t _id)
 
const ememory::SharedPtr< ElementgetElement (int32_t _id) const
 
ememory::SharedPtr< ElementgetNamed (const std::string &_name)
 
const ememory::SharedPtr< ElementgetNamed (const std::string &_name) const
 
std::string getText () const
 
enum nodeType getType () const override
 
bool iParse (const std::string &_data, int32_t &_pos, bool _caseSensitive, exml::FilePos &_filePos, exml::internal::Document &_doc) override
 
bool iGenerate (std::string &_data, int32_t _indent) const override
 
ememory::SharedPtr< exml::internal::ElementtoElement () override
 
const ememory::SharedPtr< exml::internal::ElementtoElement () const override
 
void clear () override
 
- Public Member Functions inherited from exml::internal::AttributeList
size_t sizeAttribute () const
 
void appendAttribute (const ememory::SharedPtr< exml::internal::Attribute > &_attr)
 
ememory::SharedPtr< AttributegetAttr (int32_t _id)
 
ememory::SharedPtr< const AttributegetAttr (int32_t _id) const
 
std::pair< std::string, std::string > getAttrPair (int32_t _id) const
 
const std::string & getAttribute (const std::string &_name) const
 
bool existAttribute (const std::string &_name) const
 
void setAttribute (const std::string &_name, const std::string &_value)
 
bool removeAttribute (const std::string &_name)
 
- Public Member Functions inherited from exml::internal::Node
virtual ~Node ()=default
 
const exml::FilePosgetPos () const
 
virtual void setValue (std::string _value)
 
virtual const std::string & getValue () const
 
virtual ememory::SharedPtr< exml::internal::DocumenttoDocument ()
 
virtual const ememory::SharedPtr< exml::internal::DocumenttoDocument () const
 
virtual ememory::SharedPtr< exml::internal::AttributetoAttribute ()
 
virtual const ememory::SharedPtr< exml::internal::AttributetoAttribute () const
 
virtual ememory::SharedPtr< exml::internal::CommenttoComment ()
 
virtual const ememory::SharedPtr< exml::internal::CommenttoComment () const
 
virtual ememory::SharedPtr< exml::internal::DeclarationtoDeclaration ()
 
virtual const ememory::SharedPtr< exml::internal::DeclarationtoDeclaration () const
 
virtual ememory::SharedPtr< exml::internal::TexttoText ()
 
virtual const ememory::SharedPtr< exml::internal::TexttoText () const
 
bool isDocument () const
 
bool isAttribute () const
 
bool isComment () const
 
bool isDeclaration () const
 
bool isElement () const
 
bool isText () const
 
- Public Member Functions inherited from ememory::EnableSharedFromThis< Node >
ememory::SharedPtr< EMEMORY_TYPE > sharedFromThis ()
 
const ememory::SharedPtr< EMEMORY_TYPE > sharedFromThis () const
 
ememory::WeakPtr< EMEMORY_TYPE > weakFromThis ()
 
const ememory::WeakPtr< EMEMORY_TYPE > weakFromThis () const
 

Static Public Member Functions

static ememory::SharedPtr< Elementcreate (const std::string &_value="")
 

Protected Member Functions

 Element ()
 
 Element (const std::string &_value)
 
bool subParse (const std::string &_data, int32_t &_pos, bool _caseSensitive, exml::FilePos &_filePos, exml::internal::Document &_doc, bool _mainNode=false)
 
- Protected Member Functions inherited from exml::internal::AttributeList
 AttributeList (const std::string &_value="")
 
- Protected Member Functions inherited from exml::internal::Node
 Node ()
 
 Node (const std::string &_value)
 
void addIndent (std::string &_data, int32_t _indent) const
 
void drawElementParsed (char32_t _val, const exml::FilePos &_filePos) const
 
bool checkAvaillable (char32_t _val, bool _firstChar) const
 
int32_t countWhiteChar (const std::string &_data, int32_t _pos, exml::FilePos &_filePos) const
 

Protected Attributes

std::vector< ememory::SharedPtr< exml::internal::Node > > m_listSub
 
- Protected Attributes inherited from exml::internal::AttributeList
std::vector< ememory::SharedPtr< exml::internal::Attribute > > m_listAttribute
 
- Protected Attributes inherited from exml::internal::Node
exml::FilePos m_pos
 
std::string m_value
 

Detailed Description

Basic element Node of an XML document <YYYYY>.

Constructor & Destructor Documentation

§ Element() [1/2]

exml::internal::Element::Element ( )
inlineprotected

Constructor.

§ Element() [2/2]

exml::internal::Element::Element ( const std::string &  _value)
inlineprotected

Constructor.

Parameters
[in]_valueElement name;

Member Function Documentation

§ append()

void exml::internal::Element::append ( const ememory::SharedPtr< exml::internal::Node > &  _node)

add a node at the element (not exml::internal::Attribute (move in the attribute automaticly).

Parameters
[in]_nodePointer of the node to add.

§ clear()

void exml::internal::Element::clear ( )
overridevirtual

clear the Node

Reimplemented from exml::internal::AttributeList.

§ create()

static ememory::SharedPtr<Element> exml::internal::Element::create ( const std::string &  _value = "")
static

factory of an exml::internal::Element

Parameters
[in]_valueName of the node.
Returns
Shared pointer on the Element

§ getElement() [1/2]

ememory::SharedPtr<Element> exml::internal::Element::getElement ( int32_t  _id)

get the element casted in Element (if the node is not an element return NULL).

Parameters
[in]_idId of the element.
Returns
Pointer on the element or NULL.

§ getElement() [2/2]

const ememory::SharedPtr<Element> exml::internal::Element::getElement ( int32_t  _id) const

get the element casted in Element (if the node is not an element return NULL).

Parameters
[in]_idId of the element.
Returns
Pointer on the element or NULL.

§ getNamed() [1/2]

ememory::SharedPtr<Element> exml::internal::Element::getNamed ( const std::string &  _name)

get an element with his name (work only with exml::internal::Element)

Parameters
[in]_nameName of the element that is requested
Returns
Pointer on the element or NULL.

§ getNamed() [2/2]

const ememory::SharedPtr<Element> exml::internal::Element::getNamed ( const std::string &  _name) const

get an element with his name (work only with exml::internal::Element)

Parameters
[in]_nameName of the element that is requested
Returns
Pointer on the element or NULL.

§ getNode() [1/2]

ememory::SharedPtr<Node> exml::internal::Element::getNode ( int32_t  _id)

get the Node pointer of the element id.

Parameters
[in]_idId of the element.
Returns
Pointer on node.

§ getNode() [2/2]

const ememory::SharedPtr<Node> exml::internal::Element::getNode ( int32_t  _id) const

get the Node pointer of the element id.

Parameters
[in]_idId of the element.
Returns
Pointer on node.

§ getText()

std::string exml::internal::Element::getText ( ) const

get the internal data of the element (if the element has some sub node thay are converted in xml string == > like this it is not needed to use <![CDATA[...]]>

Returns
the curent data string. if Only one text node, then we get the parssed data (no & ...) if more than one node, then we transform &,",',<,> in xml normal text...

§ getType() [1/2]

enum nodeType exml::internal::Element::getType ( int32_t  _id) const

get the type of the element id.

Parameters
[in]_idId of the element.
Returns
the Current type of the element or exml::internal::typeUnknow.

§ getType() [2/2]

enum nodeType exml::internal::Element::getType ( ) const
inlineoverridevirtual

get the node type.

Returns
the type of the Node.

Reimplemented from exml::internal::Node.

§ iGenerate()

bool exml::internal::Element::iGenerate ( std::string &  _data,
int32_t  _indent 
) const
overridevirtual

generate a string with the tree of the xml

Parameters
[in,out]_datastring where to add the elements
[in]_indentcurrent indentation of the file
Returns
false if an error occured.

Reimplemented from exml::internal::AttributeList.

§ iParse()

bool exml::internal::Element::iParse ( const std::string &  _data,
int32_t &  _pos,
bool  _caseSensitive,
exml::FilePos _filePos,
exml::internal::Document _doc 
)
overridevirtual

parse the Current node [pure VIRUAL]

Parameters
[in]_datadata string to parse.
[in,out]_posposition in the string to start parse, return the position end of parsing.
[in]_caseSensitiveRequest a parsion of element that is not case sensitive (all element is in low case)
[in,out]_filePosfile parsing position (line x col x)
[in,out]_docBase document reference
Returns
false if an error occured.

Implements exml::internal::Node.

§ remove()

void exml::internal::Element::remove ( const std::string &  _nodeName)

Remove all element with this name.

Parameters
[in]_nodeNameName of nodes to remove.

§ size()

size_t exml::internal::Element::size ( ) const
inline

get the number of sub element in the node (can be exml::internal::Comment ; exml::internal::Element ; exml::internal::Text :exml::internal::Declaration).

Returns
a number >=0.

§ subParse()

bool exml::internal::Element::subParse ( const std::string &  _data,
int32_t &  _pos,
bool  _caseSensitive,
exml::FilePos _filePos,
exml::internal::Document _doc,
bool  _mainNode = false 
)
protected

Parse sub node string.

Parameters
[in]_dataall file string data
[in,out]_posPosition to start parsing in the file and return the end of parsing
[in]_caseSensitiveCase sensitive parsing (usefull for html)
[in]_filePosCurrent File position of the parsing
[in]_docDocument base reference
[in]_mainNodeif true, this is the first root node
Returns
true parsing is done OK
false An error appear in the parsing

§ toElement() [1/2]

ememory::SharedPtr<exml::internal::Element> exml::internal::Element::toElement ( )
overridevirtual

Cast the element in a Element if it is possible.

Returns
pointer on the class or nullptr.

Reimplemented from exml::internal::Node.

§ toElement() [2/2]

const ememory::SharedPtr<exml::internal::Element> exml::internal::Element::toElement ( ) const
overridevirtual

Cast the element in a Element if it is possible.

Returns
CONST pointer on the class or nullptr.

Reimplemented from exml::internal::Node.

Member Data Documentation

§ m_listSub

std::vector<ememory::SharedPtr<exml::internal::Node> > exml::internal::Element::m_listSub
protected

List of subNodes.


The documentation for this class was generated from the following file: