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


C++ YamlNode::RemoveNodeFromMap方法代码示例

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


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

示例1: VariantType

YamlNode * UIStaticText::SaveToYamlNode(UIYamlLoader * loader)
{
    YamlNode *node = UIControl::SaveToYamlNode(loader);

    // Sprite node is not needed for UITextField.
    YamlNode *spriteNode = node->Get("sprite");
    if (spriteNode)
    {
        node->RemoveNodeFromMap("sprite");
    }

    //Temp variable
    VariantType *nodeValue = new VariantType();
    
    //Control Type
    node->Set("type", "UIStaticText");

    //Font
    //Get font name and put it here
    nodeValue->SetString(FontManager::Instance()->GetFontName(this->GetFont()));
    node->Set("font", nodeValue);

    //Text
    nodeValue->SetWideString(GetText());
    node->Set("text", nodeValue);    
    //Multiline
    node->Set("multiline", this->textBlock->GetMultiline());
    //multilineBySymbol
    node->Set("multilineBySymbol", this->textBlock->GetMultilineBySymbol());
    //fitting - STRING OF INT???  
    node->Set("fitting", this->textBlock->GetFittingOption());
    
    SafeDelete(nodeValue);
    
    return node;
}
开发者ID:dima-belsky,项目名称:dava.framework,代码行数:36,代码来源:UIStaticText.cpp

