2
2
www.sourceforge.net/projects/tinyxml
3
Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com)
3
Original code by Lee Thomason (www.grinninglizard.com)
5
5
This software is provided 'as-is', without any express or implied
6
6
warranty. In no event will the authors be held liable for any
191
191
if ( node->Type() == TiXmlNode::TINYXML_DOCUMENT )
194
if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
195
GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
215
216
if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT )
217
if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
219
GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
220
222
TiXmlNode* node = addThis.Clone();
233
235
if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT )
235
if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
238
GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
265
268
if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT )
267
if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
271
GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
670
int TiXmlElement::QueryUnsignedAttribute( const char* name, unsigned* value ) const
672
const TiXmlAttribute* node = attributeSet.Find( name );
674
return TIXML_NO_ATTRIBUTE;
677
int result = node->QueryIntValue( &ival );
678
*value = (unsigned)ival;
683
int TiXmlElement::QueryBoolAttribute( const char* name, bool* bval ) const
685
const TiXmlAttribute* node = attributeSet.Find( name );
687
return TIXML_NO_ATTRIBUTE;
689
int result = TIXML_WRONG_TYPE;
690
if ( StringEqual( node->Value(), "true", true, TIXML_ENCODING_UNKNOWN )
691
|| StringEqual( node->Value(), "yes", true, TIXML_ENCODING_UNKNOWN )
692
|| StringEqual( node->Value(), "1", true, TIXML_ENCODING_UNKNOWN ) )
695
result = TIXML_SUCCESS;
697
else if ( StringEqual( node->Value(), "false", true, TIXML_ENCODING_UNKNOWN )
698
|| StringEqual( node->Value(), "no", true, TIXML_ENCODING_UNKNOWN )
699
|| StringEqual( node->Value(), "0", true, TIXML_ENCODING_UNKNOWN ) )
702
result = TIXML_SUCCESS;
665
709
#ifdef TIXML_USE_STL
666
710
int TiXmlElement::QueryIntAttribute( const std::string& name, int* ival ) const
1172
1217
if (value.find ('\"') == TIXML_STRING::npos) {
1174
fprintf (cfile, "%s=\"%s\"", n.c_str(), v.c_str() );
1219
fprintf (cfile, "%s=\"%s\"", n.c_str(), v.c_str() );
1177
1222
(*str) += n; (*str) += "=\""; (*str) += v; (*str) += "\"";
1182
fprintf (cfile, "%s='%s'", n.c_str(), v.c_str() );
1227
fprintf (cfile, "%s='%s'", n.c_str(), v.c_str() );
1185
1230
(*str) += n; (*str) += "='"; (*str) += v; (*str) += "'";