• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ YamlNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: SaveToYamlNode

YamlNode* UIAggregatorControl::SaveToYamlNode(UIYamlLoader * loader)
{
	YamlNode* node = UIControl::SaveToYamlNode(loader);
	SetPreferredNodeType(node, "UIAggregatorControl");
	node->Set(AGGREGATOR_PATH, aggregatorPath.GetFrameworkPath());
	return node;
}
开发者ID:droidenko,项目名称:dava.framework,代码行数:7,代码来源:UIAggregatorControl.cpp


示例2: ColorToVector

YamlNode* PropertyLineYamlWriter::WriteColorPropertyLineToYamlNode(YamlNode* parentNode, const String& propertyName,
                                                                   RefPtr<PropertyLine<Color> > propertyLine)
{
    // Write the property line.
    Vector<PropValue<Color> > wrappedPropertyValues = PropLineWrapper<Color>(propertyLine).GetProps();
    if (wrappedPropertyValues.empty())
    {
        return NULL;
    }

    if (wrappedPropertyValues.size() == 1)
    {
        // This has to be single string value. Write Colors as Vectors.
        parentNode->Set(propertyName, ColorToVector(wrappedPropertyValues.at(0).v));
        return NULL;
    }

    // Create the child array node.
    YamlNode* childNode = new YamlNode(YamlNode::TYPE_ARRAY);
    for (Vector<PropValue<Color> >::iterator iter = wrappedPropertyValues.begin();
         iter != wrappedPropertyValues.end(); iter ++)
    {        
        childNode->AddValueToArray((*iter).t);
        childNode->AddValueToArray(ColorToVector((*iter).v));
    }

    parentNode->AddNodeToMap(propertyName, childNode);
    return childNode;
}
开发者ID:,项目名称:,代码行数:29,代码来源:


示例3:

YamlNode * UIList::SaveToYamlNode(UIYamlLoader * loader)
{
	YamlNode *node = UIControl::SaveToYamlNode(loader);
	//Temp variable
	String stringValue;
    
	//Control Type
	node->Set("type", "UIList");
	//Orientation
	eListOrientation orient = this->GetOrientation();
	switch(orient)
	{
		case ORIENTATION_VERTICAL:
			stringValue = "ORIENTATION_VERTICAL";
			break;
		case ORIENTATION_HORIZONTAL:
			stringValue = "ORIENTATION_HORIZONTAL";
			break;
		default:
			stringValue = "ORIENTATION_VERTICAL";
			break;
	}
	node->Set("orientation", stringValue);
    
	return node;
}
开发者ID:dima-belsky,项目名称:dava.framework,代码行数:26,代码来源:UIList.cpp


示例4: LoadFromYamlNode

void UIScrollView::LoadFromYamlNode(YamlNode * node, UIYamlLoader * loader)
{
	UIControl::LoadFromYamlNode(node, loader);
	
	YamlNode *contentSizeNode = node->Get("contentSize");
	SetContentSize(contentSizeNode->AsPoint());
}		
开发者ID:,项目名称:,代码行数:7,代码来源:


示例5: SafeRelease

bool Shader::LoadFromYaml(const FilePath & pathname)
{
//#if defined(__DAVAENGINE_ANDROID__) || defined (__DAVAENGINE_MACOS__)
//    relativeFileName = pathname;
//#endif //#if defined(__DAVAENGINE_ANDROID__) 

    uint64 shaderLoadTime = SystemTimer::Instance()->AbsoluteMS();
    
    YamlParser * parser = YamlParser::Create(pathname);
    if (!parser)
        return false;
    
    YamlNode * rootNode = parser->GetRootNode();
    if (!rootNode)
    {
        SafeRelease(rootNode);
        return false;
    }
    
    const YamlNode * vertexShaderNode = rootNode->Get("vertexShader");
    if (!vertexShaderNode)
    {
        SafeRelease(parser);
        return false;
    }

    const YamlNode * glslVertexNode = vertexShaderNode->Get("glsl");
    if (!glslVertexNode)
    {
        SafeRelease(parser);
        return false;
    }
    
    const YamlNode * fragmentShaderNode = rootNode->Get("fragmentShader");
    if (!fragmentShaderNode)
    {
        SafeRelease(parser);
        return false;
    }
    
    const YamlNode * glslFragmentNode = fragmentShaderNode->Get("glsl");
    if (!glslFragmentNode)
    {
        SafeRelease(parser);
        return false;
    }

    FilePath pathOnly(pathname.GetDirectory());
    vertexShaderPath = pathOnly + glslVertexNode->AsString();
    fragmentShaderPath = pathOnly + glslFragmentNode->AsString();
    SafeRelease(parser);

    Load(vertexShaderPath, fragmentShaderPath);
    
    shaderLoadTime = SystemTimer::Instance()->AbsoluteMS() - shaderLoadTime;
    
//    Logger::FrameworkDebug("shader loaded:%s load-time: %lld ms", pathname.c_str(), shaderLoadTime);
    return true;
}
开发者ID:droidenko,项目名称:dava.framework,代码行数:59,代码来源:Shader.cpp


