Example #1
0
JsonTree::Iter JsonTree::removeChild( JsonTree::Iter pos )
{
	try {
		return mChildren.erase( pos );
	} catch ( ... ) {
		throw ExcChildNotFound( *this, pos->getPath() );
	}
}
Example #2
0
File: Xml.cpp Project: Ahbee/Cinder
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 );
}
Example #3
0
const JsonTree& JsonTree::getChild( size_t index ) const 
{
	JsonTree *child = getNodePtr( toString( index ), false, '.' );
	if ( child ) {
		return *child;
	} else {
		throw ExcChildNotFound( *this, toString( index ) );
	}
}
Example #4
0
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 );
	}
}
Example #5
0
void JsonTree::replaceChild( JsonTree::Iter pos, const JsonTree &newChild )
{
	try {
		*pos = newChild;
		pos->mParent = this;
	} catch ( ... ) {
		throw ExcChildNotFound( *this, pos->getPath() );
	}
}
Example #6
0
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 ) );
	}
}
Example #7
0
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 ) );
	}
}