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

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

#include <Elements.h>

Inheritance diagram for dd4hep::json::Handle_t:
dd4hep::json::Collection_t

Public Types

typedef JsonElementElt_t
 

Public Member Functions

 Handle_t (Elt_t e=0)
 Initializing constructor. More...
 
Elt_t operator-> () const
 Direct access to the JsonElement using the operator-> More...
 
 operator Elt_t () const
 Direct access to the JsonElement by dereferencing. More...
 
Elt_t ptr () const
 Direct access to the JsonElement by function. More...
 
const char * rawTag () const
 Unicode text access to the element's tag. More...
 
const char * rawText () const
 Unicode text access to the element's text. More...
 
const char * rawValue () 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...
 
const char * attr_name (const Attribute attr) const
 Access attribute name (throws exception if not present) More...
 
const char * attr_value (const Attribute attr) const
 Access attribute value by the attribute (throws exception if not present) More...
 
const char * attr_value (const char *attr) const
 Access attribute value by the attribute's unicode name (throws exception if not present) More...
 
const char * attr_value_nothrow (const char *attr) const
 Access attribute value by the attribute's unicode name (no exception thrown if not present) More...
 
Attribute attr_ptr (const char *attr) const
 Access attribute pointer by the attribute's unicode name (throws exception if not present) More...
 
Attribute attr_nothrow (const char *tag) const
 Access attribute pointer by the attribute's unicode name (no exception thrown if not present) More...
 
bool hasAttr (const char *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 JsonAttr. More...
 
template<class T >
attr (const char *name) const
 Access typed attribute value by its unicode name. More...
 
bool hasChild (const char *tag) const
 Check the existence of a child with a given tag name. More...
 
Handle_t child (const char *tag, bool throw_exception=true) const
 Access a single child by its tag name (unicode) More...
 
NodeList children (const char *tag) const
 Access a group of children identified by the same tag name. More...
 
size_t numChildren (const char *tag, bool throw_exception) const
 Access the number of children of this DOM element with a given tag name. More...
 
template<>
INLINE Attribute attr (const char *tag_value) const
 
template<>
INLINE const char * attr (const char *tag_value) const
 
template<>
INLINE bool attr (const char *tag_value) const
 
template<>
INLINE int attr (const char *tag_value) const
 
template<>
INLINE long attr (const char *tag_value) const
 
template<>
INLINE float attr (const char *tag_value) const
 
template<>
INLINE double attr (const char *tag_value) const
 

Public Attributes

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

Detailed Description

Class to easily access the properties of single JsonElements.

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 135 of file Elements.h.

Member Typedef Documentation

◆ Elt_t

Definition at line 138 of file Elements.h.

Constructor & Destructor Documentation

◆ Handle_t()

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

Initializing constructor.

Definition at line 144 of file Elements.h.

Member Function Documentation

◆ attr() [1/9]

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

Access typed attribute value by the JsonAttr.

Definition at line 183 of file Elements.h.

◆ attr() [2/9]

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

Access typed attribute value by its unicode name.

◆ attr() [3/9]

template<>
INLINE Attribute dd4hep::json::Handle_t::attr ( const char *  tag_value) const

Definition at line 201 of file Elements.h.

◆ attr() [4/9]

template<>
INLINE const char* dd4hep::json::Handle_t::attr ( const char *  tag_value) const

Definition at line 205 of file Elements.h.

◆ attr() [5/9]

template<>
INLINE bool dd4hep::json::Handle_t::attr ( const char *  tag_value) const

Definition at line 209 of file Elements.h.

◆ attr() [6/9]

template<>
INLINE int dd4hep::json::Handle_t::attr ( const char *  tag_value) const

Definition at line 213 of file Elements.h.

◆ attr() [7/9]

template<>
INLINE long dd4hep::json::Handle_t::attr ( const char *  tag_value) const

Definition at line 217 of file Elements.h.

◆ attr() [8/9]

template<>
INLINE float dd4hep::json::Handle_t::attr ( const char *  tag_value) const

Definition at line 221 of file Elements.h.

◆ attr() [9/9]

template<>
INLINE double dd4hep::json::Handle_t::attr ( const char *  tag_value) const

Definition at line 225 of file Elements.h.

◆ attr_name()

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

Access attribute name (throws exception if not present)

Definition at line 331 of file Elements.cpp.

◆ attr_nothrow()

Attribute Handle_t::attr_nothrow ( const char *  tag) const

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

Definition at line 261 of file Elements.cpp.

◆ attr_ptr()

Attribute Handle_t::attr_ptr ( const char *  attr) const

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

Definition at line 318 of file Elements.cpp.

◆ attr_value() [1/2]

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

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

Definition at line 344 of file Elements.cpp.

◆ attr_value() [2/2]

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

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

Definition at line 339 of file Elements.cpp.

◆ attr_value_nothrow()

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

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

Definition at line 349 of file Elements.cpp.

◆ attributes()

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

Retrieve a collection of all attributes of this DOM element.

Definition at line 271 of file Elements.cpp.

◆ child()

Handle_t Handle_t::child ( const char *  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 297 of file Elements.cpp.

◆ children()

NodeList Handle_t::children ( const char *  tag) const

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

Definition at line 309 of file Elements.cpp.

◆ hasAttr()

bool Handle_t::hasAttr ( const char *  t) const

Check for the existence of a named attribute.

Definition at line 266 of file Elements.cpp.

◆ hasChild()

bool Handle_t::hasChild ( const char *  tag) const

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

Definition at line 313 of file Elements.cpp.

◆ numChildren()

size_t Handle_t::numChildren ( const char *  tag,
bool  throw_exception 
) const

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

Definition at line 282 of file Elements.cpp.

◆ operator Elt_t()

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

Direct access to the JsonElement by dereferencing.

Definition at line 148 of file Elements.h.

◆ operator->()

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

Direct access to the JsonElement using the operator->

Definition at line 146 of file Elements.h.

◆ ptr()

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

Direct access to the JsonElement by function.

Definition at line 150 of file Elements.h.

◆ rawTag()

const char * Handle_t::rawTag ( ) const

Unicode text access to the element's tag.

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

Definition at line 246 of file Elements.cpp.

◆ rawText()

const char * Handle_t::rawText ( ) const

Unicode text access to the element's text.

Definition at line 251 of file Elements.cpp.

◆ rawValue()

const char * Handle_t::rawValue ( ) const

Unicode text access to the element's value.

Definition at line 256 of file Elements.cpp.

◆ tag()

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

Text access to the element's tag.

Definition at line 158 of file Elements.h.

◆ text()

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

Text access to the element's text.

Definition at line 160 of file Elements.h.

◆ value()

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

Text access to the element's value.

Definition at line 162 of file Elements.h.

Member Data Documentation

◆ m_node

Elt_t dd4hep::json::Handle_t::m_node
mutable

The pointer to the JsonElement.

Definition at line 141 of file Elements.h.


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