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

#include <pugixml.hpp>

Public Member Functions

 xml_attribute ()
 xml_attribute (xml_attribute_struct *attr)
 operator unspecified_bool_type () const
bool operator! () const
bool operator== (const xml_attribute &r) const
bool operator!= (const xml_attribute &r) const
bool operator< (const xml_attribute &r) const
bool operator> (const xml_attribute &r) const
bool operator<= (const xml_attribute &r) const
bool operator>= (const xml_attribute &r) const
bool empty () const
const char_tname () const
const char_tvalue () const
const char_tas_string (const char_t *def=PUGIXML_TEXT("")) const
int as_int (int def=0) const
unsigned int as_uint (unsigned int def=0) const
double as_double (double def=0) const
float as_float (float def=0) const
bool as_bool (bool def=false) const
bool set_name (const char_t *rhs)
bool set_value (const char_t *rhs, size_t sz)
bool set_value (const char_t *rhs)
bool set_value (int rhs)
bool set_value (unsigned int rhs)
bool set_value (long rhs)
bool set_value (unsigned long rhs)
bool set_value (double rhs)
bool set_value (double rhs, int precision)
bool set_value (float rhs)
bool set_value (float rhs, int precision)
bool set_value (bool rhs)
xml_attributeoperator= (const char_t *rhs)
xml_attributeoperator= (int rhs)
xml_attributeoperator= (unsigned int rhs)
xml_attributeoperator= (long rhs)
xml_attributeoperator= (unsigned long rhs)
xml_attributeoperator= (double rhs)
xml_attributeoperator= (float rhs)
xml_attributeoperator= (bool rhs)
xml_attribute next_attribute () const
xml_attribute previous_attribute () const
size_t hash_value () const
xml_attribute_structinternal_object () const

Friends

class xml_attribute_iterator
class xml_node

Detailed Description

Definition at line 364 of file pugixml.hpp.

Constructor & Destructor Documentation

◆ xml_attribute() [1/2]

PUGI__FN pugi::xml_attribute::xml_attribute ( )

◆ xml_attribute() [2/2]

PUGI__FN pugi::xml_attribute::xml_attribute ( xml_attribute_struct * attr)
explicit

Definition at line 5158 of file pugixml.cc.

5158 : _attr(attr)
5159 {
5160 }

Member Function Documentation

◆ as_bool()

PUGI__FN bool pugi::xml_attribute::as_bool ( bool def = false) const

Definition at line 5254 of file pugixml.cc.

5255 {
5256 if (!_attr) return def;
5257 const char_t* value = _attr->value;
5258 return value ? impl::get_value_bool(value) : def;
5259 }
const char_t * value() const
Definition pugixml.cc:5289
PUGIXML_CHAR char_t
Definition pugixml.hpp:137

Referenced by xml_node.

◆ as_double()

PUGI__FN double pugi::xml_attribute::as_double ( double def = 0) const

Definition at line 5240 of file pugixml.cc.

5241 {
5242 if (!_attr) return def;
5243 const char_t* value = _attr->value;
5244 return value ? impl::get_value_double(value) : def;
5245 }

Referenced by xml_node.

◆ as_float()

PUGI__FN float pugi::xml_attribute::as_float ( float def = 0) const

Definition at line 5247 of file pugixml.cc.

5248 {
5249 if (!_attr) return def;
5250 const char_t* value = _attr->value;
5251 return value ? impl::get_value_float(value) : def;
5252 }

Referenced by xml_node.

◆ as_int()

PUGI__FN int pugi::xml_attribute::as_int ( int def = 0) const

Definition at line 5226 of file pugixml.cc.

5227 {
5228 if (!_attr) return def;
5229 const char_t* value = _attr->value;
5230 return value ? impl::get_value_int(value) : def;
5231 }

Referenced by xml_node.

◆ as_string()

PUGI__FN const char_t * pugi::xml_attribute::as_string ( const char_t * def = PUGIXML_TEXT("")) const

Definition at line 5219 of file pugixml.cc.

5220 {
5221 if (!_attr) return def;
5222 const char_t* value = _attr->value;
5223 return value ? value : def;
5224 }

