当前位置: 首页>>代码示例>>C++>>正文


C++ XmlTree::end方法代码示例

本文整理汇总了C++中XmlTree::end方法的典型用法代码示例。如果您正苦于以下问题:C++ XmlTree::end方法的具体用法?C++ XmlTree::end怎么用?C++ XmlTree::end使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XmlTree的用法示例。


在下文中一共展示了XmlTree::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: load

void QTimeline::load( fs::path filepath )
{
    clear();
 
    XmlTree doc;
    
    try
    {
        doc = XmlTree( loadFile( filepath ) );

        
        for( XmlTree::Iter nodeIt = doc.begin("QTimeline/tracks/track"); nodeIt != doc.end(); ++nodeIt )
        {
            string              trackName   = nodeIt->getAttributeValue<string>("name");
            QTimelineTrackRef   trackRef    = QTimelineTrackRef( new QTimelineTrack( trackName ) );
            mTracks.push_back( trackRef );
            trackRef->loadXmlNode( *nodeIt );
        }
        
        mCueManager->loadXmlNode( doc.getChild( "qTimeline/cueList" ) );
    }
    catch ( ... )
    {
        console() << "Error > QTimeline::load(): " << filepath.filename().generic_string() << endl;
        return;
    }
    
    updateCurrentTime();
}
开发者ID:Reymenta-Visuals,项目名称:QTimeline,代码行数:29,代码来源:QTimeline.cpp

示例2: parseRecipes

void AppModel::parseRecipes(XmlTree _root){
    XmlTree t = _root.getChild("dict/dict");
    
    for( XmlTree::Iter child = t.begin(); child != t.end(); ++child ){
        if(child->getTag().compare("key")==0){
            // use this value as the name for a new Recipe object
            RecipeModel rm;
            rm.name = child->getValue();
            recipes.push_back(rm);
        } else {
            XmlTree t2 = *child;
            string whichKey;
            for( XmlTree::Iter grandchild = t2.begin(); grandchild != t2.end(); ++grandchild ){                
                if(grandchild->getTag().compare("key")==0){
                    whichKey = grandchild->getValue();
                } else if(grandchild->getTag().compare("dict")==0){                    
                    if(whichKey.compare("Steps")==0){
                        XmlTree t3 = *grandchild;
                        CookStepModel sm;
                        for( XmlTree::Iter greatChild = t3.begin(); greatChild != t3.end(); ++greatChild ){
                            XmlTree t4 = *greatChild;
                            string stepKey;
                            if(greatChild->getTag().compare("dict")==0){
                                for( XmlTree::Iter baby = t4.begin(); baby != t4.end(); ++baby ){
                                    if(baby->getTag().compare("key")==0){
                                        stepKey = baby->getValue();
                                    } else {
                                        if(stepKey.compare("img")==0){
                                            sm.img = baby->getValue();
                                        } else if(stepKey.compare("video")==0){
                                            sm.video = baby->getValue();
                                        } else {
                                            console() << "I got a property of a cookstep that was unexpected: " << stepKey << ", " << baby->getValue();
                                        }
                                        
                                    }
                                }
                            } else if(greatChild->getTag().compare("key")==0){
                                if(recipes.size()>0 && sm.name.compare("")!=0){
                                    recipes.at(recipes.size()-1).steps.push_back(sm);
                                }
                                sm.name = sm.video = sm.img = "";
                                sm.name = greatChild->getValue();
                            }
                            
                        }
                        if(sm.name.compare("")!=0){
                            recipes.at(recipes.size()-1).steps.push_back(sm);
                        }
                    }
                    
                } else {
                   // do nothing?
                }
                
            }
        }
        
    }
}
开发者ID:mmacvey1,项目名称:video-table-interactive,代码行数:60,代码来源:AppModel.cpp

示例3: fromXml

