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

Class to easily access the properties of single XmlElements. More...

#include <XMLElements.h>

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

Public Types

typedef XmlElement * Elt_t
 

Public Member Functions

 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

Elt_t m_node
 The pointer to the XmlElement. More...
 

Detailed Description

Class to easily access the properties of single XmlElements.

Note: The assignmant operator as well as the copy constructor do not have to be implemented, they are aut-generated by the compiler!

Author
M.Frank
Version
1.0

Definition at line 380 of file XMLElements.h.

Member Typedef Documentation

◆ Elt_t

typedef XmlElement* dd4hep::xml::Handle_t::Elt_t

Definition at line 383 of file XMLElements.h.

Constructor & Destructor Documentation

◆ Handle_t()

dd4hep::xml::Handle_t::Handle_t ( Elt_t  e = 0)
inline

Initializing constructor.

Definition at line 389 of file XMLElements.h.

Member Function Documentation

◆ append()

void Handle_t::append ( Handle_t  e) const

Append a DOM element to the current node.

Definition at line 727 of file XMLElements.cpp.

◆ attr() [1/22]

template<class T >
T dd4hep::xml::Handle_t::attr ( const Attribute  a) const
inline

Access typed attribute value by the XmlAttr.

Definition at line 454 of file XMLElements.h.

◆ attr() [2/22]

template<class T >
T dd4hep::xml::Handle_t::attr ( const char *  name) const
inline

Access typed attribute value by its name.

Definition at line 486 of file XMLElements.h.

◆ attr() [3/22]

template<class T >
T dd4hep::xml::Handle_t::attr ( const char *  name,
const T &  default_value 
) const
inline

Access typed attribute value by its name.

Definition at line 490 of file XMLElements.h.

◆ attr() [4/22]

template<class T >
T dd4hep::xml::Handle_t::attr ( const XmlChar name) const

Access typed attribute value by its unicode name.

◆ attr() [5/22]

template<class T >
T dd4hep::xml::Handle_t::attr ( const XmlChar name,
default_value 
) const

Access typed attribute value by its unicode name. If not existing returns default value.

◆ attr() [6/22]

template<>
INLINE Attribute dd4hep::xml::Handle_t::attr ( const XmlChar tag_value) const

Definition at line 528 of file XMLElements.h.

◆ attr() [7/22]

template<>
INLINE cpXmlChar dd4hep::xml::Handle_t::attr ( const XmlChar tag_value) const

Definition at line 532 of file XMLElements.h.

◆ attr() [8/22]

template<>
INLINE bool dd4hep::xml::Handle_t::attr ( const XmlChar tag_value) const

Definition at line 536 of file XMLElements.h.

◆ attr() [9/22]

template<>
INLINE int dd4hep::xml::Handle_t::attr ( const XmlChar tag_value) const

Definition at line 540 of file XMLElements.h.

◆ attr() [10/22]

template<>
INLINE unsigned int dd4hep::xml::Handle_t::attr ( const XmlChar tag_value) const

Definition at line 544 of file XMLElements.h.

◆ attr() [11/22]

template<>
INLINE long dd4hep::xml::Handle_t::attr ( const XmlChar tag_value) const

Definition at line 548 of file XMLElements.h.

◆ attr() [12/22]

template<>
INLINE unsigned long dd4hep::xml::Handle_t::attr ( const XmlChar tag_value) const

Definition at line 552 of file XMLElements.h.

◆ attr() [13/22]

template<>
INLINE float dd4hep::xml::Handle_t::attr ( const XmlChar tag_value) const

Definition at line 556 of file XMLElements.h.

◆ attr() [14/22]

template<>
INLINE double dd4hep::xml::Handle_t::attr ( const XmlChar tag_value) const

Definition at line 560 of file XMLElements.h.

◆ attr() [15/22]

template<>
INLINE Attribute dd4hep::xml::Handle_t::attr ( const XmlChar tag_value,
Attribute  default_value 
) const

Definition at line 568 of file XMLElements.h.

◆ attr() [16/22]

template<>
INLINE bool dd4hep::xml::Handle_t::attr ( const XmlChar tag_value,
bool  default_value 
) const

Definition at line 573 of file XMLElements.h.

◆ attr() [17/22]

template<>
INLINE double dd4hep::xml::Handle_t::attr ( const XmlChar tag_value,
double  default_value 
) const

Definition at line 603 of file XMLElements.h.

◆ attr() [18/22]

template<>
INLINE float dd4hep::xml::Handle_t::attr ( const XmlChar tag_value,
float  default_value 
) const

Definition at line 598 of file XMLElements.h.

◆ attr() [19/22]

