antioch-0.4.0
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends
tinyxml2::XMLAttribute Class Reference

#include <tinyxml2.h>

Public Member Functions

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

Private Types

enum  { BUF_SIZE = 200 }
 

Private Member Functions

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

Private Attributes

StrPair name
 
StrPair value
 
XMLAttributenext
 
MemPoolmemPool
 

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 784 of file tinyxml2.h.

Member Enumeration Documentation

anonymous enum
private
Enumerator
BUF_SIZE 

Definition at line 834 of file tinyxml2.h.

Constructor & Destructor Documentation

tinyxml2::XMLAttribute::XMLAttribute ( )
inlineprivate

Definition at line 836 of file tinyxml2.h.

836 : next( 0 ) {}
XMLAttribute * next
Definition: tinyxml2.h:846
virtual tinyxml2::XMLAttribute::~XMLAttribute ( )
inlineprivatevirtual

Definition at line 837 of file tinyxml2.h.

837 {}
tinyxml2::XMLAttribute::XMLAttribute ( const XMLAttribute )
private

Member Function Documentation

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

Query as a boolean. See IntAttribute()

Definition at line 800 of file tinyxml2.h.

References QueryBoolValue().

800 { bool b=false; QueryBoolValue( &b ); return b; }
int QueryBoolValue(bool *value) const
See QueryIntAttribute.
double tinyxml2::XMLAttribute::DoubleValue ( ) const
inline

Query as a double. See IntAttribute()

Definition at line 802 of file tinyxml2.h.

References QueryDoubleValue().

802 { double d=0; QueryDoubleValue( &d ); return d; }
int QueryDoubleValue(double *value) const
See QueryIntAttribute.
float tinyxml2::XMLAttribute::FloatValue ( ) const
inline

Query as a float. See IntAttribute()

Definition at line 804 of file tinyxml2.h.

References QueryFloatValue().

804 { float f=0; QueryFloatValue( &f ); return f; }
int QueryFloatValue(float *value) const
See QueryIntAttribute.
int tinyxml2::XMLAttribute::IntValue ( ) const
inline

IntAttribute 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 QueryIntAttribute() if you need error checking.

Definition at line 796 of file tinyxml2.h.

References QueryIntValue().

796 { int i=0; QueryIntValue( &i ); return i; }
int QueryIntValue(int *value) const
const char* tinyxml2::XMLAttribute::Name ( ) const
inline
const XMLAttribute* tinyxml2::XMLAttribute::Next ( ) const
inline

The next attribute in the list.

Definition at line 790 of file tinyxml2.h.

References next.

Referenced by tinyxml2::XMLElement::ShallowClone(), tinyxml2::XMLElement::ShallowEqual(), and tinyxml2::XMLPrinter::VisitEnter().

void tinyxml2::XMLAttribute::operator= ( const XMLAttribute )
private
char * XMLAttribute::ParseDeep ( char *  p,
bool  processEntities 
)
inlineprivate

Definition at line 1090 of file tinyxml2_imp.h.

References tinyxml2::StrPair::ATTRIBUTE_VALUE, tinyxml2::StrPair::ATTRIBUTE_VALUE_LEAVE_ENTITIES, name, tinyxml2::StrPair::ParseName(), tinyxml2::StrPair::ParseText(), tinyxml2::XMLUtil::SkipWhiteSpace(), and value.

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

1091 {
1092  // Parse using the name rules: bug fix, was using ParseText before
1093  p = name.ParseName( p );
1094  if ( !p || !*p ) return 0;
1095 
1096  // Skip white space before =
1097  p = XMLUtil::SkipWhiteSpace( p );
1098  if ( !p || *p != '=' ) return 0;
1099 
1100  ++p; // move up to opening quote
1101  p = XMLUtil::SkipWhiteSpace( p );
1102  if ( *p != '\"' && *p != '\'' ) return 0;
1103 
1104  char endTag[2] = { *p, 0 };
1105  ++p; // move past opening quote
1106 
1108  return p;
1109 }
char * ParseText(char *in, const char *endTag, int strFlags)
Definition: tinyxml2_imp.h:120
char * ParseName(char *in)
Definition: tinyxml2_imp.h:141
static const char * SkipWhiteSpace(const char *p)
Definition: tinyxml2.h:380
int XMLAttribute::QueryBoolValue ( bool *  value) const
inline

See QueryIntAttribute.

Definition at line 1138 of file tinyxml2_imp.h.

