|
PLaSK library
|
Represent single XML element connected with writer. More...
#include <plask/utils/xml/writer.hpp>
Public Member Functions | |
| Element (XMLWriter &writer, const std::string &name) | |
Construct element with given name, write to steam opening of element tag. | |
| Element (XMLWriter &writer, std::string &&name) | |
Construct element with given name, write to steam opening of element tag. | |
| Element (Element &parent, const std::string &name) | |
Construct element with given name, write to steam opening of element tag. | |
| Element (Element &parent, std::string &&name) | |
Construct element with given name, write to steam opening of element tag. | |
| Element (const Element &)=delete | |
| Disallow to copy element. | |
| Element & | operator= (const Element &)=delete |
| Disallow to copy element. | |
| Element (Element &&to_move) | |
| Move is allowed. | |
| Element & | operator= (Element &&to_move) |
| Move is allowed. | |
| ~Element () | |
| Close element tag. | |
| std::size_t | getLevel () const |
| Element & | attr (const std::string &attr_name, const std::string &attr_value) |
| Append attribute to this element. | |
| template<typename ValueT > | |
| Element & | attr (const std::string &attr_name, const ValueT &attr_value) |
| Append attribute to this element. | |
| Element & | writeText (const char *str) |
| Append text content to this element. | |
| Element & | writeText (const std::string &str) |
| Append text content to this element. | |
| template<class T > | |
| Element & | writeText (const T &value) |
| Append text content to this element. | |
| Element & | writeCDATA (const std::string &str) |
| void | indent () |
| Write spaces to the current indentation level. | |
| template<typename name_t > | |
| Element | addElement (name_t &&name) |
| Create sub-element of this. | |
| template<typename name_t > | |
| Element | addTag (name_t &&name) |
| Create sub-element of this. | |
| Element & | end () |
| Close this element. | |
| bool | canAppendAttributes () const |
| Check if tag attributes still can be appended. | |
| bool | isCurrent () const |
| Check if this is current element. | |
| bool | isEnded () const |
| Check if this was ended or moved, and can't be used any more. | |
| const std::string & | getName () const |
| Get name of this element. | |
| XMLWriter * | getWriter () const |
| Get writer used by this. | |
| Element * | getParent () const |
| Get parent of this element. | |
Represent single XML element connected with writer.
Constructor put in stream opening tag and destructor closing one.
Definition at line 91 of file writer.hpp.
Construct element with given name, write to steam opening of element tag.
| writer | XML writer where element should be append |
| name | name of elements tag |
Definition at line 66 of file writer.cpp.
| plask::XMLWriter::Element::Element | ( | XMLWriter & | writer, |
| std::string && | name | ||
| ) |
Construct element with given name, write to steam opening of element tag.
| writer | XML writer where element should be append |
| name | name of elements tag |
Definition at line 71 of file writer.cpp.
| plask::XMLWriter::Element::Element | ( | XMLWriter::Element & | parent, |
| const std::string & | name | ||
| ) |
Construct element with given name, write to steam opening of element tag.
| parent | parent element, must by recently added, not closed one |
| name | name of elements tag |
Definition at line 76 of file writer.cpp.
| plask::XMLWriter::Element::Element | ( | XMLWriter::Element & | parent, |
| std::string && | name | ||
| ) |
Construct element with given name, write to steam opening of element tag.
| parent | parent element, must by recently added, not closed one |
| name | name of elements tag |
Definition at line 82 of file writer.cpp.
| plask::XMLWriter::Element::Element | ( | XMLWriter::Element && | to_move | ) |
Move is allowed.
Definition at line 88 of file writer.cpp.
| plask::XMLWriter::Element::~Element | ( | ) |
Close element tag.
Definition at line 111 of file writer.cpp.
| XMLWriter::Element & plask::XMLWriter::Element::attr | ( | const std::string & | attr_name, |
| const std::string & | attr_value | ||
| ) |
Append attribute to this element.
| attr_name | name of attribute to append |
| attr_value | value of attribute to append |
Definition at line 122 of file writer.cpp.
|
inline |
Append attribute to this element.
| attr_name | name of attribute to append |
| attr_value | value of attribute to append, will be change to string using boost::lexical_cast |
Definition at line 173 of file writer.hpp.
|
inline |
Check if tag attributes still can be appended.
true if attributes can still be append to this element Definition at line 232 of file writer.hpp.
| XMLWriter::Element & plask::XMLWriter::Element::end | ( | ) |
Close this element.
Definition at line 155 of file writer.cpp.
| std::size_t plask::XMLWriter::Element::getLevel | ( | ) | const |
Definition at line 116 of file writer.cpp.
|
inline |
|
inline |
Get parent of this element.
nullptr if this represent the root Definition at line 262 of file writer.hpp.
|
inline |
| void plask::XMLWriter::Element::indent | ( | ) |
Write spaces to the current indentation level.
Definition at line 149 of file writer.cpp.
|
inline |
Check if this is current element.
true only if this is current element Definition at line 238 of file writer.hpp.
|
inline |
Check if this was ended or moved, and can't be used any more.
true only if this was ended or moved Definition at line 244 of file writer.hpp.
| XMLWriter::Element & plask::XMLWriter::Element::operator= | ( | XMLWriter::Element && | to_move | ) |
Move is allowed.
Definition at line 99 of file writer.cpp.
| XMLWriter::Element & plask::XMLWriter::Element::writeCDATA | ( | const std::string & | str | ) |
Definition at line 140 of file writer.cpp.
| XMLWriter::Element & plask::XMLWriter::Element::writeText | ( | const char * | str | ) |
Append text content to this element.
| str | content to append |
Definition at line 133 of file writer.cpp.
Append text content to this element.
| str | content to append |
Definition at line 189 of file writer.hpp.
Append text content to this element.
| value | content to append, will be change to string using boost::lexical_cast |
Definition at line 197 of file writer.hpp.