ReactOS 0.4.15-dev-7681-g776c3a3
tinyxml2::XMLAttribute Class Reference

#include <tinyxml2.h>

Collaboration diagram for tinyxml2::XMLAttribute:

Public Member Functions

const charName () const
 The name of the attribute.
 
const charValue () const
 The value of the attribute.
 
const XMLAttributeNext () const
 The next attribute in the list.
 
int IntValue () const
 
unsigned UnsignedValue () const
 Query as an unsigned integer. See IntValue()
 
bool BoolValue () const
 Query as a boolean. See IntValue()
 
double DoubleValue () const
 Query as a double. See IntValue()
 
float FloatValue () const
 Query as a float. See IntValue()
 
XMLError QueryIntValue (int *value) const
 
XMLError QueryUnsignedValue (unsigned int *value) const
 See QueryIntValue.
 
XMLError QueryBoolValue (bool *value) const
 See QueryIntValue.
 
XMLError QueryDoubleValue (double *value) const
 See QueryIntValue.
 
XMLError QueryFloatValue (float *value) const
 See QueryIntValue.
 
void SetAttribute (const char *value)
 Set the attribute to a string value.
 
void SetAttribute (int value)
 Set the attribute to value.
 
void SetAttribute (unsigned value)
 Set the attribute to value.
 
void SetAttribute (bool value)
 Set the attribute to value.
 
void SetAttribute (double value)
 Set the attribute to value.
 
void SetAttribute (float value)
 Set the attribute to value.
 

Private Types

enum  { BUF_SIZE = 200 }
 

Private Member Functions

 XMLAttribute ()
 
virtual ~XMLAttribute ()
 
 XMLAttribute (const XMLAttribute &)
 
void operator= (const XMLAttribute &)
 
void SetName (const char *name)
 
charParseDeep (char *p, bool processEntities)
 

Private Attributes

StrPair _name
 
StrPair _value
 
XMLAttribute_next
 
MemPool_memPool
 

Friends

class XMLElement
 

Detailed Description

An attribute is a name-value pair. Elements have an arbitrary number of attributes, each with a unique name.

Note
The attributes are not XMLNodes. You may only query the Next() attribute in a list.

Definition at line 1044 of file tinyxml2.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
BUF_SIZE 

Definition at line 1121 of file tinyxml2.h.

1121{ BUF_SIZE = 200 };

Constructor & Destructor Documentation

◆ XMLAttribute() [1/2]

tinyxml2::XMLAttribute::XMLAttribute ( )
inlineprivate

Definition at line 1123 of file tinyxml2.h.

1123: _next( 0 ), _memPool( 0 ) {}
XMLAttribute * _next
Definition: tinyxml2.h:1134

◆ ~XMLAttribute()

virtual tinyxml2::XMLAttribute::~XMLAttribute ( )
inlineprivatevirtual

Definition at line 1124 of file tinyxml2.h.

1124{}

◆ XMLAttribute() [2/2]

tinyxml2::XMLAttribute::XMLAttribute ( const XMLAttribute )
private

Member Function Documentation

◆ BoolValue()

bool tinyxml2::XMLAttribute::BoolValue ( ) const
inline

Query as a boolean. See IntValue()

Definition at line 1075 of file tinyxml2.h.

1075 {
1076 bool b=false;
1077 QueryBoolValue( &b );
1078 return b;
1079 }
XMLError QueryBoolValue(bool *value) const
See QueryIntValue.
Definition: tinyxml2.cpp:1304
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define b
Definition: ke_i.h:79

◆ DoubleValue()

double tinyxml2::XMLAttribute::DoubleValue ( ) const
inline

Query as a double. See IntValue()

Definition at line 1081 of file tinyxml2.h.

1081 {
1082 double d=0;
1083 QueryDoubleValue( &d );
1084 return d;
1085 }
XMLError QueryDoubleValue(double *value) const
See QueryIntValue.
Definition: tinyxml2.cpp:1322
#define d
Definition: ke_i.h:81

◆ FloatValue()

float tinyxml2::XMLAttribute::FloatValue ( ) const
inline

Query as a float. See IntValue()

Definition at line 1087 of file tinyxml2.h.

1087 {
1088 float f=0;
1089 QueryFloatValue( &f );
1090 return f;
1091 }
XMLError QueryFloatValue(float *value) const
See QueryIntValue.
Definition: tinyxml2.cpp:1313
GLfloat f
Definition: glext.h:7540
#define f
Definition: ke_i.h:83