void Warp::fromXml( const XmlTree &xml )
{
	mControlsX = xml.getAttributeValue<int>( "width", 2 );
	mControlsY = xml.getAttributeValue<int>( "height", 2 );
	mBrightness = xml.getAttributeValue<float>( "brightness", 1.0f );

	// load control points
	mPoints.clear();
	for( auto child = xml.begin( "controlpoint" ); child != xml.end(); ++child ) {
		float x = child->getAttributeValue<float>( "x", 0.0f );
		float y = child->getAttributeValue<float>( "y", 0.0f );
		mPoints.push_back( vec2( x, y ) );
	}

	// load blend params
	auto blend = xml.find( "blend" );
	if( blend != xml.end() ) {
		mExponent = blend->getAttributeValue<float>( "exponent", mExponent );

		auto edges = blend->find( "edges" );
		if( edges != blend->end() ) {
			mEdges.x = edges->getAttributeValue<float>( "left", mEdges.x );
			mEdges.y = edges->getAttributeValue<float>( "top", mEdges.y );
			mEdges.z = edges->getAttributeValue<float>( "right", mEdges.z );
			mEdges.w = edges->getAttributeValue<float>( "bottom", mEdges.w );
		}

		auto gamma = blend->find( "gamma" );
		if( gamma != blend->end() ) {
			mGamma.x = gamma->getAttributeValue<float>( "red", mGamma.x );
			mGamma.y = gamma->getAttributeValue<float>( "green", mGamma.y );
			mGamma.z = gamma->getAttributeValue<float>( "blue", mGamma.z );
		}

		auto luminance = blend->find( "luminance" );
		if( luminance != blend->end() ) {
			mLuminance.x = luminance->getAttributeValue<float>( "red", mLuminance.x );
			mLuminance.y = luminance->getAttributeValue<float>( "green", mLuminance.y );
			mLuminance.z = luminance->getAttributeValue<float>( "blue", mLuminance.z );
		}
	}

	// reconstruct warp
	mIsDirty = true;
}
开发者ID:UIKit0,项目名称:Cinder-Warping,代码行数:45,代码来源:Warp.cpp

示例4: trace

void PlistReader::trace(XmlTree t){
    for( XmlTree::Iter child = t.begin(); child != t.end(); ++child ){
        console() << "Tag: " << child->getTag() << "  Value: " << child->getValue() << endl;
        if(child->getTag().compare("dict")==0){
            trace(*child);
        }
        
    }
}
开发者ID:camb416,项目名称:PLister,代码行数:9,代码来源:PlistReader.cpp

示例5: mNodeType

XmlTree::XmlTree( const XmlTree &rhs )
	: mNodeType( rhs.mNodeType ), mTag( rhs.mTag ), mValue( rhs.mValue ), mDocType( rhs.mDocType ),
	 mParent( 0 ), mAttributes( rhs.mAttributes )
{
	for( XmlTree::ConstIter childIt = rhs.begin(); childIt != rhs.end(); ++childIt ) {
		mChildren.push_back( unique_ptr<XmlTree>( new XmlTree( *childIt ) ) );
		mChildren.back()->mParent = this;
	}
}
开发者ID:Ahbee,项目名称:Cinder,代码行数:9,代码来源:Xml.cpp

示例6: setup

void FlickrTestApp::setup()
{
	glEnable( GL_TEXTURE_2D );

	const XmlTree xml( loadUrl( Url( "http://api.flickr.com/services/feeds/[email protected]&lang=en-us&format=rss_200" ) ) );
	for( XmlTree::ConstIter item = xml.begin( "rss/channel/item" ); item != xml.end(); ++item ) {
		mUrls.push_back( item->getChild( "media:content" ).getAttributeValue<Url>( "url" ) );
	}

	createTextureFromURL();
	lastTime = getElapsedSeconds();
	activeTex = 0;
}
开发者ID:kevinbs,项目名称:Cinder-portfolio,代码行数:13,代码来源:flickrTest.cpp

示例7: initFromXml

