JsonTree::Iter JsonTree::removeChild( JsonTree::Iter pos ) { try { return mChildren.erase( pos ); } catch ( ... ) { throw ExcChildNotFound( *this, pos->getPath() ); } }
XmlTree& XmlTree::getChild( const string &relativePath, bool caseSensitive, char separator ) { XmlTree* child = getNodePtr( relativePath, caseSensitive, separator ); if( child ) return *child; else throw ExcChildNotFound( *this, relativePath ); }
const JsonTree& JsonTree::getChild( size_t index ) const { JsonTree *child = getNodePtr( toString( index ), false, '.' ); if ( child ) { return *child; } else { throw ExcChildNotFound( *this, toString( index ) ); } }
const JsonTree& JsonTree::getChild( const std::string &relativePath, bool caseSensitive, char separator ) const { JsonTree *child = getNodePtr( relativePath, caseSensitive, separator ); if ( child ) { return *child; } else { throw ExcChildNotFound( *this, relativePath ); } }
void JsonTree::replaceChild( JsonTree::Iter pos, const JsonTree &newChild ) { try { *pos = newChild; pos->mParent = this; } catch ( ... ) { throw ExcChildNotFound( *this, pos->getPath() ); } }
void JsonTree::removeChild( size_t index ) { if( index < mChildren.size() ) { JsonTree::Iter pos = mChildren.begin(); for( uint32_t i = 0; i < index; i++, ++pos ) { } mChildren.erase( pos ); } else { throw ExcChildNotFound( *this, toString( index ) ); } }
void JsonTree::replaceChild( size_t index, const JsonTree &newChild ) { if ( index < mChildren.size() ) { JsonTree::Iter oldChild = mChildren.begin(); for( uint32_t i = 0; i < index; i++, ++oldChild ) { } *oldChild = newChild; oldChild->mParent = this; } else { throw ExcChildNotFound( *this, toString( index ) ); } }