◆ IntValue()

int tinyxml2::XMLAttribute::IntValue ( ) const
inline

IntValue interprets the attribute as an integer, and returns the value. If the value isn't an integer, 0 will be returned. There is no error checking; use QueryIntValue() if you need error checking.

Definition at line 1063 of file tinyxml2.h.

1063 {
1064 int i=0;
1065 QueryIntValue( &i );
1066 return i;
1067 }
XMLError QueryIntValue(int *value) const
Definition: tinyxml2.cpp:1286
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248

◆ Name()

const char * tinyxml2::XMLAttribute::Name ( ) const

The name of the attribute.

Definition at line 1242 of file tinyxml2.cpp.

1243{
1244 return _name.GetStr();
1245}
const char * GetStr()
Definition: tinyxml2.cpp:260

Referenced by tinyxml2::XMLElement::FindOrCreateAttribute(), and tinyxml2::XMLElement::ParseAttributes().

◆ Next()

const XMLAttribute * tinyxml2::XMLAttribute::Next ( ) const
inline

The next attribute in the list.

Definition at line 1055 of file tinyxml2.h.

1055 {
1056 return _next;
1057 }

◆ operator=()

void tinyxml2::XMLAttribute::operator= ( const XMLAttribute )
private

◆ ParseDeep()

char * tinyxml2::XMLAttribute::ParseDeep ( char p,
bool  processEntities 
)
private

Definition at line 1252 of file tinyxml2.cpp.

1253{
1254 // Parse using the name rules: bug fix, was using ParseText before
1255 p = _name.ParseName( p );
1256 if ( !p || !*p ) {
1257 return 0;
1258 }
1259
1260 // Skip white space before =
1262 if ( *p != '=' ) {
1263 return 0;
1264 }
1265
1266 ++p; // move up to opening quote
1268 if ( *p != '\"' && *p != '\'' ) {
1269 return 0;
1270 }
1271
1272 char endTag[2] = { *p, 0 };
1273 ++p; // move past opening quote
1274
1276 return p;
1277}
@ ATTRIBUTE_VALUE_LEAVE_ENTITIES
Definition: tinyxml2.h:128
char * ParseName(char *in)
Definition: tinyxml2.cpp:211
char * ParseText(char *in, const char *endTag, int strFlags)
Definition: tinyxml2.cpp:191
static const char * SkipWhiteSpace(const char *p)
Definition: tinyxml2.h:519
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by tinyxml2::XMLElement::ParseAttributes().

◆ QueryBoolValue()

XMLError tinyxml2::XMLAttribute::QueryBoolValue ( bool value) const

See QueryIntValue.

Definition at line 1304 of file tinyxml2.cpp.

1305{
1306 if ( XMLUtil::ToBool( Value(), value )) {
1307 return XML_NO_ERROR;
1308 }
1310}
const char * Value() const
The value of the attribute.
Definition: tinyxml2.cpp:1247
static bool ToBool(const char *str, bool *value)
Definition: tinyxml2.cpp:575
@ XML_NO_ERROR
Definition: tinyxml2.h:488
@ XML_WRONG_ATTRIBUTE_TYPE
Definition: tinyxml2.h:490
Definition: pdh_main.c:94

◆ QueryDoubleValue()

XMLError tinyxml2::XMLAttribute::QueryDoubleValue ( double value) const

See QueryIntValue.

Definition at line 1322 of file tinyxml2.cpp.

1323{
1324 if ( XMLUtil::ToDouble( Value(), value )) {
1325 return XML_NO_ERROR;
1326 }
1328}
static bool ToDouble(const char *str, double *value)
Definition: tinyxml2.cpp:602

◆ QueryFloatValue()

XMLError tinyxml2::XMLAttribute::QueryFloatValue ( float value) const

See QueryIntValue.

Definition at line 1313 of file tinyxml2.cpp.

1314{
1315 if ( XMLUtil::ToFloat( Value(), value )) {
1316 return XML_NO_ERROR;
1317 }
1319}
static bool ToFloat(const char *str, float *value)
Definition: tinyxml2.cpp:594

◆ QueryIntValue()

XMLError tinyxml2::XMLAttribute::QueryIntValue ( int value) const

QueryIntValue interprets the attribute as an integer, and returns the value in the provided parameter. The function will return XML_NO_ERROR on success, and XML_WRONG_ATTRIBUTE_TYPE if the conversion is not successful.

Definition at line 1286 of file tinyxml2.cpp.

