Searches for the expectedName node if it doesn't match the actualName ! This needs to be called before every load or node start occurs. This function will check to see if an NVP has been provided (with setNextName) and if so, see if that name matches the actual next name given. If the names do not match, it will search in the current level of the JSON for that name.
| 563 | |
| 564 | @throws Exception if an expectedName is given and not found */ |
| 565 | inline void search() |
| 566 | { |
| 567 | // store pointer to itsNextName locally and reset to nullptr in case search() throws |
| 568 | auto localNextName = itsNextName; |
| 569 | itsNextName = nullptr; |
| 570 | |
| 571 | // The name an NVP provided with setNextName() |
| 572 | if( localNextName ) |
| 573 | { |
| 574 | // The actual name of the current node |
| 575 | auto const actualName = itsIteratorStack.back().name(); |
| 576 | |
| 577 | // Do a search if we don't see a name coming up, or if the names don't match |
| 578 | if( !actualName || std::strcmp( localNextName, actualName ) != 0 ) |
| 579 | itsIteratorStack.back().search( localNextName ); |
| 580 | } |
| 581 | } |
| 582 | |
| 583 | public: |
| 584 | //! Starts a new node, going into its proper iterator |