mirror of https://github.com/AxioDL/tinyxml2.git
Merge pull request #235 from Dmitry-Me/reuseFindAttribute
Reuse const FindAttribute for non-const version thereof
This commit is contained in:
commit
5c5307013a
11
tinyxml2.cpp
11
tinyxml2.cpp
|
@ -1243,17 +1243,6 @@ XMLElement::~XMLElement()
|
|||
}
|
||||
|
||||
|
||||
XMLAttribute* XMLElement::FindAttribute( const char* name )
|
||||
{
|
||||
for( XMLAttribute* a = _rootAttribute; a; a = a->_next ) {
|
||||
if ( XMLUtil::StringEqual( a->Name(), name ) ) {
|
||||
return a;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
const XMLAttribute* XMLElement::FindAttribute( const char* name ) const
|
||||
{
|
||||
for( XMLAttribute* a = _rootAttribute; a; a = a->_next ) {
|
||||
|
|
|
@ -1491,7 +1491,9 @@ private:
|
|||
XMLElement( const XMLElement& ); // not supported
|
||||
void operator=( const XMLElement& ); // not supported
|
||||
|
||||
XMLAttribute* FindAttribute( const char* name );
|
||||
XMLAttribute* FindAttribute( const char* name ) {
|
||||
return const_cast<XMLAttribute*>(const_cast<const XMLElement*>(this)->FindAttribute( name ));
|
||||
}
|
||||
XMLAttribute* FindOrCreateAttribute( const char* name );
|
||||
//void LinkAttribute( XMLAttribute* attrib );
|
||||
char* ParseAttributes( char* p );
|
||||
|
|
Loading…
Reference in New Issue