DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Public Member Functions | Public Attributes | List of all members
dd4hep::xml::Collection_t Class Reference

Class to support the access to collections of XmlNodes (or XmlElements) More...

#include <XMLElements.h>

Inheritance diagram for dd4hep::xml::Collection_t:
dd4hep::xml::Handle_t

Public Member Functions

 Collection_t (Handle_t node, const XmlChar *tag)
 Constructor over XmlElements with a given tag name. More...
 
 Collection_t (Handle_t node, const char *tag)
 Constructor over XmlElements with a given tag name. More...
 
 Collection_t (NodeList children)
 Constructor over XmlElements in a node list. More...
 
Collection_treset ()
 Reset the collection object to restart the iteration. More...
 
size_t size () const
 Access the collection size. Avoid this call – sloooow! More...
 
void operator++ () const
 Operator to advance the collection (pre increment) More...
 
void operator++ (int) const
 Operator to advance the collection (post increment) More...
 
void operator-- () const
 Operator to advance the collection (pre decrement) More...
 
void operator-- (int) const
 Operator to advance the collection (post decrement) More...
 
Elt_t current () const
 Access to current element. More...
 
void throw_loop_exception (const std::exception &e) const
 Helper function to throw an exception. More...
 
template<class T >
void for_each (T oper) const
 Loop processor using function object. More...
 
template<class T >
void for_each (const XmlChar *tag_name, T oper) const
 Loop processor using function object. More...
 
- Public Member Functions inherited from dd4hep::xml::Handle_t
 Handle_t (Elt_t e=0)
 Initializing constructor. More...
 
Elt_t operator-> () const
 Direct access to the XmlElement using the operator-> More...
 
 operator Elt_t () const
 Direct access to the XmlElement by dereferencing. More...
 
Elt_t ptr () const
 Direct access to the XmlElement by function. More...
 
Handle_t clone (XmlDocument *new_doc) const
 Clone the DOMelement - with the option of a deep copy. More...
 
const XmlCharrawTag () const
 Unicode text access to the element's tag. Tis must be wrong .... More...
 
const XmlCharrawText () const
 Unicode text access to the element's text. More...
 
const XmlCharrawValue () const
 Unicode text access to the element's value. More...
 
std::string tag () const
 Text access to the element's tag. More...
 
std::string text () const
 Text access to the element's text. More...
 
std::string value () const
 Text access to the element's value. More...
 
void setValue (const XmlChar *text) const
 Set the element's value. More...
 
void setValue (const std::string &text) const
 Set the element's value. More...
 
void setText (const XmlChar *text) const
 Set the element's text. More...
 
void setText (const std::string &text) const
 Set the element's text. More...
 
const XmlCharattr_name (const Attribute attr) const
 Access attribute name (throws exception if not present) More...
 
const XmlCharattr_value (const Attribute attr) const
 Access attribute value by the attribute (throws exception if not present) More...
 
const XmlCharattr_value (const XmlChar *attr) const
 Access attribute value by the attribute's unicode name (throws exception if not present) More...
 
const XmlCharattr_value_nothrow (const XmlChar *attr) const
 Access attribute value by the attribute's unicode name (no exception thrown if not present) More...
 
Attribute attr_ptr (const XmlChar *attr) const
 Access attribute pointer by the attribute's unicode name (throws exception if not present) More...
 
Attribute attr_nothrow (const XmlChar *tag) const
 Access attribute pointer by the attribute's unicode name (no exception thrown if not present) More...
 
bool hasAttr (const XmlChar *t) const
 Check for the existence of a named attribute. More...
 
std::vector< Attributeattributes () const
 Retrieve a collection of all attributes of this DOM element. More...
 
template<class T >
attr (const Attribute a) const
 Access typed attribute value by the XmlAttr. More...
 
void removeAttrs () const
 Remove all attributes of this element. More...
 
void setAttrs (Handle_t e) const
 Set attributes as in argument handle. More...
 
template<class T >
attr (const XmlChar *name) const
 Access typed attribute value by its unicode name. More...
 
template<class T >
attr (const XmlChar *name, T default_value) const
 Access typed attribute value by its unicode name. If not existing returns default value. More...
 
Attribute setAttr (const XmlChar *t, const XmlChar *v) const
 Generic attribute setter with unicode value. More...
 
Attribute setAttr (const XmlChar *t, const Attribute v) const
 Generic attribute setter with XmlAttr value. More...
 
Attribute setAttr (const XmlChar *t, int val) const
 Generic attribute setter with integer value. More...
 
Attribute setAttr (const XmlChar *t, bool val) const
 Generic attribute setter with boolen value. More...
 
Attribute setAttr (const XmlChar *t, float val) const
 Generic attribute setter with floating point value. More...
 
Attribute setAttr (const XmlChar *t, double val) const
 Generic attribute setter with double precision floating point value. More...
 
Attribute setAttr (const XmlChar *t, const std::string &val) const
 Generic attribute setter with string value. More...
 
bool hasAttr (const char *t) const
 Check for the existence of a named attribute. More...
 
template<class T >
attr (const char *name) const
 Access typed attribute value by its name. More...
 
template<class T >
attr (const char *name, const T &default_value) const
 Access typed attribute value by its name. More...
 
Attribute setAttr (const XmlChar *t, const char *v) const
 Generic attribute setter with text value. More...
 
Handle_t setRef (const XmlChar *tag, const XmlChar *ref)
 Add reference child as a new child node. The obj must have the "name" attribute! More...
 
Handle_t setRef (const XmlChar *tag, const std::string &ref)
 Add reference child as a new child node. The obj must have the "name" attribute! More...
 