void CanvasComponent::initFromXml(const XmlTree& xml, bool createNodes)
{
    id = xml.getAttributeValue<int>("id");
    // when loading a patch, update globalID so future
    // nodes will be created with a unique id
    if (globalComponentID <= id) {
        // increment global id so each component will have a unique id
        globalComponentID = id+1;
    }
    
    setName(xml.getAttributeValue<std::string>("name"));
    Vec2f pos = Vec2f(xml.getAttributeValue<float>("position.x"), xml.getAttributeValue<float>("position.y"));
    Vec2f size = Vec2f(xml.getAttributeValue<float>("size.x"), xml.getAttributeValue<float>("size.y"));
    canvasRect = Rectf(pos, pos+size);
    
    setSize(size);
    
    showInputPlus = xml.getAttributeValue<bool>("showInputPlus");
    showOutputPlus = xml.getAttributeValue<bool>("showOutputPlus");
    
    if (createNodes)
    {
        // add inputs and outputs
        XmlTree inputNodesTree = xml.getChild("InputNodes");
        for(XmlTree::ConstIter iter = inputNodesTree.begin(); iter != inputNodesTree.end(); ++iter)
        {
            if (iter->getTag() == "Node") {
                addInputNodeFromXml(iter->getChild(""));
            }
        }
        XmlTree outputNodesTree = xml.getChild("OutputNodes");
        for(XmlTree::ConstIter iter = outputNodesTree.begin(); iter != outputNodesTree.end(); ++iter)
        {
            if (iter->getTag() == "Node") {
                addOutputNodeFromXml(iter->getChild(""));
            }
        }
    }
}
开发者ID:galsasson,项目名称:controlease,代码行数:39,代码来源:CanvasComponent.cpp

示例8: parseData

void DataManager::parseData( XmlTree d ){
    XmlTree data  = d.getChild( "QLT_Genome_Data" );
    string dataPath = data.getChild( "datapath" ).getValue();
    XmlTree sets = data.getChild( "datasets");
    for( XmlTree::Iter dataset = sets.begin(); dataset != sets.end(); ++dataset ){
        GenomeDataStructure gds;
        gds.id = dataset->getAttributeValue<int>("id");
        gds.name = dataset->getChild("title").getValue();
        gds.pathMap = dataPath+dataset->getChild("map").getValue();
        gds.pathBases = dataPath+dataset->getChild("bases").getValue();
        mDataStructure.push_back( gds );
        console() << " GenomeDataStructure : " << gds.name << "         " << gds.pathMap << "   " << gds.pathBases << std::endl;
    }
}
开发者ID:saynono,项目名称:QLT_GenomeLaser,代码行数:14,代码来源:DataManager.cpp

示例9: setup