template<>
INLINE int dd4hep::xml::Handle_t::attr ( const XmlChar tag_value,
int  default_value 
) const

Definition at line 578 of file XMLElements.h.

◆ attr() [20/22]

template<>
INLINE long dd4hep::xml::Handle_t::attr ( const XmlChar tag_value,
long  default_value 
) const

Definition at line 588 of file XMLElements.h.

◆ attr() [21/22]

template<>
INLINE unsigned int dd4hep::xml::Handle_t::attr ( const XmlChar tag_value,
unsigned int  default_value 
) const

Definition at line 583 of file XMLElements.h.

◆ attr() [22/22]

template<>
INLINE unsigned long dd4hep::xml::Handle_t::attr ( const XmlChar tag_value,
unsigned long  default_value 
) const

Definition at line 593 of file XMLElements.h.

◆ attr_name()

const XmlChar * Handle_t::attr_name ( const Attribute  attr) const

Access attribute name (throws exception if not present)

Definition at line 851 of file XMLElements.cpp.

◆ attr_nothrow()

Attribute Handle_t::attr_nothrow ( const XmlChar tag) const

Access attribute pointer by the attribute's unicode name (no exception thrown if not present)

Definition at line 668 of file XMLElements.cpp.

◆ attr_ptr()

Attribute Handle_t::attr_ptr ( const XmlChar attr) const

Access attribute pointer by the attribute's unicode name (throws exception if not present)

Definition at line 838 of file XMLElements.cpp.

◆ attr_value() [1/2]

const XmlChar * Handle_t::attr_value ( const Attribute  attr) const

Access attribute value by the attribute (throws exception if not present)

Definition at line 864 of file XMLElements.cpp.

◆ attr_value() [2/2]

const XmlChar * Handle_t::attr_value ( const XmlChar attr) const

Access attribute value by the attribute's unicode name (throws exception if not present)

Definition at line 859 of file XMLElements.cpp.

◆ attr_value_nothrow()

const XmlChar * Handle_t::attr_value_nothrow ( const XmlChar attr) const

Access attribute value by the attribute's unicode name (no exception thrown if not present)

Definition at line 869 of file XMLElements.cpp.

◆ attributes()

std::vector< Attribute > Handle_t::attributes ( ) const

Retrieve a collection of all attributes of this DOM element.

Definition at line 678 of file XMLElements.cpp.

◆ checksum()

unsigned int Handle_t::checksum ( unsigned int  param,
unsigned   intfcn)(unsigned int param, const XmlChar *, size_t = 0 
) const

Checksum (sub-)tree of a xml document/tree. Default will pick up the adler32 checksum.

Definition at line 990 of file XMLElements.cpp.

◆ child()

Handle_t Handle_t::child ( const XmlChar tag,
bool  throw_exception = true 
) const

Access a single child by its tag name (unicode)

Remove a single child node identified by its handle from the tree of the element.

Definition at line 710 of file XMLElements.cpp.

◆ children()

NodeList Handle_t::children ( const XmlChar tag) const

Access a group of children identified by the same tag name.

Definition at line 722 of file XMLElements.cpp.

◆ clone()

Handle_t Handle_t::clone ( XmlDocument *  new_doc) const

Clone the DOMelement - with the option of a deep copy.

Definition at line 646 of file XMLElements.cpp.

◆ hasAttr() [1/2]

bool dd4hep::xml::Handle_t::hasAttr ( const char *  t) const
inline

Check for the existence of a named attribute.

Definition at line 482 of file XMLElements.h.

◆ hasAttr() [2/2]

bool Handle_t::hasAttr ( const XmlChar t) const

Check for the existence of a named attribute.

Definition at line 673 of file XMLElements.cpp.

◆ hasChild()

bool Handle_t::hasChild ( const XmlChar tag) const

Check the existence of a child with a given tag name.

Definition at line 764 of file XMLElements.cpp.

◆ numChildren()

size_t Handle_t::numChildren ( const XmlChar tag,
bool  throw_exception 
) const

Access the number of children of this DOM element with a given tag name.

Definition at line 695 of file XMLElements.cpp.

◆ operator Elt_t()

dd4hep::xml::Handle_t::operator Elt_t ( ) const
inline

Direct access to the XmlElement by dereferencing.

Definition at line 397 of file XMLElements.h.

◆ operator->()

Elt_t dd4hep::xml::Handle_t::operator-> ( ) const
inline

Direct access to the XmlElement using the operator->

Definition at line 393 of file XMLElements.h.

◆ parent()

Handle_t Handle_t::parent ( ) const

Access the element's parent element.

Definition at line 663 of file XMLElements.cpp.

◆ ptr()

Elt_t dd4hep::xml::Handle_t::ptr ( ) const
inline