References tinyxml2::XMLUtil::ToBool(), Value(), tinyxml2::XML_NO_ERROR, and tinyxml2::XML_WRONG_ATTRIBUTE_TYPE.

Referenced by BoolValue(), and tinyxml2::XMLElement::QueryBoolAttribute().

1139 {
1140  if ( XMLUtil::ToBool( Value(), value )) {
1141  return XML_NO_ERROR;
1142  }
1143  return XML_WRONG_ATTRIBUTE_TYPE;
1144 }
const char * Value() const
The value of the attribute.
Definition: tinyxml2.h:789
static bool ToBool(const char *str, bool *value)
Definition: tinyxml2_imp.h:466
int XMLAttribute::QueryDoubleValue ( double *  value) const
inline

See QueryIntAttribute.

Definition at line 1157 of file tinyxml2_imp.h.

References tinyxml2::XMLUtil::ToDouble(), Value(), tinyxml2::XML_NO_ERROR, and tinyxml2::XML_WRONG_ATTRIBUTE_TYPE.

Referenced by DoubleValue(), and tinyxml2::XMLElement::QueryDoubleAttribute().

1158 {
1159  if ( XMLUtil::ToDouble( Value(), value ))
1160  return XML_NO_ERROR;
1161  return XML_WRONG_ATTRIBUTE_TYPE;
1162 }
const char * Value() const
The value of the attribute.
Definition: tinyxml2.h:789
static bool ToDouble(const char *str, double *value)
Definition: tinyxml2_imp.h:495
int XMLAttribute::QueryFloatValue ( float *  value) const
inline

See QueryIntAttribute.

Definition at line 1148 of file tinyxml2_imp.h.

References tinyxml2::XMLUtil::ToFloat(), Value(), tinyxml2::XML_NO_ERROR, and tinyxml2::XML_WRONG_ATTRIBUTE_TYPE.

Referenced by FloatValue(), and tinyxml2::XMLElement::QueryFloatAttribute().

1149 {
1150  if ( XMLUtil::ToFloat( Value(), value ))
1151  return XML_NO_ERROR;
1152  return XML_WRONG_ATTRIBUTE_TYPE;
1153 }
static bool ToFloat(const char *str, float *value)
Definition: tinyxml2_imp.h:486
const char * Value() const
The value of the attribute.
Definition: tinyxml2.h:789
int XMLAttribute::QueryIntValue ( int *  value) const
inline

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

Definition at line 1120 of file tinyxml2_imp.h.

References tinyxml2::XMLUtil::ToInt(), Value(), tinyxml2::XML_NO_ERROR, and tinyxml2::XML_WRONG_ATTRIBUTE_TYPE.

Referenced by IntValue(), and tinyxml2::XMLElement::QueryIntAttribute().

1121 {
1122  if ( XMLUtil::ToInt( Value(), value ))
1123  return XML_NO_ERROR;
1124  return XML_WRONG_ATTRIBUTE_TYPE;
1125 }
const char * Value() const
The value of the attribute.
Definition: tinyxml2.h:789
static bool ToInt(const char *str, int *value)
Definition: tinyxml2_imp.h:450
int XMLAttribute::QueryUnsignedValue ( unsigned int *  value) const
inline

See QueryIntAttribute.

Definition at line 1129 of file tinyxml2_imp.h.

References tinyxml2::XMLUtil::ToUnsigned(), Value(), tinyxml2::XML_NO_ERROR, and tinyxml2::XML_WRONG_ATTRIBUTE_TYPE.

Referenced by tinyxml2::XMLElement::QueryUnsignedAttribute(), and UnsignedValue().

1130 {
1131  if ( XMLUtil::ToUnsigned( Value(), value ))
1132  return XML_NO_ERROR;
1133  return XML_WRONG_ATTRIBUTE_TYPE;
1134 }
const char * Value() const
The value of the attribute.
Definition: tinyxml2.h:789
static bool ToUnsigned(const char *str, unsigned *value)
Definition: tinyxml2_imp.h:458
void XMLAttribute::SetAttribute ( const char *  value)
inline

Set the attribute to a string value.

Definition at line 1166 of file tinyxml2_imp.h.

References tinyxml2::StrPair::SetStr(), and value.

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

1167 {
1168  value.SetStr( v );
1169 }
void SetStr(const char *str, int flags=0)
Definition: tinyxml2_imp.h:108
void XMLAttribute::SetAttribute ( int  value)
inline

Set the attribute to value.

Definition at line 1173 of file tinyxml2_imp.h.