void XMLTestApp::setup()
{
	XmlTree doc( loadFile( getAssetPath( "library.xml" ) ) );
	XmlTree musicLibrary( doc.getChild( "library" ) );
	for( XmlTree::ConstIter item = doc.begin("library/album"); item != doc.end(); ++item ) {
		console() << "Node: " << item->getTag() << " Value: " << item->getValue() << endl;
	}

	for( XmlTree::ConstIter track = doc.begin("library/album/track"); track != doc.end(); ++track )
		console() << track->getValue() << endl;

	assert( (musicLibrary / "album")["musician"] == "John Coltrane" );

	// test that /one/two is equivalent to one/two
	vector<string> noLeadingSeparator, leadingSeparator;
	for( XmlTree::ConstIter track = doc.begin("library/album/track"); track != doc.end(); ++track )
		noLeadingSeparator.push_back( track->getValue() );
	for( XmlTree::ConstIter track = doc.begin("/library/album/track"); track != doc.end(); ++track )
		leadingSeparator.push_back( track->getValue() );
	assert( noLeadingSeparator == leadingSeparator );

	XmlTree firstAlbum = doc.getChild( "library/album" );
	for( XmlTree::Iter child = firstAlbum.begin(); child != firstAlbum.end(); ++child ) {
		console() << "Tag: " << child->getTag() << "  Value: " << child->getValue() << endl;
	}
	console() << doc.getChild( "library/owner/city" );
	XmlTree ownerCity = doc.getChild( "///library/////owner/city" );
	console() << "Path: " << ownerCity.getPath() << "  Value: " << ownerCity.getValue() << std::endl;
	console() << doc;
	
	console() << findTrackNamed( doc.getChild( "library" ), "Wolf" );
	
	// Whoops - assignment by value doesn't modifying the original XmlTree
	XmlTree firstTrackCopy = doc.getChild( "/library/album/track" );
	firstTrackCopy.setValue( "Replacement name" );
	console() << doc.getChild( "/library/album/track" ) << std::endl;

	XmlTree &firstTrackRef = doc.getChild( "/library/album/track" );
	firstTrackRef.setValue( "Replacement name" );
	console() << doc.getChild( "/library/album/track" ) << std::endl;

	XmlTree albumCopy = copyFirstAlbum( doc / "library" );
	console() << ( albumCopy / "track" ).getPath() << std::endl; // should print 'newRoot/track'

	// This code only works in VC2010
/*	std::for_each( doc.begin( "library/album" ), doc.end(), []( const XmlTree &child ) {
		app::console() << child.getChild( "title" ).getValue() << std::endl;
	} );*/
}
开发者ID:AKS2346,项目名称:Cinder,代码行数:49,代码来源:XMLTestApp.cpp

示例10: fromXml

void WarpPerspectiveBilinear::fromXml(const XmlTree &xml)
{
	WarpBilinear::fromXml(xml);

	// get corners
	unsigned i = 0;
	for(XmlTree::ConstIter child=xml.begin("corner");child!=xml.end();++child) {
		float x = child->getAttributeValue<float>("x", 0.0f);
		float y = child->getAttributeValue<float>("y", 0.0f);

		mWarp->setControlPoint(i, Vec2f(x, y));

		i++;
	}
}
开发者ID:Aurite,项目名称:museomix-pimp-my-room,代码行数:15,代码来源:WarpPerspectiveBilinear.cpp

示例11: readSettings

WarpList Warp::readSettings( const DataSourceRef &source )
{
	XmlTree  doc;
	WarpList warps;

	// try to load the specified xml file
	try {
		doc = XmlTree( source );
	}
	catch( ... ) {
		return warps;
	}

	// check if this is a valid file
	bool isWarp = doc.hasChild( "warpconfig" );
	if( !isWarp ) return warps;

	//
	if( isWarp ) {
		// get first profile
		XmlTree profileXml = doc.getChild( "warpconfig/profile" );

		// iterate maps
		for( XmlTree::ConstIter child = profileXml.begin( "map" ); child != profileXml.end(); ++child ) {
			XmlTree warpXml = child->getChild( "warp" );

			// create warp of the correct type
			std::string method = warpXml.getAttributeValue<std::string>( "method", "unknown" );
			if( method == "bilinear" ) {
				WarpBilinearRef warp( new WarpBilinear() );
				warp->fromXml( warpXml );
				warps.push_back( warp );
			}
			else if( method == "perspective" ) {
				WarpPerspectiveRef warp( new WarpPerspective() );
				warp->fromXml( warpXml );
				warps.push_back( warp );
			}
			else if( method == "perspectivebilinear" ) {
				WarpPerspectiveBilinearRef warp( new WarpPerspectiveBilinear() );
				warp->fromXml( warpXml );
				warps.push_back( warp );
			}
		}
	}

	return warps;
}
开发者ID:UIKit0,项目名称:Cinder-Warping,代码行数:48,代码来源:Warp.cpp

示例12: if