bool hasChild (const XmlChar *tag) const
 Check the existence of a child with a given tag name. More...
 
Handle_t child (const XmlChar *tag, bool throw_exception=true) const
 Access a single child by its tag name (unicode) More...
 
NodeList children (const XmlChar *tag) const
 Access a group of children identified by the same tag name. More...
 
size_t numChildren (const XmlChar *tag, bool throw_exception) const
 Access the number of children of this DOM element with a given tag name. More...
 
Handle_t remove (Handle_t e) const
 Remove a single child node identified by its handle from the tree of the element. More...
 
void removeChildren (const XmlChar *tag) const
 Remove children with a given tag name from the DOM node. More...
 
void append (Handle_t e) const
 Append a DOM element to the current node. More...
 
Handle_t parent () const
 Access the element's parent element. More...
 
unsigned int checksum (unsigned int param, unsigned int(fcn)(unsigned int param, const XmlChar *, size_t)=0) const
 Checksum (sub-)tree of a xml document/tree. Default will pick up the adler32 checksum. More...
 
template<>
INLINE Attribute attr (const XmlChar *tag_value) const
 
template<>
INLINE cpXmlChar attr (const XmlChar *tag_value) const
 
template<>
INLINE bool attr (const XmlChar *tag_value) const
 
template<>
INLINE int attr (const XmlChar *tag_value) const
 
template<>
INLINE unsigned int attr (const XmlChar *tag_value) const
 
template<>
INLINE long attr (const XmlChar *tag_value) const
 
template<>
INLINE unsigned long attr (const XmlChar *tag_value) const
 
template<>
INLINE float attr (const XmlChar *tag_value) const
 
template<>
INLINE double attr (const XmlChar *tag_value) const
 
template<>
INLINE Attribute attr (const XmlChar *tag_value, Attribute default_value) const
 
template<>
INLINE bool attr (const XmlChar *tag_value, bool default_value) const
 
template<>
INLINE int attr (const XmlChar *tag_value, int default_value) const
 
template<>
INLINE unsigned int attr (const XmlChar *tag_value, unsigned int default_value) const
 
template<>
INLINE long attr (const XmlChar *tag_value, long default_value) const
 
template<>
INLINE unsigned long attr (const XmlChar *tag_value, unsigned long default_value) const
 
template<>
INLINE float attr (const XmlChar *tag_value, float default_value) const
 
template<>
INLINE double attr (const XmlChar *tag_value, double default_value) const
 

Public Attributes

NodeList m_children
 Reference to the list of child nodes. More...
 
- Public Attributes inherited from dd4hep::xml::Handle_t
Elt_t m_node
 The pointer to the XmlElement. More...
 

Additional Inherited Members

- Public Types inherited from dd4hep::xml::Handle_t
typedef XmlElement * Elt_t
 

Detailed Description

Class to support the access to collections of XmlNodes (or XmlElements)

Author
M.Frank
Version
1.0

Definition at line 636 of file XMLElements.h.

Constructor & Destructor Documentation

◆ Collection_t() [1/3]

Collection_t::Collection_t ( Handle_t  node,
const XmlChar tag 
)

Constructor over XmlElements with a given tag name.

Definition at line 1194 of file XMLElements.cpp.

◆ Collection_t() [2/3]

Collection_t::Collection_t ( Handle_t  node,
const char *  tag 
)

Constructor over XmlElements with a given tag name.

Definition at line 1200 of file XMLElements.cpp.

◆ Collection_t() [3/3]

Collection_t::Collection_t ( NodeList  children)

Constructor over XmlElements in a node list.

Definition at line 1206 of file XMLElements.cpp.

Member Function Documentation

◆ current()

Elt_t dd4hep::xml::Collection_t::current ( ) const
inline

Access to current element.

Definition at line 661 of file XMLElements.h.

◆ for_each() [1/2]

template<class T >
void dd4hep::xml::Collection_t::for_each ( const XmlChar tag_name,
oper 
) const
inline

Loop processor using function object.

Definition at line 677 of file XMLElements.h.

◆ for_each() [2/2]

template<class T >
void dd4hep::xml::Collection_t::for_each ( oper) const
inline

Loop processor using function object.

Definition at line 667 of file XMLElements.h.

◆ operator++() [1/2]

void Collection_t::operator++ ( ) const

Operator to advance the collection (pre increment)

Definition at line 1230 of file XMLElements.cpp.

◆ operator++() [2/2]

void Collection_t::operator++ ( int  ) const

Operator to advance the collection (post increment)

Definition at line 1252 of file XMLElements.cpp.

◆ operator--() [1/2]

void Collection_t::operator-- ( ) const

Operator to advance the collection (pre decrement)

Definition at line 1241 of file XMLElements.cpp.

◆ operator--() [2/2]

void Collection_t::operator-- ( int  ) const

Operator to advance the collection (post decrement)

Definition at line 1256 of file XMLElements.cpp.

◆ reset()

Collection_t & Collection_t::reset ( )

Reset the collection object to restart the iteration.

Definition at line 1212 of file XMLElements.cpp.

◆ size()

size_t Collection_t::size ( ) const

Access the collection size. Avoid this call – sloooow!

Definition at line 1218 of file XMLElements.cpp.

◆ throw_loop_exception()

void Collection_t::throw_loop_exception ( const std::exception &  e) const

Helper function to throw an exception.

Definition at line 1223 of file XMLElements.cpp.

Member Data Documentation

◆ m_children

NodeList dd4hep::xml::Collection_t::m_children

Reference to the list of child nodes.

Definition at line 639 of file XMLElements.h.


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