Direct access to the XmlElement by function.

Definition at line 401 of file XMLElements.h.

◆ rawTag()

const XmlChar * Handle_t::rawTag ( ) const

Unicode text access to the element's tag. Tis must be wrong ....

Definition at line 631 of file XMLElements.cpp.

◆ rawText()

const XmlChar * Handle_t::rawText ( ) const

Unicode text access to the element's text.

Definition at line 636 of file XMLElements.cpp.

◆ rawValue()

const XmlChar * Handle_t::rawValue ( ) const

Unicode text access to the element's value.

Definition at line 641 of file XMLElements.cpp.

◆ remove()

Handle_t Handle_t::remove ( Handle_t  e) const

Remove a single child node identified by its handle from the tree of the element.

Definition at line 732 of file XMLElements.cpp.

◆ removeAttrs()

void Handle_t::removeAttrs ( ) const

Remove all attributes of this element.

Definition at line 801 of file XMLElements.cpp.

◆ removeChildren()

void Handle_t::removeChildren ( const XmlChar tag) const

Remove children with a given tag name from the DOM node.

Definition at line 752 of file XMLElements.cpp.

◆ setAttr() [1/8]

Attribute Handle_t::setAttr ( const XmlChar t,
bool  val 
) const

Generic attribute setter with boolen value.

Definition at line 882 of file XMLElements.cpp.

◆ setAttr() [2/8]

Attribute Handle_t::setAttr ( const XmlChar t,
const Attribute  v 
) const

Generic attribute setter with XmlAttr value.

Definition at line 914 of file XMLElements.cpp.

◆ setAttr() [3/8]

Attribute Handle_t::setAttr ( const XmlChar t,
const char *  v 
) const

Generic attribute setter with text value.

Definition at line 908 of file XMLElements.cpp.

◆ setAttr() [4/8]

Attribute Handle_t::setAttr ( const XmlChar t,
const std::string &  val 
) const

Generic attribute setter with string value.

Definition at line 903 of file XMLElements.cpp.

◆ setAttr() [5/8]

Attribute Handle_t::setAttr ( const XmlChar t,
const XmlChar v 
) const

Generic attribute setter with unicode value.

Definition at line 919 of file XMLElements.cpp.

◆ setAttr() [6/8]

Attribute Handle_t::setAttr ( const XmlChar t,
double  val 
) const

Generic attribute setter with double precision floating point value.

Definition at line 896 of file XMLElements.cpp.

◆ setAttr() [7/8]

Attribute Handle_t::setAttr ( const XmlChar t,
float  val 
) const

Generic attribute setter with floating point value.

Definition at line 889 of file XMLElements.cpp.

◆ setAttr() [8/8]

Attribute Handle_t::setAttr ( const XmlChar t,
int  val 
) const

Generic attribute setter with integer value.

Definition at line 875 of file XMLElements.cpp.

◆ setAttrs()

void Handle_t::setAttrs ( Handle_t  e) const

Set attributes as in argument handle.

Definition at line 823 of file XMLElements.cpp.

◆ setRef() [1/2]

Handle_t 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!

Definition at line 946 of file XMLElements.cpp.

◆ setRef() [2/2]

Handle_t Handle_t::setRef ( const XmlChar tag,
const XmlChar ref 
)

Add reference child as a new child node. The obj must have the "name" attribute!

Definition at line 937 of file XMLElements.cpp.

◆ setText() [1/2]

void Handle_t::setText ( const std::string &  text) const

Set the element's text.

Definition at line 792 of file XMLElements.cpp.

◆ setText() [2/2]

void Handle_t::setText ( const XmlChar text) const

Set the element's text.

Definition at line 783 of file XMLElements.cpp.

◆ setValue() [1/2]

void Handle_t::setValue ( const std::string &  text) const

Set the element's value.

Definition at line 774 of file XMLElements.cpp.

◆ setValue() [2/2]

void Handle_t::setValue ( const XmlChar text) const

Set the element's value.

Definition at line 769 of file XMLElements.cpp.

◆ tag()

std::string dd4hep::xml::Handle_t::tag ( ) const
inline

Text access to the element's tag.

Definition at line 414 of file XMLElements.h.

◆ text()

std::string dd4hep::xml::Handle_t::text ( ) const
inline

Text access to the element's text.

Definition at line 418 of file XMLElements.h.

◆ value()

std::string dd4hep::xml::Handle_t::value ( ) const
inline

Text access to the element's value.

Definition at line 422 of file XMLElements.h.

Member Data Documentation

◆ m_node

Elt_t dd4hep::xml::Handle_t::m_node
mutable

The pointer to the XmlElement.

Definition at line 386 of file XMLElements.h.


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