示例6: getValue

bool 
YamlMapping::equalTo(char *k, char *val){
	YamlNode *n = getValue(k);
	if(n != NULL){
		return n->equalTo(val);
	}
	return false;
}
开发者ID:s15mh218,项目名称:openrtm_tutorial,代码行数:8,代码来源:YamlParser.cpp


示例7: find

bool YamlMapping::read(const std::string &key, double &out_value) const
{
    YamlNode* node = find(toUtf8(key));
    if(node->isValid()){
        out_value = node->toDouble();
        return true;
    }
    return false;
}
开发者ID:thomas-moulard,项目名称:choreonoid-deb,代码行数:9,代码来源:YamlNodes.cpp


示例8:

YamlMapping *
YamlSequence::getMappingAt(int x)
{
	try{
		YamlNode *n = value.at(x);
		return n->toMapping();
	}catch(std::out_of_range& e){
		return NULL;
	}
}
开发者ID:s15mh218,项目名称:openrtm_tutorial,代码行数:10,代码来源:YamlParser.cpp


示例9: SetSize

bool HierarchyTreePlatformNode::Load(YamlNode* platform)
{
	YamlNode* width = platform->Get(WIDTH_NODE);
	YamlNode* height = platform->Get(HEIGHT_NODE);
	if (!width || !height)
		return false;
	
	bool result = true;
	SetSize(width->AsInt(), height->AsInt());
	ActivatePlatform();
	
	YamlNode* screens = platform->Get(SCREENS_NODE);
	if (screens)
	{
		for (int i = 0; i < screens->GetCount(); i++)
		{
			YamlNode* screen = screens->Get(i);
			if (!screen)
				continue;
			String screenName = screen->AsString();
			
			QString screenPath = QString(SCREEN_PATH).arg(GetResourceFolder()).arg(QString::fromStdString(screenName));
			HierarchyTreeScreenNode* screenNode = new HierarchyTreeScreenNode(this, QString::fromStdString(screenName));
			result &= screenNode->Load(screenPath);
			AddTreeNode(screenNode);
		}
	}
	return result;
}
开发者ID:dima-belsky,项目名称:dava.framework,代码行数:29,代码来源:HierarchyTreePlatformNode.cpp


示例10: DeviceInfo

void GameCore::OnAppStarted()
{
    DeviceInfo();
    
	SettingsManager::Instance()->InitWithFile("~res:/Config/config.yaml");
	
	cursor = 0;
	RenderManager::Instance()->SetFPS(60);

	String dirPath = "~res:/3d/Maps/";
	Vector<String> levelsPaths;
	YamlParser* parser = YamlParser::Create("~res:/maps.yaml");
	if(parser)
	{
		YamlNode* rootNode = parser->GetRootNode();
		if(rootNode)
		{
			int32 sz = rootNode->GetCount();

			for(DAVA::int32 i = 0; i < sz; ++i)
			{
				String k = rootNode->GetItemKeyName(i);
				String levelFile = rootNode->Get(i)->AsString();
				if(k != "default")
					levelsPaths.push_back(levelFile);
			}
		}
	}

	for(Vector<String>::const_iterator it = levelsPaths.begin(); it != levelsPaths.end(); ++it)
    {
		Test *test = new Test(dirPath + (*it));
		if(test != NULL)
        {
			UIScreenManager::Instance()->RegisterScreen(test->GetScreenId(), test);
			tests.push_back(test);
		}
	}

	if(levelsPaths.size() > 0)
    {
		appFinished = false;
		
		testCount = tests.size();
		Test *firstTest = tests.front();
		UIScreenManager::Instance()->SetFirst(firstTest->GetScreenId());
	}
    else
    {
		appFinished = true;
	}
    
	ConnectToDB();
}
开发者ID:vilonosec,项目名称:dava.framework,代码行数:54,代码来源:GameCore.cpp


示例11:

    YamlNode * UIListCell::SaveToYamlNode(UIYamlLoader * loader)
    {
        YamlNode *node = UIControl::SaveToYamlNode(loader);
        
        //Control Type
		SetPreferredNodeType(node, "UIListCell");

        //Identifier
        node->Set("identifier", this->GetIdentifier());
        
        return node;
    }
