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