Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
pugi::xpath_variable_set Class Reference

#include <pugixml.hpp>

Public Member Functions

 xpath_variable_set ()
 ~xpath_variable_set ()
 xpath_variable_set (const xpath_variable_set &rhs)
xpath_variable_setoperator= (const xpath_variable_set &rhs)
xpath_variable * add (const char_t *name, xpath_value_type type)
bool set (const char_t *name, bool value)
bool set (const char_t *name, double value)
bool set (const char_t *name, const char_t *value)
bool set (const char_t *name, const xpath_node_set &value)
xpath_variable * get (const char_t *name)
const xpath_variable * get (const char_t *name) const

Detailed Description

Definition at line 1173 of file pugixml.hpp.

Constructor & Destructor Documentation

◆ xpath_variable_set() [1/2]

PUGI__FN pugi::xpath_variable_set::xpath_variable_set ( )

Definition at line 12630 of file pugixml.cc.

12631 {
12632 for (size_t i = 0; i < sizeof(_data) / sizeof(_data[0]); ++i)
12633 _data[i] = 0;
12634 }

Referenced by operator=(), and xpath_variable_set().

◆ ~xpath_variable_set()

PUGI__FN pugi::xpath_variable_set::~xpath_variable_set ( )

Definition at line 12636 of file pugixml.cc.

12637 {
12638 for (size_t i = 0; i < sizeof(_data) / sizeof(_data[0]); ++i)
12639 _destroy(_data[i]);
12640 }

◆ xpath_variable_set() [2/2]

PUGI__FN pugi::xpath_variable_set::xpath_variable_set ( const xpath_variable_set & rhs)

Definition at line 12642 of file pugixml.cc.

12643 {
12644 for (size_t i = 0; i < sizeof(_data) / sizeof(_data[0]); ++i)
12645 _data[i] = 0;
12646
12647 _assign(rhs);
12648 }

Member Function Documentation

◆ add()

PUGI__FN xpath_variable * pugi::xpath_variable_set::add ( const char_t * name,
xpath_value_type type )

Definition at line 12757 of file pugixml.cc.

12758 {
12759 const size_t hash_size = sizeof(_data) / sizeof(_data[0]);
12760 size_t hash = impl::hash_string(name) % hash_size;
12761
12762 // look for existing variable
12763 for (xpath_variable* var = _data[hash]; var; var = var->_next)
12764 if (impl::strequal(var->name(), name))
12765 return var->type() == type ? var : 0;
12766
12767 // add new variable
12768 xpath_variable* result = impl::new_xpath_variable(type, name);
12769
12770 if (result)
12771 {
12772 result->_next = _data[hash];
12773
12774 _data[hash] = result;
12775 }
12776
12777 return result;
12778 }

Referenced by set(), set(), set(), and set().

◆ get() [1/2]

PUGI__FN xpath_variable * pugi::xpath_variable_set::get ( const char_t * name)

Definition at line 12804 of file pugixml.cc.

12805 {
12806 return _find(name);
12807 }

◆ get() [2/2]

PUGI__FN const xpath_variable * pugi::xpath_variable_set::get ( const char_t * name) const

Definition at line 12809 of file pugixml.cc.

12810 {
12811 return _find(name);
12812 }

◆ operator=()

PUGI__FN xpath_variable_set & pugi::xpath_variable_set::operator= ( const xpath_variable_set & rhs)

Definition at line 12650 of file pugixml.cc.

12651 {
12652 if (this == &rhs) return *this;
12653
12654 _assign(rhs);
12655
12656 return *this;
12657 }

◆ set() [1/4]

PUGI__FN bool pugi::xpath_variable_set::set ( const char_t * name,
bool value )

Definition at line 12780 of file pugixml.cc.

12781 {
12782 xpath_variable* var = add(name, xpath_type_boolean);
12783 return var ? var->set(value) : false;
12784 }
xpath_variable * add(const char_t *name, xpath_value_type type)
Definition pugixml.cc:12757
@ xpath_type_boolean
Definition pugixml.hpp:1115

◆ set() [2/4]

PUGI__FN bool pugi::xpath_variable_set::set ( const char_t * name,
const char_t * value )

Definition at line 12792 of file pugixml.cc.

12793 {
12794 xpath_variable* var = add(name, xpath_type_string);
12795 return var ? var->set(value) : false;
12796 }
@ xpath_type_string
Definition pugixml.hpp:1114

◆ set() [3/4]

PUGI__FN bool pugi::xpath_variable_set::set ( const char_t * name,
const xpath_node_set & value )

Definition at line 12798 of file pugixml.cc.

12799 {
12800 xpath_variable* var = add(name, xpath_type_node_set);
12801 return var ? var->set(value) : false;
12802 }
@ xpath_type_node_set
Definition pugixml.hpp:1112

◆ set() [4/4]

PUGI__FN bool pugi::xpath_variable_set::set ( const char_t * name,
double value )

Definition at line 12786 of file pugixml.cc.

12787 {
12788 xpath_variable* var = add(name, xpath_type_number);
12789 return var ? var->set(value) : false;
12790 }
@ xpath_type_number
Definition pugixml.hpp:1113

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