Referenced by xml_node.

◆ as_uint()

PUGI__FN unsigned int pugi::xml_attribute::as_uint ( unsigned int def = 0) const

Definition at line 5233 of file pugixml.cc.

5234 {
5235 if (!_attr) return def;
5236 const char_t* value = _attr->value;
5237 return value ? impl::get_value_uint(value) : def;
5238 }

Referenced by xml_node.

◆ empty()

PUGI__FN bool pugi::xml_attribute::empty ( ) const

Definition at line 5277 of file pugixml.cc.

5278 {
5279 return !_attr;
5280 }

Referenced by xml_node.

◆ hash_value()

PUGI__FN size_t pugi::xml_attribute::hash_value ( ) const

Definition at line 5296 of file pugixml.cc.

5297 {
5298 return static_cast<size_t>(reinterpret_cast<uintptr_t>(_attr) / sizeof(xml_attribute_struct));
5299 }

Referenced by xml_node.

◆ internal_object()

PUGI__FN xml_attribute_struct * pugi::xml_attribute::internal_object ( ) const

Definition at line 5301 of file pugixml.cc.

5302 {
5303 return _attr;
5304 }

Referenced by xml_node.

◆ name()

PUGI__FN const char_t * pugi::xml_attribute::name ( ) const

Definition at line 5282 of file pugixml.cc.

5283 {
5284 if (!_attr) return PUGIXML_TEXT("");
5285 const char_t* name = _attr->name;
5286 return name ? name : PUGIXML_TEXT("");
5287 }
const char_t * name() const
Definition pugixml.cc:5282
#define PUGIXML_TEXT(t)
Definition pugixml.hpp:130

Referenced by name(), and xml_node.

◆ next_attribute()

PUGI__FN xml_attribute pugi::xml_attribute::next_attribute ( ) const

Definition at line 5206 of file pugixml.cc.

5207 {
5208 if (!_attr) return xml_attribute();
5209 return xml_attribute(_attr->next_attribute);
5210 }

Referenced by xml_node.

◆ operator unspecified_bool_type()

PUGI__FN pugi::xml_attribute::operator xml_attribute::unspecified_bool_type ( ) const

Definition at line 5166 of file pugixml.cc.

5167 {
5168 return _attr ? unspecified_bool_xml_attribute : 0;
5169 }

◆ operator!()

PUGI__FN bool pugi::xml_attribute::operator! ( ) const

Definition at line 5171 of file pugixml.cc.

5172 {
5173 return !_attr;
5174 }

Referenced by xml_node.

◆ operator!=()

Definition at line 5181 of file pugixml.cc.

5182 {
5183 return (_attr != r._attr);
5184 }

◆ operator<()

PUGI__FN bool pugi::xml_attribute::operator< ( const xml_attribute & r) const

Definition at line 5186 of file pugixml.cc.

5187 {
5188 return (_attr < r._attr);
5189 }

Referenced by xml_node.

◆ operator<=()

PUGI__FN bool pugi::xml_attribute::operator<= ( const xml_attribute & r) const

Definition at line 5196 of file pugixml.cc.

5197 {
5198 return (_attr <= r._attr);
5199 }

Referenced by xml_node.

◆ operator=() [1/8]

PUGI__FN xml_attribute & pugi::xml_attribute::operator= ( bool rhs)

Definition at line 5348 of file pugixml.cc.

5349 {
5350 set_value(rhs);
5351 return *this;
5352 }
bool set_value(const char_t *rhs, size_t sz)
Definition pugixml.cc:5375

◆ operator=() [2/8]

PUGI__FN xml_attribute & pugi::xml_attribute::operator= ( const char_t * rhs)

Definition at line 5306 of file pugixml.cc.

5307 {
5308 set_value(rhs);
5309 return *this;
5310 }

◆ operator=() [3/8]

PUGI__FN xml_attribute & pugi::xml_attribute::operator= ( double rhs)

Definition at line 5336 of file pugixml.cc.

5337 {
5338 set_value(rhs);
5339 return *this;
5340 }

