#include <tinyxml.h>
Public Member Functions | |
double | DoubleValue () const |
Return the value of this attribute, converted to a double. | |
double | DoubleValue () const |
Return the value of this attribute, converted to a double. | |
int | IntValue () const |
Return the value of this attribute, converted to an integer. | |
int | IntValue () const |
Return the value of this attribute, converted to an integer. | |
const char * | Name () const |
Return the name of this attribute. | |
const char * | Name () const |
Return the name of this attribute. | |
const TIXML_STRING & | NameTStr () const |
const TIXML_STRING & | NameTStr () const |
const TiXmlAttribute * | Next () const |
Get the next sibling attribute in the DOM. Returns null at end. | |
TiXmlAttribute * | Next () |
const TiXmlAttribute * | Next () const |
Get the next sibling attribute in the DOM. Returns null at end. | |
TiXmlAttribute * | Next () |
bool | operator< (const TiXmlAttribute &rhs) const |
bool | operator< (const TiXmlAttribute &rhs) const |
bool | operator== (const TiXmlAttribute &rhs) const |
bool | operator== (const TiXmlAttribute &rhs) const |
bool | operator> (const TiXmlAttribute &rhs) const |
bool | operator> (const TiXmlAttribute &rhs) const |
virtual const char * | Parse (const char *p, TiXmlParsingData *data, TiXmlEncoding encoding) |
virtual const char * | Parse (const char *p, TiXmlParsingData *data, TiXmlEncoding encoding) |
TiXmlAttribute * | Previous () |
TiXmlAttribute * | Previous () |
const TiXmlAttribute * | Previous () const |
Get the previous sibling attribute in the DOM. Returns null at beginning. | |
const TiXmlAttribute * | Previous () const |
Get the previous sibling attribute in the DOM. Returns null at beginning. | |
virtual void | Print (FILE *cfile, int depth) const |
void | Print (FILE *cfile, int depth, TIXML_STRING *str) const |
virtual void | Print (FILE *cfile, int depth) const |
void | Print (FILE *cfile, int depth, TIXML_STRING *str) const |
int | QueryDoubleValue (double *_value) const |
QueryDoubleValue examines the value string. See QueryIntValue(). | |
int | QueryDoubleValue (double *_value) const |
QueryDoubleValue examines the value string. See QueryIntValue(). | |
int | QueryIntValue (int *_value) const |
int | QueryIntValue (int *_value) const |
void | SetDocument (TiXmlDocument *doc) |
void | SetDocument (TiXmlDocument *doc) |
void | SetDoubleValue (double _value) |
Set the value from a double. | |
void | SetDoubleValue (double _value) |
Set the value from a double. | |
void | SetIntValue (int _value) |
Set the value from an integer. | |
void | SetIntValue (int _value) |
Set the value from an integer. | |
void | SetName (const std::string &_name) |
STL std::string form. | |
void | SetName (const char *_name) |
Set the name of this attribute. | |
void | SetName (const char *_name) |
Set the name of this attribute. | |
void | SetName (const std::string &_name) |
STL std::string form. | |
void | SetValue (const std::string &_value) |
STL std::string form. | |
void | SetValue (const std::string &_value) |
STL std::string form. | |
void | SetValue (const char *_value) |
Set the value. | |
void | SetValue (const char *_value) |
Set the value. | |
TiXmlAttribute () | |
Construct an empty attribute. | |
TiXmlAttribute () | |
Construct an empty attribute. | |
TiXmlAttribute (const char *_name, const char *_value) | |
Construct an attribute with a name and value. | |
TiXmlAttribute (const char *_name, const char *_value) | |
Construct an attribute with a name and value. | |
TiXmlAttribute (const std::string &_name, const std::string &_value) | |
std::string constructor. | |
TiXmlAttribute (const std::string &_name, const std::string &_value) | |
std::string constructor. | |
const char * | Value () const |
Return the value of this attribute. | |
const char * | Value () const |
Return the value of this attribute. | |
const std::string & | ValueStr () const |
Return the value of this attribute. | |
const std::string & | ValueStr () const |
Return the value of this attribute. | |
Private Member Functions | |
TiXmlAttribute & | operator= (const TiXmlAttribute &base) |
void | operator= (const TiXmlAttribute &base) |
TiXmlAttribute (const TiXmlAttribute &) | |
TiXmlAttribute (const TiXmlAttribute &) | |
Private Attributes | |
TiXmlDocument * | document |
TIXML_STRING | name |
TiXmlAttribute * | next |
TiXmlAttribute * | prev |
TIXML_STRING | value |
Friends | |
class | TiXmlAttributeSet |
An attribute is a name-value pair. Elements have an arbitrary number of attributes, each with a unique name.
TiXmlAttribute::TiXmlAttribute | ( | ) | [inline] |
TiXmlAttribute::TiXmlAttribute | ( | const std::string & | _name, |
const std::string & | _value | ||
) | [inline] |
TiXmlAttribute::TiXmlAttribute | ( | const char * | _name, |
const char * | _value | ||
) | [inline] |
TiXmlAttribute::TiXmlAttribute | ( | const TiXmlAttribute & | ) | [private] |
TiXmlAttribute::TiXmlAttribute | ( | ) | [inline] |
TiXmlAttribute::TiXmlAttribute | ( | const std::string & | _name, |
const std::string & | _value | ||
) | [inline] |
TiXmlAttribute::TiXmlAttribute | ( | const char * | _name, |
const char * | _value | ||
) | [inline] |
TiXmlAttribute::TiXmlAttribute | ( | const TiXmlAttribute & | ) | [private] |
double TiXmlAttribute::DoubleValue | ( | ) | const |
Return the value of this attribute, converted to a double.
Definition at line 1297 of file tinyxml.cc.
References value.
{ return atof (value.c_str ()); }
double TiXmlAttribute::DoubleValue | ( | ) | const |
Return the value of this attribute, converted to a double.
int TiXmlAttribute::IntValue | ( | ) | const |
Return the value of this attribute, converted to an integer.
Definition at line 1292 of file tinyxml.cc.
References value.
{ return atoi (value.c_str ()); }
int TiXmlAttribute::IntValue | ( | ) | const |
Return the value of this attribute, converted to an integer.
const char* TiXmlAttribute::Name | ( | ) | const [inline] |
Return the name of this attribute.
Definition at line 815 of file tinyxml.h.
References name.
Referenced by TiXmlAttributeSet::Add(), TiXmlElement::CopyTo(), and TiXmlElement::Parse().
const char* TiXmlAttribute::Name | ( | ) | const [inline] |
const TIXML_STRING& TiXmlAttribute::NameTStr | ( | ) | const [inline] |
const TIXML_STRING& TiXmlAttribute::NameTStr | ( | ) | const [inline] |
Definition at line 824 of file tinyxml.h.
References name.
Referenced by TiXmlElement::Parse().
{ return name; }
TiXmlAttribute* TiXmlAttribute::Next | ( | ) | [inline] |
Definition at line 854 of file tinyxml.h.
{ return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() ); }
const TiXmlAttribute* TiXmlAttribute::Next | ( | ) | const |
Get the next sibling attribute in the DOM. Returns null at end.
TiXmlAttribute* TiXmlAttribute::Next | ( | ) | [inline] |
Definition at line 815 of file tinyxml.h.
{ return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() ); }
const TiXmlAttribute * TiXmlAttribute::Next | ( | ) | const |
Get the next sibling attribute in the DOM. Returns null at end.
Definition at line 1184 of file tinyxml.cc.
References name, next, and value.
Referenced by TiXmlElement::CopyTo(), TiXmlElement::Print(), and TiXmlPrinter::VisitEnter().
bool TiXmlAttribute::operator< | ( | const TiXmlAttribute & | rhs | ) | const [inline] |
bool TiXmlAttribute::operator< | ( | const TiXmlAttribute & | rhs | ) | const [inline] |
TiXmlAttribute& TiXmlAttribute::operator= | ( | const TiXmlAttribute & | base | ) | [private] |
void TiXmlAttribute::operator= | ( | const TiXmlAttribute & | base | ) | [private] |
bool TiXmlAttribute::operator== | ( | const TiXmlAttribute & | rhs | ) | const [inline] |
bool TiXmlAttribute::operator== | ( | const TiXmlAttribute & | rhs | ) | const [inline] |
bool TiXmlAttribute::operator> | ( | const TiXmlAttribute & | rhs | ) | const [inline] |
bool TiXmlAttribute::operator> | ( | const TiXmlAttribute & | rhs | ) | const [inline] |
const char * TiXmlAttribute::Parse | ( | const char * | p, |
TiXmlParsingData * | data, | ||
TiXmlEncoding | encoding | ||
) | [virtual] |
Implements TiXmlBase.
Definition at line 1403 of file tinyxmlparser.cc.
References TiXmlParsingData::Cursor(), end, TiXmlBase::IsWhiteSpace(), TiXmlBase::location, name, AlCaHLTBitMon_ParallelJobs::p, TiXmlBase::ReadName(), TiXmlBase::ReadText(), TiXmlDocument::SetError(), TiXmlBase::SkipWhiteSpace(), TiXmlParsingData::Stamp(), TiXmlBase::TIXML_ERROR_READING_ATTRIBUTES, and value.
Referenced by TiXmlElement::Parse(), and TiXmlDeclaration::Parse().
{ p = SkipWhiteSpace( p, encoding ); if ( !p || !*p ) return 0; // int tabsize = 4; // if ( document ) // tabsize = document->TabSize(); if ( data ) { data->Stamp( p, encoding ); location = data->Cursor(); } // Read the name, the '=' and the value. const char* pErr = p; p = ReadName( p, &name, encoding ); if ( !p || !*p ) { if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding ); return 0; } p = SkipWhiteSpace( p, encoding ); if ( !p || !*p || *p != '=' ) { if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); return 0; } ++p; // skip '=' p = SkipWhiteSpace( p, encoding ); if ( !p || !*p ) { if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); return 0; } const char* end; const char SINGLE_QUOTE = '\''; const char DOUBLE_QUOTE = '\"'; if ( *p == SINGLE_QUOTE ) { ++p; end = "\'"; // single quote in string p = ReadText( p, &value, false, end, false, encoding ); } else if ( *p == DOUBLE_QUOTE ) { ++p; end = "\""; // double quote in string p = ReadText( p, &value, false, end, false, encoding ); } else { // All attribute values should be in single or double quotes. // But this is such a common error that the parser will try // its best, even without them. value = ""; while ( p && *p // existence && !IsWhiteSpace( *p ) && *p != '\n' && *p != '\r' // whitespace && *p != '/' && *p != '>' ) // tag end { if ( *p == SINGLE_QUOTE || *p == DOUBLE_QUOTE ) { // [ 1451649 ] Attribute values with trailing quotes not handled correctly // We did not have an opening quote but seem to have a // closing one. Give up and throw an error. if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); return 0; } value += *p; ++p; } } return p; }
virtual const char* TiXmlAttribute::Parse | ( | const char * | p, |
TiXmlParsingData * | data, | ||
TiXmlEncoding | encoding | ||
) | [virtual] |
Implements TiXmlBase.
const TiXmlAttribute * TiXmlAttribute::Previous | ( | ) | const |
Get the previous sibling attribute in the DOM. Returns null at beginning.
Definition at line 1204 of file tinyxml.cc.
TiXmlAttribute* TiXmlAttribute::Previous | ( | ) | [inline] |
Definition at line 860 of file tinyxml.h.
{ return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() ); }
TiXmlAttribute* TiXmlAttribute::Previous | ( | ) | [inline] |
Definition at line 821 of file tinyxml.h.
{ return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() ); }
const TiXmlAttribute* TiXmlAttribute::Previous | ( | ) | const |
Get the previous sibling attribute in the DOM. Returns null at beginning.
virtual void TiXmlAttribute::Print | ( | FILE * | cfile, |
int | depth | ||
) | const [inline, virtual] |
All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL mode, std::string in STL mode.) Either or both cfile and str can be null.
This is a formatted print, and will insert tabs and newlines.
(For an unformatted stream, use the << operator.)
Implements TiXmlBase.
Definition at line 835 of file tinyxml.h.
References Print().
{ Print( cfile, depth, 0 ); }
void TiXmlAttribute::Print | ( | FILE * | cfile, |
int | depth, | ||
TIXML_STRING * | str | ||
) | const |
void TiXmlAttribute::Print | ( | FILE * | cfile, |
int | depth, | ||
TIXML_STRING * | str | ||
) | const |
Definition at line 1224 of file tinyxml.cc.
References TiXmlBase::EncodeString(), n, TIXML_STRING, v, and value.
{ TIXML_STRING n, v; EncodeString( name, &n ); EncodeString( value, &v ); if (value.find ('\"') == TIXML_STRING::npos) { if ( cfile ) { fprintf (cfile, "%s=\"%s\"", n.c_str(), v.c_str() ); } if ( str ) { (*str) += n; (*str) += "=\""; (*str) += v; (*str) += "\""; } } else { if ( cfile ) { fprintf (cfile, "%s='%s'", n.c_str(), v.c_str() ); } if ( str ) { (*str) += n; (*str) += "='"; (*str) += v; (*str) += "'"; } } }
virtual void TiXmlAttribute::Print | ( | FILE * | cfile, |
int | depth | ||
) | const [inline, virtual] |
All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL mode, std::string in STL mode.) Either or both cfile and str can be null.
This is a formatted print, and will insert tabs and newlines.
(For an unformatted stream, use the << operator.)
Implements TiXmlBase.
Definition at line 874 of file tinyxml.h.
Referenced by TiXmlDocument::Print(), Print(), and TiXmlPrinter::VisitEnter().
{ Print( cfile, depth, 0 ); }
int TiXmlAttribute::QueryDoubleValue | ( | double * | _value | ) | const |
QueryDoubleValue examines the value string. See QueryIntValue().
Definition at line 1260 of file tinyxml.cc.
References TIXML_SUCCESS, TIXML_WRONG_TYPE, and value.
Referenced by TiXmlElement::QueryDoubleAttribute().
{ try { *dval = boost::lexical_cast<double>(value); } catch(boost::bad_lexical_cast const&) { return TIXML_WRONG_TYPE; } return TIXML_SUCCESS; }
int TiXmlAttribute::QueryDoubleValue | ( | double * | _value | ) | const |
QueryDoubleValue examines the value string. See QueryIntValue().
int TiXmlAttribute::QueryIntValue | ( | int * | _value | ) | const |
QueryIntValue examines the value string. It is an alternative to the IntValue() method with richer error checking. If the value is an integer, it is stored in 'value' and the call returns TIXML_SUCCESS. If it is not an integer, it returns TIXML_WRONG_TYPE.
A specialized but useful call. Note that for success it returns 0, which is the opposite of almost all other TinyXml calls.
int TiXmlAttribute::QueryIntValue | ( | int * | _value | ) | const |
QueryIntValue examines the value string. It is an alternative to the IntValue() method with richer error checking. If the value is an integer, it is stored in 'value' and the call returns TIXML_SUCCESS. If it is not an integer, it returns TIXML_WRONG_TYPE.
A specialized but useful call. Note that for success it returns 0, which is the opposite of almost all other TinyXml calls.
Definition at line 1250 of file tinyxml.cc.
References TIXML_SUCCESS, TIXML_WRONG_TYPE, and value.
Referenced by TiXmlElement::QueryIntAttribute().
{ try { *ival = boost::lexical_cast<int>(value); } catch(boost::bad_lexical_cast const&) { return TIXML_WRONG_TYPE; } return TIXML_SUCCESS; }
void TiXmlAttribute::SetDocument | ( | TiXmlDocument * | doc | ) | [inline] |
Definition at line 881 of file tinyxml.h.
References asciidump::doc, and document.
Referenced by TiXmlElement::Parse().
void TiXmlAttribute::SetDocument | ( | TiXmlDocument * | doc | ) | [inline] |
void TiXmlAttribute::SetDoubleValue | ( | double | _value | ) |
Set the value from a double.
void TiXmlAttribute::SetDoubleValue | ( | double | _value | ) |
Set the value from a double.
Definition at line 1281 of file tinyxml.cc.
References SetValue().
{ char buf [256]; #if defined(TIXML_SNPRINTF) TIXML_SNPRINTF( buf, sizeof(buf), "%f", _value); #else snprintf (buf, sizeof(buf), "%f", _value); #endif SetValue (buf); }
void TiXmlAttribute::SetIntValue | ( | int | _value | ) |
Set the value from an integer.
void TiXmlAttribute::SetIntValue | ( | int | _value | ) |
Set the value from an integer.
Definition at line 1270 of file tinyxml.cc.
References SetValue().
{ char buf [64]; #if defined(TIXML_SNPRINTF) TIXML_SNPRINTF(buf, sizeof(buf), "%d", _value); #else snprintf (buf, sizeof(buf), "%d", _value); #endif SetValue (buf); }
void TiXmlAttribute::SetName | ( | const char * | _name | ) | [inline] |
void TiXmlAttribute::SetName | ( | const char * | _name | ) | [inline] |
void TiXmlAttribute::SetName | ( | const std::string & | _name | ) | [inline] |
void TiXmlAttribute::SetName | ( | const std::string & | _name | ) | [inline] |
void TiXmlAttribute::SetValue | ( | const char * | _value | ) | [inline] |
Set the value.
Definition at line 840 of file tinyxml.h.
References value.
Referenced by TiXmlElement::Parse(), TiXmlElement::SetAttribute(), SetDoubleValue(), and SetIntValue().
void TiXmlAttribute::SetValue | ( | const std::string & | _value | ) | [inline] |
void TiXmlAttribute::SetValue | ( | const std::string & | _value | ) | [inline] |
void TiXmlAttribute::SetValue | ( | const char * | _value | ) | [inline] |
const char* TiXmlAttribute::Value | ( | ) | const [inline] |
Return the value of this attribute.
Definition at line 816 of file tinyxml.h.
References value.
Referenced by TiXmlElement::Attribute(), TiXmlElement::CopyTo(), TiXmlElement::Parse(), and TiXmlDeclaration::Parse().
const char* TiXmlAttribute::Value | ( | ) | const [inline] |
const std::string& TiXmlAttribute::ValueStr | ( | ) | const [inline] |
const std::string& TiXmlAttribute::ValueStr | ( | ) | const [inline] |
Return the value of this attribute.
Definition at line 818 of file tinyxml.h.
References value.
Referenced by TiXmlElement::QueryValueAttribute().
TiXmlAttributeSet [friend] |
TiXmlDocument * TiXmlAttribute::document [private] |
Definition at line 887 of file tinyxml.h.
Referenced by SetDocument(), and TiXmlAttribute().
TIXML_STRING TiXmlAttribute::name [private] |
Definition at line 888 of file tinyxml.h.
Referenced by TiXmlAttributeSet::Find(), Name(), NameTStr(), Next(), operator<(), operator==(), operator>(), Parse(), Previous(), SetName(), and TiXmlAttribute().
TiXmlAttribute * TiXmlAttribute::next [private] |
Definition at line 891 of file tinyxml.h.
Referenced by TiXmlAttributeSet::Add(), TiXmlAttributeSet::Find(), TiXmlAttributeSet::First(), Next(), TiXmlAttributeSet::Remove(), TiXmlAttribute(), TiXmlAttributeSet::TiXmlAttributeSet(), and TiXmlAttributeSet::~TiXmlAttributeSet().
TiXmlAttribute * TiXmlAttribute::prev [private] |
Definition at line 890 of file tinyxml.h.
Referenced by TiXmlAttributeSet::Add(), TiXmlAttributeSet::Last(), Previous(), TiXmlAttributeSet::Remove(), TiXmlAttribute(), TiXmlAttributeSet::TiXmlAttributeSet(), and TiXmlAttributeSet::~TiXmlAttributeSet().
TIXML_STRING TiXmlAttribute::value [private] |
Definition at line 889 of file tinyxml.h.
Referenced by DoubleValue(), IntValue(), Next(), Parse(), Previous(), Print(), QueryDoubleValue(), QueryIntValue(), SetValue(), TiXmlAttribute(), Value(), and ValueStr().