1287{
1288 if ( XMLUtil::ToInt( Value(), value )) {
1289 return XML_NO_ERROR;
1290 }
1292}
static bool ToInt(const char *str, int *value)
Definition: tinyxml2.cpp:559

◆ QueryUnsignedValue()

XMLError tinyxml2::XMLAttribute::QueryUnsignedValue ( unsigned int value) const

See QueryIntValue.

Definition at line 1295 of file tinyxml2.cpp.

1296{
1297 if ( XMLUtil::ToUnsigned( Value(), value )) {
1298 return XML_NO_ERROR;
1299 }
1301}
static bool ToUnsigned(const char *str, unsigned *value)
Definition: tinyxml2.cpp:567

◆ SetAttribute() [1/6]

void tinyxml2::XMLAttribute::SetAttribute ( bool  value)

Set the attribute to value.

Definition at line 1353 of file tinyxml2.cpp.

1354{
1355 char buf[BUF_SIZE];
1357 _value.SetStr( buf );
1358}
void SetStr(const char *str, int flags=0)
Definition: tinyxml2.cpp:178
static void ToStr(int v, char *buffer, int bufferSize)
Definition: tinyxml2.cpp:526
const GLdouble * v
Definition: gl.h:2040
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751

◆ SetAttribute() [2/6]

void tinyxml2::XMLAttribute::SetAttribute ( const char value)

Set the attribute to a string value.

Definition at line 1331 of file tinyxml2.cpp.

1332{
1333 _value.SetStr( v );
1334}

◆ SetAttribute() [3/6]

void tinyxml2::XMLAttribute::SetAttribute ( double  value)

Set the attribute to value.

Definition at line 1360 of file tinyxml2.cpp.

1361{
1362 char buf[BUF_SIZE];
1364 _value.SetStr( buf );
1365}

◆ SetAttribute() [4/6]

void tinyxml2::XMLAttribute::SetAttribute ( float  value)

Set the attribute to value.

Definition at line 1367 of file tinyxml2.cpp.

1368{
1369 char buf[BUF_SIZE];
1371 _value.SetStr( buf );
1372}

◆ SetAttribute() [5/6]

void tinyxml2::XMLAttribute::SetAttribute ( int  value)

Set the attribute to value.

Definition at line 1337 of file tinyxml2.cpp.

1338{
1339 char buf[BUF_SIZE];
1341 _value.SetStr( buf );
1342}

◆ SetAttribute() [6/6]

void tinyxml2::XMLAttribute::SetAttribute ( unsigned  value)

Set the attribute to value.

Definition at line 1345 of file tinyxml2.cpp.

1346{
1347 char buf[BUF_SIZE];
1349 _value.SetStr( buf );
1350}

◆ SetName()

void tinyxml2::XMLAttribute::SetName ( const char name)
private

Definition at line 1280 of file tinyxml2.cpp.

1281{
1282 _name.SetStr( n );
1283}
GLdouble n
Definition: glext.h:7729

Referenced by tinyxml2::XMLElement::FindOrCreateAttribute().

◆ UnsignedValue()

unsigned tinyxml2::XMLAttribute::UnsignedValue ( ) const
inline

Query as an unsigned integer. See IntValue()

Definition at line 1069 of file tinyxml2.h.

1069 {
1070 unsigned i=0;
1072 return i;
1073 }
XMLError QueryUnsignedValue(unsigned int *value) const
See QueryIntValue.
Definition: tinyxml2.cpp:1295

◆ Value()

const char * tinyxml2::XMLAttribute::Value ( ) const

The value of the attribute.

Definition at line 1247 of file tinyxml2.cpp.

1248{
1249 return _value.GetStr();
1250}

Referenced by QueryBoolValue(), QueryDoubleValue(), QueryFloatValue(), QueryIntValue(), and QueryUnsignedValue().

Friends And Related Function Documentation

◆ XMLElement

friend class XMLElement
friend

Definition at line 1046 of file tinyxml2.h.

Member Data Documentation

◆ _memPool

MemPool* tinyxml2::XMLAttribute::_memPool
private

◆ _name

StrPair tinyxml2::XMLAttribute::_name
mutableprivate

Definition at line 1132 of file tinyxml2.h.

Referenced by Name(), ParseDeep(), and SetName().

◆ _next

◆ _value

StrPair tinyxml2::XMLAttribute::_value
mutableprivate

Definition at line 1133 of file tinyxml2.h.

Referenced by ParseDeep(), SetAttribute(), and Value().


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