Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
UtilsXML Class Reference

Base class for XML "nodes", to be data elements T for drain::Tree<T> More...

#include <UtilsXML.h>

Static Public Member Functions

template<class V >
static void attribToStream (std::ostream &ostr, const std::string &key, const V &value)
 
template<typename T >
static T & assign (T &dst, const T &src)
 Assign another tree structure to another.
 
template<typename TX >
static TX & assign (TX &dst, const typename TX::xml_node_t &src)
 Copy node data to tree.
 
template<typename T , typename V >
static T & assign (T &tree, const V &arg)
 Assign tree node (data) to another.
 
template<typename T >
static T & assign (T &tree, std::initializer_list< std::pair< const char *, const Variable > > l)
 Tree.
 
template<typename TX >
static TX & assignString (TX &tree, const std::string &s)
 When assigning a string, create new element unless the element itself is of type CTEXT.
 
template<typename TX >
static TX & appendString (TX &tree, const std::string &s)
 
template<typename TX >
static TX & setType (TX &tree, const typename TX::node_data_t::xml_tag_t &type)
 
template<typename T >
static T & addChild (T &tree)
 
template<typename T >
static T & addChild (T &tree, const std::string &key)
 
template<typename N >
static N::xml_tag_t retrieveDefaultType (const N &parentNode)
 

Detailed Description

Base class for XML "nodes", to be data elements T for drain::Tree<T>

Member Function Documentation

◆ addChild()

template<typename T >
static T & addChild ( T &  tree)
inlinestatic

TODO: add default type based on parent group? defaultChildMap TR->TD

◆ assign() [1/4]

template<typename T >
static T & assign ( T &  dst,
const T &  src 
)
inlinestatic

Assign another tree structure to another.

Template Parameters
XML- xml tree structure (TreeXML, TreeSVG, TreeHTML)

◆ assign() [2/4]

template<typename T , typename V >
static T & assign ( T &  tree,
const V &  arg 
)
inlinestatic

Assign tree node (data) to another.

    \tparam N - xml node (e.g. NodeXML, NodeSVG, NodeHTML)

    \see clear()
template <typename N>
static inline
N & assignNode(N & dst, const N & src){

    if (&src != &dst){

dst.clear(); // clear attributes, if (!dst.typeIs(src.getNativeType())){ if (dst.getType() != src.getType()){ dst.reset(); // clear attributes, style, cstring and type. Warning: does not create links. dst.setType(src.getType()); } dst.getAttributes().importMap(src.getAttributes()); dst.setStyle(src.getStyle()); dst.setText(src.ctext); // wrong! set type to CTEXT dst.ctext = src.ctext; }

return dst; } Assign property to a XML tree node

Template Parameters
T- XML tree

◆ assign() [3/4]

template<typename T >
static T & assign ( T &  tree,
std::initializer_list< std::pair< const char *, const Variable > >  l 
)
inlinestatic

Tree.

Template Parameters
TX- xml tree

◆ assign() [4/4]

template<typename TX >
static TX & assign ( TX &  dst,
const typename TX::xml_node_t &  src 
)
inlinestatic

Copy node data to tree.

Template Parameters
XML- xml tree structure (TreeXML, TreeSVG, TreeHTML)

◆ assignString()

template<typename TX >
static TX & assignString ( TX &  tree,
const std::string &  s 
)
inlinestatic

When assigning a string, create new element unless the element itself is of type CTEXT.

Returns
- text element (CTEXT): current or child element of the current element

Forward definition – type can be set only upon construction of a complete class

◆ setType()

template<typename TX >
static TX & setType ( TX &  tree,
const typename TX::node_data_t::xml_tag_t &  type 
)
inlinestatic

Forward definition – type can be set only upon construction of a complete class


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