◆ operator=() [4/8]

PUGI__FN xml_attribute & pugi::xml_attribute::operator= ( float rhs)

Definition at line 5342 of file pugixml.cc.

5343 {
5344 set_value(rhs);
5345 return *this;
5346 }

◆ operator=() [5/8]

PUGI__FN xml_attribute & pugi::xml_attribute::operator= ( int rhs)

Definition at line 5312 of file pugixml.cc.

5313 {
5314 set_value(rhs);
5315 return *this;
5316 }

◆ operator=() [6/8]

PUGI__FN xml_attribute & pugi::xml_attribute::operator= ( long rhs)

Definition at line 5324 of file pugixml.cc.

5325 {
5326 set_value(rhs);
5327 return *this;
5328 }

◆ operator=() [7/8]

PUGI__FN xml_attribute & pugi::xml_attribute::operator= ( unsigned int rhs)

Definition at line 5318 of file pugixml.cc.

5319 {
5320 set_value(rhs);
5321 return *this;
5322 }

◆ operator=() [8/8]

PUGI__FN xml_attribute & pugi::xml_attribute::operator= ( unsigned long rhs)

Definition at line 5330 of file pugixml.cc.

5331 {
5332 set_value(rhs);
5333 return *this;
5334 }

◆ operator==()

PUGI__FN bool pugi::xml_attribute::operator== ( const xml_attribute & r) const

Definition at line 5176 of file pugixml.cc.

5177 {
5178 return (_attr == r._attr);
5179 }

◆ operator>()

PUGI__FN bool pugi::xml_attribute::operator> ( const xml_attribute & r) const

Definition at line 5191 of file pugixml.cc.

5192 {
5193 return (_attr > r._attr);
5194 }

Referenced by xml_node.

◆ operator>=()

PUGI__FN bool pugi::xml_attribute::operator>= ( const xml_attribute & r) const

Definition at line 5201 of file pugixml.cc.

5202 {
5203 return (_attr >= r._attr);
5204 }

Referenced by xml_node.

◆ previous_attribute()

PUGI__FN xml_attribute pugi::xml_attribute::previous_attribute ( ) const

Definition at line 5212 of file pugixml.cc.

5213 {
5214 if (!_attr) return xml_attribute();
5215 xml_attribute_struct* prev = _attr->prev_attribute_c;
5216 return prev->next_attribute ? xml_attribute(prev) : xml_attribute();
5217 }

Referenced by xml_node.

◆ set_name()

PUGI__FN bool pugi::xml_attribute::set_name ( const char_t * rhs)

Definition at line 5368 of file pugixml.cc.

5369 {
5370 if (!_attr) return false;
5371
5372 return impl::strcpy_insitu(_attr->name, _attr->header, impl::xml_memory_page_name_allocated_mask, rhs, impl::strlength(rhs));
5373 }

Referenced by pugi::xml_node::append_attribute(), pugi::xml_node::insert_attribute_after(), pugi::xml_node::insert_attribute_before(), pugi::xml_node::prepend_attribute(), and xml_node.

◆ set_value() [1/11]

PUGI__FN bool pugi::xml_attribute::set_value ( bool rhs)

Definition at line 5445 of file pugixml.cc.

5446 {
5447 if (!_attr) return false;
5448
5449 return impl::set_value_bool(_attr->value, _attr->header, impl::xml_memory_page_value_allocated_mask, rhs);
5450 }

◆ set_value() [2/11]

PUGI__FN bool pugi::xml_attribute::set_value ( const char_t * rhs)

Definition at line 5382 of file pugixml.cc.

5383 {
5384 if (!_attr) return false;
5385
5386 return impl::strcpy_insitu(_attr->value, _attr->header, impl::xml_memory_page_value_allocated_mask, rhs, impl::strlength(rhs));
5387 }

◆ set_value() [3/11]

PUGI__FN bool pugi::xml_attribute::set_value ( const char_t * rhs,
size_t sz )

Definition at line 5375 of file pugixml.cc.