示例2: path

	YamlNode * UIButton::SaveToYamlNode(UIYamlLoader * loader)
	{
		YamlNode *node = UIControl::SaveToYamlNode(loader);
		//Temp variable
		VariantType *nodeValue = new VariantType();
		String stringValue;
		
		UIButton *baseControl = new UIButton();
		
		//Control Type
		SetPreferredNodeType(node, "UIButton");
        
		//Remove values of UIControl
		//UIButton has state specific properties
		YamlNode *colorNode = node->Get("color");
		YamlNode *spriteNode = node->Get("sprite");
		YamlNode *drawTypeNode = node->Get("drawType");
		YamlNode *colorInheritNode = node->Get("colorInherit");
		YamlNode *alignNode = node->Get("align");
		YamlNode *leftRightStretchCapNode = node->Get("leftRightStretchCap");
		YamlNode *topBottomStretchCapNode = node->Get("topBottomStretchCap");
		YamlNode *spriteModificationNode = node->Get("spriteModification");
        
		if (colorNode)
		{
			node->RemoveNodeFromMap("color");
		}
		if (spriteNode)
		{
			node->RemoveNodeFromMap("sprite");
		}
		if (drawTypeNode)
		{
			node->RemoveNodeFromMap("drawType");
		}
		if (colorInheritNode)
		{
			node->RemoveNodeFromMap("colorInherit");
		}
		if (alignNode)
		{
			node->RemoveNodeFromMap("align");
		}
		if (leftRightStretchCapNode)
		{
			node->RemoveNodeFromMap("leftRightStretchCap");
		}
		if (topBottomStretchCapNode)
		{
			node->RemoveNodeFromMap("topBottomStretchCap");
		}
		if (spriteModificationNode)
		{
			node->RemoveNodeFromMap("spriteModification");
		}
        
		//States cycle for values
		for (int i = 0; i < STATE_COUNT; ++i)
		{
			//Get sprite and frame for state
			Sprite *stateSprite = this->GetStateSprite(stateArray[i]);
			int32 stateFrame = this->GetStateFrame(stateArray[i]);
			if (stateSprite)
			{
				//Create array yamlnode and add it to map
				YamlNode *spriteNode = new YamlNode(YamlNode::TYPE_ARRAY);
                
                FilePath path(stateSprite->GetRelativePathname());
                path.TruncateExtension();

                String pathname = path.GetFrameworkPath();
				spriteNode->AddValueToArray(pathname);
                
				spriteNode->AddValueToArray(stateFrame);
				int32 modification = stateBacks[BackgroundIndexForState((eButtonDrawState)i)]->GetModification();
				spriteNode->AddValueToArray(modification);
				node->AddNodeToMap(Format("stateSprite%s", statePostfix[i].c_str()), spriteNode);
			}

			//StateDrawType
			UIControlBackground::eDrawType drawType = this->GetStateDrawType(stateArray[i]);
			if (baseControl->GetStateDrawType(stateArray[i]) != drawType)
			{
				node->Set(Format("stateDrawType%s", statePostfix[i].c_str()), loader->GetDrawTypeNodeValue(drawType));
			}
			//leftRightStretchCap
			float32 leftStretchCap = this->GetActualBackground(stateArray[i])->GetLeftRightStretchCap();
			float32 baseLeftStretchCap = baseControl->GetActualBackground(stateArray[i])->GetLeftRightStretchCap();
			if (baseLeftStretchCap != leftStretchCap)
			{
				node->Set(Format("leftRightStretchCap%s", statePostfix[i].c_str()), leftStretchCap);
			}
			//topBottomStretchCap
			float32 topBottomStretchCap = this->GetActualBackground(stateArray[i])->GetTopBottomStretchCap();
			float32 baseTopBottomStretchCap = baseControl->GetActualBackground(stateArray[i])->GetTopBottomStretchCap();
			if (baseTopBottomStretchCap != topBottomStretchCap)
			{
				node->Set(Format("topBottomStretchCap%s", statePostfix[i].c_str()), topBottomStretchCap);
			}
			//State align
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例3: UIStaticText

YamlNode * UIStaticText::SaveToYamlNode(UIYamlLoader * loader)
{
    YamlNode *node = UIControl::SaveToYamlNode(loader);

    // Sprite node is not needed for UITextField.
    YamlNode *spriteNode = node->Get("sprite");
    if (spriteNode)
    {
        node->RemoveNodeFromMap("sprite");
    }
	
	UIStaticText *baseControl = new UIStaticText();	

    //Temp variable
    VariantType *nodeValue = new VariantType();
    
    //Control Type
	SetPreferredNodeType(node, "UIStaticText");

    //Font
    //Get font name and put it here
    nodeValue->SetString(FontManager::Instance()->GetFontName(this->GetFont()));
    node->Set("font", nodeValue);

	//TextColor
	nodeValue->SetVector4(Vector4(textColor.r, textColor.g, textColor.b, textColor.a));
	node->Set("textcolor", nodeValue);

	// ShadowColor
	nodeValue->SetVector4(Vector4(shadowColor.r, shadowColor.g, shadowColor.b, shadowColor.a));
	node->Set("shadowcolor", nodeValue);

	// ShadowOffset
	nodeValue->SetVector2(GetShadowOffset());
	node->Set("shadowoffset", nodeValue);

    //Text
    nodeValue->SetWideString(GetText());
    node->Set("text", nodeValue);    
    //Multiline
	if (baseControl->textBlock->GetMultiline() != this->textBlock->GetMultiline())
	{
    	node->Set("multiline", this->textBlock->GetMultiline());
	}
    //multilineBySymbol
	if (baseControl->textBlock->GetMultilineBySymbol() != this->textBlock->GetMultilineBySymbol())
	{
    	node->Set("multilineBySymbol", this->textBlock->GetMultilineBySymbol());
	}
    //fitting - STRING OF INT???
	if (baseControl->textBlock->GetFittingOption() != this->textBlock->GetFittingOption())
	{
    	node->Set("fitting", this->textBlock->GetFittingOption());
	}
    
	// Align
	node->SetNodeToMap("align", loader->GetAlignNodeValue(this->GetAlign()));

	// Draw type. Must be overriden for UITextControls.
	node->Set("drawType", loader->GetDrawTypeNodeValue(this->GetBackground()->GetDrawType()));

    SafeDelete(nodeValue);
	SafeRelease(baseControl);
    
    return node;
}
开发者ID:,项目名称:,代码行数:66,代码来源:

示例4: VariantType

	YamlNode * UIButton::SaveToYamlNode(UIYamlLoader * loader)
	{
		YamlNode *node = UIControl::SaveToYamlNode(loader);
		//Temp variable
		VariantType *nodeValue = new VariantType();
		String stringValue;

		//Control Type
		node->Set("type", "UIButton");
        
		//Remove values of UIControl
		YamlNode *spriteNode = node->Get("sprite");
		YamlNode *drawTypeNode = node->Get("drawType");
		YamlNode *colorInheritNode = node->Get("colorInherit");
		YamlNode *alignNode = node->Get("align");
		YamlNode *leftRightStretchCapNode = node->Get("leftRightStretchCap");
		YamlNode *topBottomStretchCapNode = node->Get("topBottomStretchCap");
        
		if (spriteNode)
		{
			node->RemoveNodeFromMap("sprite");
		}
		if (drawTypeNode)
		{
			node->RemoveNodeFromMap("drawType");
		}
		if (colorInheritNode)
		{
			node->RemoveNodeFromMap("colorInherit");
		}
		if (alignNode)
		{
			node->RemoveNodeFromMap("align");
		}
		if (leftRightStretchCapNode)
		{
			node->RemoveNodeFromMap("leftRightStretchCap");
		}
		if (topBottomStretchCapNode)
		{
			node->RemoveNodeFromMap("topBottomStretchCap");
		}
        
		//States cycle for values
		for (int i = 0; i < STATE_COUNT; ++i)
		{
			//Get sprite and frame for state
			Sprite *stateSprite = this->GetStateSprite(stateArray[i]);
			int32 stateFrame = this->GetStateFrame(stateArray[i]);
			if (stateSprite)
			{
				//Create array yamlnode and add it to map
				YamlNode *spriteNode = new YamlNode(YamlNode::TYPE_ARRAY);
				spriteNode->AddValueToArray(TruncateTxtFileExtension(stateSprite->GetName()));
				spriteNode->AddValueToArray(stateFrame);
				node->AddNodeToMap(Format("stateSprite%s", statePostfix[i].c_str()), spriteNode);
			}

			//StateDrawType
			UIControlBackground::eDrawType drawType = this->GetStateDrawType(stateArray[i]); 
			node->Set(Format("stateDrawType%s", statePostfix[i].c_str()), loader->GetDrawTypeNodeValue(drawType));
			//leftRightStretchCap
			float32 leftStretchCap = this->GetActualBackground(stateArray[i])->GetLeftRightStretchCap();
			node->Set(Format("leftRightStretchCap%s", statePostfix[i].c_str()), leftStretchCap);            
			//topBottomStretchCap
			float32 topBottomStretchCap = this->GetActualBackground(stateArray[i])->GetTopBottomStretchCap();
			node->Set(Format("topBottomStretchCap%s", statePostfix[i].c_str()), topBottomStretchCap);
			//State align
			node->Set(Format("stateAlign%s", statePostfix[i].c_str()), this->GetStateAlign(stateArray[i]));
			//State font
            
			Font *stateFont = this->GetStateTextControl(stateArray[i])->GetFont();
			node->Set(Format("stateFont%s", statePostfix[i].c_str()), FontManager::Instance()->GetFontName(stateFont));
			//StateText
			if (this->GetStateTextControl(stateArray[i]))
			{
				nodeValue->SetWideString(this->GetStateTextControl(stateArray[i])->GetText());
				node->Set(Format("stateText%s", statePostfix[i].c_str()), nodeValue);
			}
            
			//colorInherit ???? For different states?
			// Yuri Coder, 2012/11/16. Temporarily commented out until clarification.
			//UIControlBackground::eColorInheritType colorInheritType = this->GetStateBackground(stateArray[i])->GetColorInheritType();
			//node->Set(Format("stateColorInherit%s", statePostfix[i].c_str()), loader->GetColorInheritTypeNodeValue(colorInheritType));
		}
        
		SafeDelete(nodeValue);
        
		return node;
	}
开发者ID:dima-belsky,项目名称:dava.framework,代码行数:90,代码来源:UIButton.cpp


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