开发者ID:,项目名称:,代码行数:12,代码来源:


示例12: YamlNode

YamlNode *
YamlDocument::ParseYamlDoc()
{
	YamlNode *root = new YamlNode();

	yaml_event_delete(&event);

	do{
		yaml_parser_parse(&parser, &event);
		switch(event.type){
		case YAML_STREAM_END_EVENT:
		case YAML_DOCUMENT_END_EVENT:
			return root;

		case YAML_SEQUENCE_START_EVENT:
			{
				YamlSequence *v;
				v = ParseYamlSequence();
				root->addChild(reinterpret_cast<YamlNode *>(v));
			}
			break;
		case YAML_SEQUENCE_END_EVENT:
			break;
		case YAML_MAPPING_START_EVENT:
			{
				YamlMapping *v;
				v=ParseYamlMapping();
				root->addChild(reinterpret_cast<YamlNode *>(v));
			}
			break;
		case YAML_MAPPING_END_EVENT:
			break;

		case YAML_SCALAR_EVENT:
			{
				YamlScalar *v = new YamlScalar((char *)event.data.scalar.value );
				root->addChild(reinterpret_cast<YamlNode *>(v));
			}
			break;
		default:
			std::cout << "FORMAT ERROR" << std::endl;
			break;
		}
		if(event.type != YAML_DOCUMENT_END_EVENT){
			yaml_event_delete(&event);
		}
	}while(event.type != YAML_DOCUMENT_END_EVENT);

	yaml_event_delete(&event);

	return root;
}
开发者ID:s15mh218,项目名称:openrtm_tutorial,代码行数:52,代码来源:YamlParser.cpp


示例13: throwNotMappingException

YamlSequence* YamlMapping::findSequence(const std::string& key) const
{
    if(!isValid()){
        throwNotMappingException();
    }
    const_iterator p = values.find(toUtf8(key));
    if(p != values.end()){
        YamlNode* node = p->second.get();
        if(node->type() == YAML_SEQUENCE){
            return static_cast<YamlSequence*>(node);
        }
    }
    return invalidSequence.get();
}
开发者ID:thomas-moulard,项目名称:choreonoid-deb,代码行数:14,代码来源:YamlNodes.cpp


示例14: Load

bool HierarchyTreeAggregatorNode::Load(YamlNode* node, const QString& path)
{
	this->path = path.toStdString();
	YamlNode* width = node->Get(WIDTH_NODE);
	YamlNode* height = node->Get(HEIGHT_NODE);
	if (!width || !height)
		return false;

	rect = Rect(0, 0, width->AsInt(), height->AsInt());
	screen->SetRect(rect);

	bool result = HierarchyTreeScreenNode::Load(path);
	UpdateHierarchyTree();
	return result;
}
开发者ID:,项目名称:,代码行数:15,代码来源:


示例15: YamlNode

YamlNode * Font::SaveToYamlNode() const
{
    YamlNode *node = new YamlNode(YamlNode::TYPE_MAP);
    
    VariantType *nodeValue = new VariantType();
    //Type
    node->Set("type", "Font");
    //Font size
    node->Set("size", this->GetSize());
    //Vertical Spacing
    node->Set("verticalSpacing", this->GetVerticalSpacing());

    SafeDelete(nodeValue);
    
    return node;
}
开发者ID:galek,项目名称:dava.framework,代码行数:16,代码来源:Font.cpp


示例16: uKey

/**
   This is for internal use. Text are not converted to UTF-8.
*/
void YamlMapping::writeSub(const std::string &key, const char* text, size_t length, YamlStringStyle stringStyle)
{
    const string uKey(toUtf8(key));
    iterator p = values.find(uKey);
    if(p == values.end()){
        insertSub(uKey, new YamlScalar(text, length, stringStyle));
    } else {
        YamlNode* node = p->second.get();
        if(node->type() == YAML_SCALAR){
            YamlScalar* scalar = static_cast<YamlScalar*>(node);
            scalar->stringValue = string(text, length);
            scalar->stringStyle = stringStyle;
            scalar->indexInMapping = indexCounter++;
        } else {
            throwNotScalrException();
        }
    }
}
开发者ID:thomas-moulard,项目名称:choreonoid-deb,代码行数:21,代码来源:YamlNodes.cpp


示例17: LoadFromYamlNode