5376 {
5377 if (!_attr) return false;
5378
5379 return impl::strcpy_insitu(_attr->value, _attr->header, impl::xml_memory_page_value_allocated_mask, rhs, sz);
5380 }

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

◆ set_value() [4/11]

PUGI__FN bool pugi::xml_attribute::set_value ( double rhs)

Definition at line 5417 of file pugixml.cc.

5418 {
5419 if (!_attr) return false;
5420
5421 return impl::set_value_convert(_attr->value, _attr->header, impl::xml_memory_page_value_allocated_mask, rhs, default_double_precision);
5422 }
const int default_double_precision
Definition pugixml.hpp:277

◆ set_value() [5/11]

PUGI__FN bool pugi::xml_attribute::set_value ( double rhs,
int precision )

Definition at line 5424 of file pugixml.cc.

5425 {
5426 if (!_attr) return false;
5427
5428 return impl::set_value_convert(_attr->value, _attr->header, impl::xml_memory_page_value_allocated_mask, rhs, precision);
5429 }

◆ set_value() [6/11]

PUGI__FN bool pugi::xml_attribute::set_value ( float rhs)

Definition at line 5431 of file pugixml.cc.

5432 {
5433 if (!_attr) return false;
5434
5435 return impl::set_value_convert(_attr->value, _attr->header, impl::xml_memory_page_value_allocated_mask, rhs, default_float_precision);
5436 }
const int default_float_precision
Definition pugixml.hpp:278

◆ set_value() [7/11]

PUGI__FN bool pugi::xml_attribute::set_value ( float rhs,
int precision )

Definition at line 5438 of file pugixml.cc.

5439 {
5440 if (!_attr) return false;
5441
5442 return impl::set_value_convert(_attr->value, _attr->header, impl::xml_memory_page_value_allocated_mask, rhs, precision);
5443 }

◆ set_value() [8/11]

PUGI__FN bool pugi::xml_attribute::set_value ( int rhs)

Definition at line 5389 of file pugixml.cc.

5390 {
5391 if (!_attr) return false;
5392
5393 return impl::set_value_integer<unsigned int>(_attr->value, _attr->header, impl::xml_memory_page_value_allocated_mask, rhs, rhs < 0);
5394 }

◆ set_value() [9/11]

PUGI__FN bool pugi::xml_attribute::set_value ( long rhs)

Definition at line 5403 of file pugixml.cc.

5404 {
5405 if (!_attr) return false;
5406
5407 return impl::set_value_integer<unsigned long>(_attr->value, _attr->header, impl::xml_memory_page_value_allocated_mask, rhs, rhs < 0);
5408 }

◆ set_value() [10/11]

PUGI__FN bool pugi::xml_attribute::set_value ( unsigned int rhs)

Definition at line 5396 of file pugixml.cc.

5397 {
5398 if (!_attr) return false;
5399
5400 return impl::set_value_integer<unsigned int>(_attr->value, _attr->header, impl::xml_memory_page_value_allocated_mask, rhs, false);
5401 }

◆ set_value() [11/11]

PUGI__FN bool pugi::xml_attribute::set_value ( unsigned long rhs)

Definition at line 5410 of file pugixml.cc.

5411 {
5412 if (!_attr) return false;
5413
5414 return impl::set_value_integer<unsigned long>(_attr->value, _attr->header, impl::xml_memory_page_value_allocated_mask, rhs, false);
5415 }

◆ value()

PUGI__FN const char_t * pugi::xml_attribute::value ( ) const

Definition at line 5289 of file pugixml.cc.

5290 {
5291 if (!_attr) return PUGIXML_TEXT("");
5292 const char_t* value = _attr->value;
5293 return value ? value : PUGIXML_TEXT("");
5294 }

Referenced by as_bool(), as_double(), as_float(), as_int(), as_string(), as_uint(), value(), and xml_node.

◆ xml_attribute_iterator

friend class xml_attribute_iterator
friend

Definition at line 366 of file pugixml.hpp.

Referenced by xml_attribute_iterator.

◆ xml_node

friend class xml_node
friend

Definition at line 367 of file pugixml.hpp.

Referenced by xml_node.


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