示例#1
0
/**
 * Save the loaded files (build settings tree).
 *
 * @return A settings tree
 */
ArrayNode* Preferences::storeLoadedFiles() {
	ArrayNode* loadedFilesNode = new ArrayNode();
	
	for( deque<FileSession*>::iterator it = loadedFiles.begin(); it != loadedFiles.end(); it++ ) {
		if( *it != NULL ) {
			loadedFilesNode->addChild( storeFile( (*it)->filename, (*it)->session ) );
		}
	}
		
	return loadedFilesNode;
}
示例#2
0
/**
 * Transform a XML node to a ArrayNode.
 *
 * @param xmlElement	XML element.
 *
 * @return				A ArrayNode.
 */
ArrayNode* XmlSettingsTree::xmlToArrayNode( TiXmlElement* xmlElement ) {
	ArrayNode* retNode = new ArrayNode();
	
	TiXmlHandle		handler( xmlElement );
	TiXmlElement* 	child = handler.FirstChild().Element();
			
	//< @todo what if child is null?
	for( child; child; child = child->NextSiblingElement() ) {
		SettingsNode* tmp = xmlToSettingsTree( child );
		retNode->addChild( tmp );
	}
	
	return retNode;
}