void UIAggregatorControl::LoadFromYamlNode(YamlNode * node, UIYamlLoader * loader)
{
	UIControl::LoadFromYamlNode(node, loader);
	
	YamlNode * pathNode = node->Get(AGGREGATOR_PATH);
	if (pathNode)
	{
		aggregatorPath = FilePath(pathNode->AsString());
		String aggregatorFileName = aggregatorPath.GetFilename();

		aggregatorPath = loader->GetCurrentPath() + aggregatorFileName;

		UIYamlLoader loader;
		loader.Load(this, aggregatorPath);

		aggregatorPath = FilePath(aggregatorFileName);
	}
}
开发者ID:boyjimeking,项目名称:dava.framework,代码行数:18,代码来源:UIAggregatorControl.cpp


示例18: YamlNode

void ParticleEmitter::SaveToYaml(const String & filename)
{
    YamlParser* parser = YamlParser::Create();
    if (!parser)
    {
        Logger::Error("ParticleEmitter::SaveToYaml() - unable to create parser!");
        return;
    }

    YamlNode* rootYamlNode = new YamlNode(YamlNode::TYPE_MAP);
    YamlNode* emitterYamlNode = new YamlNode(YamlNode::TYPE_MAP);
    rootYamlNode->AddNodeToMap("emitter", emitterYamlNode);

    emitterYamlNode->Set("3d", this->is3D);
    emitterYamlNode->Set("type", GetEmitterTypeName());

    // Write the property lines.
    PropertyLineYamlWriter::WritePropertyLineToYamlNode<float32>(emitterYamlNode, "emissionAngle", this->emissionAngle);
    PropertyLineYamlWriter::WritePropertyLineToYamlNode<float32>(emitterYamlNode, "emissionRange", this->emissionRange);
    PropertyLineYamlWriter::WritePropertyLineToYamlNode<Vector3>(emitterYamlNode, "emissionVector", this->emissionVector);

    // Yuri Coder, 2013/04/12. After the coordinates inversion for the emission vector we need to introduce the
    // new "emissionVectorInverted" flag to mark we don't need to invert coordinates after re-loading the YAML.
    PropertyLineYamlWriter::WritePropertyValueToYamlNode<bool>(emitterYamlNode, "emissionVectorInverted", true);

    PropertyLineYamlWriter::WritePropertyLineToYamlNode<float32>(emitterYamlNode, "radius", this->radius);

    PropertyLineYamlWriter::WriteColorPropertyLineToYamlNode(emitterYamlNode, "colorOverLife", this->colorOverLife);

    PropertyLineYamlWriter::WritePropertyLineToYamlNode<Vector3>(emitterYamlNode, "size", this->size);
    PropertyLineYamlWriter::WritePropertyValueToYamlNode<float32>(emitterYamlNode, "life", this->lifeTime);

    // Now write all the Layers. Note - layers are child of root node, not the emitter one.
    int32 layersCount = this->layers.size();
    for (int32 i = 0; i < layersCount; i ++)
    {
        this->layers[i]->SaveToYamlNode(rootYamlNode, i);
    }

    parser->SaveToYamlFile(filename, rootYamlNode, true);
    parser->Release();
}
开发者ID:,项目名称:,代码行数:42,代码来源:


示例19: TruncateTxtFileExtension

YamlNode * GraphicsFont::SaveToYamlNode()
{
    YamlNode *node = Font::SaveToYamlNode();
    
    //Type
    node->Set("type", "GraphicsFont");
    //horizontalSpacing
    node->Set("horizontalSpacing", this->GetHorizontalSpacing());
    //Sprite    
    Sprite *sprite = this->fontSprite;
    if (sprite)
    {
        //Truncate sprite ".txt" extension before save       
        node->Set("sprite", TruncateTxtFileExtension(sprite->GetName()));
    }    
    //Font Definition
    node->Set("definition", this->GetFontDefinitionName());

    return node;
}
开发者ID:abaradulkin,项目名称:dava.framework,代码行数:20,代码来源:GraphicsFont.cpp


示例20: OpenFile

void TheoraPlayer::LoadFromYamlNode(YamlNode * node, UIYamlLoader * loader)
{
    UIControl::LoadFromYamlNode(node, loader);
    YamlNode * fileNode = node->Get("file");
    
	if(fileNode)
        OpenFile(fileNode->AsString());
    
    YamlNode * rectNode = node->Get("rect");
    
    if(rectNode)
    {
        Rect rect = rectNode->AsRect();
        if(rect.dx == -1)
            rect.dx = theoraData->thInfo.pic_width;
        if(rect.dy == -1)
            rect.dy = theoraData->thInfo.pic_height;
        
        SetRect(rect);
    }
}
开发者ID:abaradulkin,项目名称:dava.framework,代码行数:21,代码来源:TheoraPlayer.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ YarpPluginSettings类代码示例发布时间:2022-05-31
下一篇:
C++ YMSGTransfer类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap