Use "name" for element name

This commit is contained in:
Dmitry-Me 2015-07-22 11:00:51 +03:00
parent eb89ef6f0d
commit 886ad9787c
2 changed files with 39 additions and 39 deletions

View File

@ -865,12 +865,12 @@ XMLNode* XMLNode::InsertAfterChild( XMLNode* afterThis, XMLNode* addThis )
const XMLElement* XMLNode::FirstChildElement( const char* value ) const const XMLElement* XMLNode::FirstChildElement( const char* name ) const
{ {
for( const XMLNode* node = _firstChild; node; node = node->_next ) { for( const XMLNode* node = _firstChild; node; node = node->_next ) {
const XMLElement* element = node->ToElement(); const XMLElement* element = node->ToElement();
if ( element ) { if ( element ) {
if ( !value || XMLUtil::StringEqual( element->Name(), value ) ) { if ( !name || XMLUtil::StringEqual( element->Name(), name ) ) {
return element; return element;
} }
} }
@ -879,12 +879,12 @@ const XMLElement* XMLNode::FirstChildElement( const char* value ) const
} }
const XMLElement* XMLNode::LastChildElement( const char* value ) const const XMLElement* XMLNode::LastChildElement( const char* name ) const
{ {
for( const XMLNode* node = _lastChild; node; node = node->_prev ) { for( const XMLNode* node = _lastChild; node; node = node->_prev ) {
const XMLElement* element = node->ToElement(); const XMLElement* element = node->ToElement();
if ( element ) { if ( element ) {
if ( !value || XMLUtil::StringEqual( element->Name(), value ) ) { if ( !name || XMLUtil::StringEqual( element->Name(), name ) ) {
return element; return element;
} }
} }
@ -893,12 +893,12 @@ const XMLElement* XMLNode::LastChildElement( const char* value ) const
} }
const XMLElement* XMLNode::NextSiblingElement( const char* value ) const const XMLElement* XMLNode::NextSiblingElement( const char* name ) const
{ {
for( const XMLNode* node = _next; node; node = node->_next ) { for( const XMLNode* node = _next; node; node = node->_next ) {
const XMLElement* element = node->ToElement(); const XMLElement* element = node->ToElement();
if ( element if ( element
&& (!value || XMLUtil::StringEqual( value, node->Value() ))) { && (!name || XMLUtil::StringEqual( name, element->Name() ))) {
return element; return element;
} }
} }
@ -906,12 +906,12 @@ const XMLElement* XMLNode::NextSiblingElement( const char* value ) const
} }
const XMLElement* XMLNode::PreviousSiblingElement( const char* value ) const const XMLElement* XMLNode::PreviousSiblingElement( const char* name ) const
{ {
for( const XMLNode* node = _prev; node; node = node->_prev ) { for( const XMLNode* node = _prev; node; node = node->_prev ) {
const XMLElement* element = node->ToElement(); const XMLElement* element = node->ToElement();
if ( element if ( element
&& (!value || XMLUtil::StringEqual( value, node->Value() ))) { && (!name || XMLUtil::StringEqual( name, element->Name() ))) {
return element; return element;
} }
} }
@ -991,12 +991,12 @@ char* XMLNode::ParseDeep( char* p, StrPair* parentEnd )
if ( ele->ClosingType() != XMLElement::OPEN ) { if ( ele->ClosingType() != XMLElement::OPEN ) {
mismatch = true; mismatch = true;
} }
else if ( !XMLUtil::StringEqual( endTag.GetStr(), node->Value() ) ) { else if ( !XMLUtil::StringEqual( endTag.GetStr(), ele->Name() ) ) {
mismatch = true; mismatch = true;
} }
} }
if ( mismatch ) { if ( mismatch ) {
_document->SetError( XML_ERROR_MISMATCHED_ELEMENT, node->Value(), 0 ); _document->SetError( XML_ERROR_MISMATCHED_ELEMENT, ele->Name(), 0 );
DeleteNode( node ); DeleteNode( node );
break; break;
} }
@ -1696,7 +1696,7 @@ bool XMLElement::ShallowEqual( const XMLNode* compare ) const
{ {
TIXMLASSERT( compare ); TIXMLASSERT( compare );
const XMLElement* other = compare->ToElement(); const XMLElement* other = compare->ToElement();
if ( other && XMLUtil::StringEqual( other->Value(), Value() )) { if ( other && XMLUtil::StringEqual( other->Name(), Name() )) {
const XMLAttribute* a=FirstAttribute(); const XMLAttribute* a=FirstAttribute();
const XMLAttribute* b=other->FirstAttribute(); const XMLAttribute* b=other->FirstAttribute();

View File

@ -725,10 +725,10 @@ public:
/** Get the first child element, or optionally the first child /** Get the first child element, or optionally the first child
element with the specified name. element with the specified name.
*/ */
const XMLElement* FirstChildElement( const char* value=0 ) const; const XMLElement* FirstChildElement( const char* name = 0 ) const;
XMLElement* FirstChildElement( const char* value=0 ) { XMLElement* FirstChildElement( const char* name = 0 ) {
return const_cast<XMLElement*>(const_cast<const XMLNode*>(this)->FirstChildElement( value )); return const_cast<XMLElement*>(const_cast<const XMLNode*>(this)->FirstChildElement( name ));
} }
/// Get the last child node, or null if none exists. /// Get the last child node, or null if none exists.
@ -743,10 +743,10 @@ public:
/** Get the last child element or optionally the last child /** Get the last child element or optionally the last child
element with the specified name. element with the specified name.
*/ */
const XMLElement* LastChildElement( const char* value=0 ) const; const XMLElement* LastChildElement( const char* name = 0 ) const;
XMLElement* LastChildElement( const char* value=0 ) { XMLElement* LastChildElement( const char* name = 0 ) {
return const_cast<XMLElement*>(const_cast<const XMLNode*>(this)->LastChildElement(value) ); return const_cast<XMLElement*>(const_cast<const XMLNode*>(this)->LastChildElement(name) );
} }
/// Get the previous (left) sibling node of this node. /// Get the previous (left) sibling node of this node.
@ -759,10 +759,10 @@ public:
} }
/// Get the previous (left) sibling element of this node, with an optionally supplied name. /// Get the previous (left) sibling element of this node, with an optionally supplied name.
const XMLElement* PreviousSiblingElement( const char* value=0 ) const ; const XMLElement* PreviousSiblingElement( const char* name = 0 ) const ;
XMLElement* PreviousSiblingElement( const char* value=0 ) { XMLElement* PreviousSiblingElement( const char* name = 0 ) {
return const_cast<XMLElement*>(const_cast<const XMLNode*>(this)->PreviousSiblingElement( value ) ); return const_cast<XMLElement*>(const_cast<const XMLNode*>(this)->PreviousSiblingElement( name ) );
} }
/// Get the next (right) sibling node of this node. /// Get the next (right) sibling node of this node.
@ -775,10 +775,10 @@ public:
} }
/// Get the next (right) sibling element of this node, with an optionally supplied name. /// Get the next (right) sibling element of this node, with an optionally supplied name.
const XMLElement* NextSiblingElement( const char* value=0 ) const; const XMLElement* NextSiblingElement( const char* name = 0 ) const;
XMLElement* NextSiblingElement( const char* value=0 ) { XMLElement* NextSiblingElement( const char* name = 0 ) {
return const_cast<XMLElement*>(const_cast<const XMLNode*>(this)->NextSiblingElement( value ) ); return const_cast<XMLElement*>(const_cast<const XMLNode*>(this)->NextSiblingElement( name ) );
} }
/** /**
@ -1823,32 +1823,32 @@ public:
return XMLHandle( _node ? _node->FirstChild() : 0 ); return XMLHandle( _node ? _node->FirstChild() : 0 );
} }
/// Get the first child element of this handle. /// Get the first child element of this handle.
XMLHandle FirstChildElement( const char* value=0 ) { XMLHandle FirstChildElement( const char* name = 0 ) {
return XMLHandle( _node ? _node->FirstChildElement( value ) : 0 ); return XMLHandle( _node ? _node->FirstChildElement( name ) : 0 );
} }
/// Get the last child of this handle. /// Get the last child of this handle.
XMLHandle LastChild() { XMLHandle LastChild() {
return XMLHandle( _node ? _node->LastChild() : 0 ); return XMLHandle( _node ? _node->LastChild() : 0 );
} }
/// Get the last child element of this handle. /// Get the last child element of this handle.
XMLHandle LastChildElement( const char* _value=0 ) { XMLHandle LastChildElement( const char* name = 0 ) {
return XMLHandle( _node ? _node->LastChildElement( _value ) : 0 ); return XMLHandle( _node ? _node->LastChildElement( name ) : 0 );
} }
/// Get the previous sibling of this handle. /// Get the previous sibling of this handle.
XMLHandle PreviousSibling() { XMLHandle PreviousSibling() {
return XMLHandle( _node ? _node->PreviousSibling() : 0 ); return XMLHandle( _node ? _node->PreviousSibling() : 0 );
} }
/// Get the previous sibling element of this handle. /// Get the previous sibling element of this handle.
XMLHandle PreviousSiblingElement( const char* _value=0 ) { XMLHandle PreviousSiblingElement( const char* name = 0 ) {
return XMLHandle( _node ? _node->PreviousSiblingElement( _value ) : 0 ); return XMLHandle( _node ? _node->PreviousSiblingElement( name ) : 0 );
} }
/// Get the next sibling of this handle. /// Get the next sibling of this handle.
XMLHandle NextSibling() { XMLHandle NextSibling() {
return XMLHandle( _node ? _node->NextSibling() : 0 ); return XMLHandle( _node ? _node->NextSibling() : 0 );
} }
/// Get the next sibling element of this handle. /// Get the next sibling element of this handle.
XMLHandle NextSiblingElement( const char* _value=0 ) { XMLHandle NextSiblingElement( const char* name = 0 ) {
return XMLHandle( _node ? _node->NextSiblingElement( _value ) : 0 ); return XMLHandle( _node ? _node->NextSiblingElement( name ) : 0 );
} }
/// Safe cast to XMLNode. This can return null. /// Safe cast to XMLNode. This can return null.
@ -1902,26 +1902,26 @@ public:
const XMLConstHandle FirstChild() const { const XMLConstHandle FirstChild() const {
return XMLConstHandle( _node ? _node->FirstChild() : 0 ); return XMLConstHandle( _node ? _node->FirstChild() : 0 );
} }
const XMLConstHandle FirstChildElement( const char* value=0 ) const { const XMLConstHandle FirstChildElement( const char* name = 0 ) const {
return XMLConstHandle( _node ? _node->FirstChildElement( value ) : 0 ); return XMLConstHandle( _node ? _node->FirstChildElement( name ) : 0 );
} }
const XMLConstHandle LastChild() const { const XMLConstHandle LastChild() const {
return XMLConstHandle( _node ? _node->LastChild() : 0 ); return XMLConstHandle( _node ? _node->LastChild() : 0 );
} }
const XMLConstHandle LastChildElement( const char* _value=0 ) const { const XMLConstHandle LastChildElement( const char* name = 0 ) const {
return XMLConstHandle( _node ? _node->LastChildElement( _value ) : 0 ); return XMLConstHandle( _node ? _node->LastChildElement( name ) : 0 );
} }
const XMLConstHandle PreviousSibling() const { const XMLConstHandle PreviousSibling() const {
return XMLConstHandle( _node ? _node->PreviousSibling() : 0 ); return XMLConstHandle( _node ? _node->PreviousSibling() : 0 );
} }
const XMLConstHandle PreviousSiblingElement( const char* _value=0 ) const { const XMLConstHandle PreviousSiblingElement( const char* name = 0 ) const {
return XMLConstHandle( _node ? _node->PreviousSiblingElement( _value ) : 0 ); return XMLConstHandle( _node ? _node->PreviousSiblingElement( name ) : 0 );
} }
const XMLConstHandle NextSibling() const { const XMLConstHandle NextSibling() const {
return XMLConstHandle( _node ? _node->NextSibling() : 0 ); return XMLConstHandle( _node ? _node->NextSibling() : 0 );
} }
const XMLConstHandle NextSiblingElement( const char* _value=0 ) const { const XMLConstHandle NextSiblingElement( const char* name = 0 ) const {
return XMLConstHandle( _node ? _node->NextSiblingElement( _value ) : 0 ); return XMLConstHandle( _node ? _node->NextSiblingElement( name ) : 0 );
} }