UserArea::UserArea(XmlTree area, PhidgetConnector *pc_)
{
    
    // okay so if theres attributes aren't here, it bugs out it would seem?
    pos = Vec2f(area.getAttributeValue<float>( "centerX" ), area.getAttributeValue<float>( "centerY" ));
    angle = area.getAttributeValue<float>( "angle" );
    key = area.getAttributeValue<char>( "key" );
    
    
    // this should be loading from the XML.
    background = "area_background.png";
    
    // there is some serious abstracting to be done here
    string activeArea_str = "active_area.png";
    
    
    
    bg_img.load(background);
    activeArea_img.load(activeArea_str);
    
    // really, still? hmmm
    // mTexture = gl::Texture( loadImage( loadResource( background ) ) );
    
    
    vector<string> videos;
    for( XmlTree::Iter child = area.begin(); child != area.end(); ++child)
    {
        if ( child->getTag() == "video" )
            videos.push_back(child->getValue());
        else if ( child->getTag() == "button" )
        {
            XmlTree b = *child;
            //buttons.push_back(Button::Button(b/*, &UserArea::nextMovie*/));
            buttons.push_back(TwoStateButton(b));
            buttonStates.push_back(false);
           
           // void (UserArea::*func)() = &UserArea::nextMovie;
          /*  void (*func)() = &printTest;
            func(); */
        }
    }
    player = VideoPlayer ( Rectf(0, 0, 640, 480), videos);
    frameCount = rand() % 628;
    
    pc = pc_;
}
开发者ID:camb416,项目名称:video-table-interactive,代码行数:46,代码来源:UserArea.cpp

示例13: loadXML

void ConfigDict::loadXML(DataSourceRef source)
{
	XmlTree doc;
	try {
		doc = XmlTree(source);	
	} catch(rapidxml::parse_error &e) {
		LOG_ERROR("ConfigDict::loadXML - couldnt parse XML data ("<< 
				  "error: "<< e.what() <<" "<<
				  "file: "<< source->getFilePathHint() <<
				  ")");
	}
	
	XmlTree root = *doc.begin();
	
	for(XmlTree::ConstIter setting = root.begin(); setting != root.end(); ++setting) 
	{
		string key = setting->getTag();
		string value = setting->getValue();
		settings.insert(std::pair<string,string>(key, value) );
	}
}
开发者ID:audionerd,项目名称:FieldKit.cpp,代码行数:21,代码来源:ConfigDict.cpp

示例14: init

void License::init( XmlTree &doc )
{
	if( doc.hasChild( "License" ))
	{
		XmlTree xmlLicense = doc.getChild( "License" );

		string product = xmlLicense.getAttributeValue<string>( "Product", ""  );
		string key     = xmlLicense.getAttributeValue<string>( "Key"    , ""  );

		setProduct( product );
		setKeyPath( getAssetPath( key ));

		for( XmlTree::Iter child = xmlLicense.begin(); child != xmlLicense.end(); ++child )
		{
			if( child->getTag() == "Server" )
			{
				string server = child->getAttributeValue<string>( "Name" );
				addServer( server );
			}
		}
	}
}
开发者ID:bgbotond,项目名称:License,代码行数:22,代码来源:License.cpp

示例15: if

TwoStateButton::TwoStateButton(XmlTree xml)
{
    pos.x = xml.getAttributeValue<float>( "posX" );
    pos.y = xml.getAttributeValue<float>( "posY" );
    float angle = xml.getAttributeValue<float>( "angle" );
    device = xml.getAttributeValue<int>( "device" );
    sensor = xml.getAttributeValue<int>( "sensor" );
    
    for( XmlTree::Iter img = xml.begin(); img != xml.end(); ++img)
    {
        if (img->getAttributeValue<string>( "id" ) == "active")
        {
            active = Image(img->getValue(), pos);
        }
        else if (img->getAttributeValue<string>( "id" ) == "inactive")
        {
            inactive = Image(img->getValue(), pos);
        }
    }
    active.setRotation(angle);
    inactive.setRotation(angle);
}
开发者ID:camb416,项目名称:video-table-interactive,代码行数:22,代码来源:TwoStateButton.cpp


注:本文中的XmlTree::end方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。