----------------------------------------------------------------------------- Get true if first child element was successfully pushed onto stack. -----------------------------------------------------------------------------
| 406 | // Get true if first child element was successfully pushed onto stack. |
| 407 | // ----------------------------------------------------------------------------- |
| 408 | bool SimXMLDocument::pushChildElement(S32 index) |
| 409 | { |
| 410 | // Clear the current attribute pointer |
| 411 | m_CurrentAttribute = 0; |
| 412 | |
| 413 | // Push the first element found under the current element of the given name |
| 414 | tinyxml2::XMLElement* pElement; |
| 415 | if(!m_paNode.empty()) |
| 416 | { |
| 417 | const S32 iLastElement = m_paNode.size() - 1; |
| 418 | tinyxml2::XMLNode* pNode = m_paNode[iLastElement]; |
| 419 | if(!pNode) |
| 420 | { |
| 421 | return false; |
| 422 | } |
| 423 | pElement = pNode->FirstChildElement(); |
| 424 | for( S32 i = 0; i < index; i++ ) |
| 425 | { |
| 426 | if( !pElement ) |
| 427 | return false; |
| 428 | |
| 429 | pElement = pElement->NextSiblingElement(); |
| 430 | } |
| 431 | } |
| 432 | else |
| 433 | { |
| 434 | if(!m_qDocument) |
| 435 | { |
| 436 | return false; |
| 437 | } |
| 438 | pElement = m_qDocument->FirstChildElement(); |
| 439 | for( S32 i = 0; i < index; i++ ) |
| 440 | { |
| 441 | if( !pElement ) |
| 442 | return false; |
| 443 | |
| 444 | pElement = pElement->NextSiblingElement(); |
| 445 | } |
| 446 | } |
| 447 | |
| 448 | if(!pElement) |
| 449 | { |
| 450 | return false; |
| 451 | } |
| 452 | m_paNode.push_back(pElement); |
| 453 | return true; |
| 454 | } |
| 455 | |
| 456 | DefineEngineMethod( SimXMLDocument, pushChildElement, bool, ( S32 index ),, |
| 457 | "@brief Push the child Element at the given index onto the stack, making it the current one.\n\n" |
no test coverage detected