References BUF_SIZE, tinyxml2::StrPair::SetStr(), tinyxml2::XMLUtil::ToStr(), and value.

1174 {
1175  char buf[BUF_SIZE];
1176  XMLUtil::ToStr( v, buf, BUF_SIZE );
1177  value.SetStr( buf );
1178 }
static void ToStr(int v, char *buffer, int bufferSize)
Definition: tinyxml2_imp.h:415
void SetStr(const char *str, int flags=0)
Definition: tinyxml2_imp.h:108
void XMLAttribute::SetAttribute ( unsigned  value)
inline

Set the attribute to value.

Definition at line 1182 of file tinyxml2_imp.h.

References BUF_SIZE, tinyxml2::StrPair::SetStr(), tinyxml2::XMLUtil::ToStr(), and value.

1183 {
1184  char buf[BUF_SIZE];
1185  XMLUtil::ToStr( v, buf, BUF_SIZE );
1186  value.SetStr( buf );
1187 }
static void ToStr(int v, char *buffer, int bufferSize)
Definition: tinyxml2_imp.h:415
void SetStr(const char *str, int flags=0)
Definition: tinyxml2_imp.h:108
void XMLAttribute::SetAttribute ( bool  value)
inline

Set the attribute to value.

Definition at line 1191 of file tinyxml2_imp.h.

References BUF_SIZE, tinyxml2::StrPair::SetStr(), tinyxml2::XMLUtil::ToStr(), and value.

1192 {
1193  char buf[BUF_SIZE];
1194  XMLUtil::ToStr( v, buf, BUF_SIZE );
1195  value.SetStr( buf );
1196 }
static void ToStr(int v, char *buffer, int bufferSize)
Definition: tinyxml2_imp.h:415
void SetStr(const char *str, int flags=0)
Definition: tinyxml2_imp.h:108
void XMLAttribute::SetAttribute ( double  value)
inline

Set the attribute to value.

Definition at line 1199 of file tinyxml2_imp.h.

References BUF_SIZE, tinyxml2::StrPair::SetStr(), tinyxml2::XMLUtil::ToStr(), and value.

1200 {
1201  char buf[BUF_SIZE];
1202  XMLUtil::ToStr( v, buf, BUF_SIZE );
1203  value.SetStr( buf );
1204 }
static void ToStr(int v, char *buffer, int bufferSize)
Definition: tinyxml2_imp.h:415
void SetStr(const char *str, int flags=0)
Definition: tinyxml2_imp.h:108
void XMLAttribute::SetAttribute ( float  value)
inline

Set the attribute to value.

Definition at line 1207 of file tinyxml2_imp.h.

References BUF_SIZE, tinyxml2::StrPair::SetStr(), tinyxml2::XMLUtil::ToStr(), and value.

1208 {
1209  char buf[BUF_SIZE];
1210  XMLUtil::ToStr( v, buf, BUF_SIZE );
1211  value.SetStr( buf );
1212 }
static void ToStr(int v, char *buffer, int bufferSize)
Definition: tinyxml2_imp.h:415
void SetStr(const char *str, int flags=0)
Definition: tinyxml2_imp.h:108
void XMLAttribute::SetName ( const char *  name)
inlineprivate

Definition at line 1113 of file tinyxml2_imp.h.

References name, and tinyxml2::StrPair::SetStr().

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

1114 {
1115  name.SetStr( n );
1116 }
void SetStr(const char *str, int flags=0)
Definition: tinyxml2_imp.h:108
unsigned tinyxml2::XMLAttribute::UnsignedValue ( ) const
inline

Query as an unsigned integer. See IntAttribute()

Definition at line 798 of file tinyxml2.h.

References QueryUnsignedValue().

798 { unsigned i=0; QueryUnsignedValue( &i ); return i; }
int QueryUnsignedValue(unsigned int *value) const
See QueryIntAttribute.
const char* tinyxml2::XMLAttribute::Value ( ) const
inline

Friends And Related Function Documentation

friend class XMLElement
friend

Definition at line 786 of file tinyxml2.h.

Member Data Documentation

MemPool* tinyxml2::XMLAttribute::memPool
private
StrPair tinyxml2::XMLAttribute::name
mutableprivate

Definition at line 844 of file tinyxml2.h.

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

XMLAttribute* tinyxml2::XMLAttribute::next
private
StrPair tinyxml2::XMLAttribute::value
mutableprivate

Definition at line 845 of file tinyxml2.h.

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


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

Generated on Thu Jul 7 2016 11:09:52 for antioch-0.4.0 by  doxygen 1.8.8