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


C++ AttributeValue::MakeNode方法代码示例

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


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

示例1: map

/********************************************************************************************

>	static CCAttrMap * CCAttrMap::MakeAttrMapFromRenderRegion(RenderRegion * pRegion)

	Author:		David_McClarnon (Xara Group Ltd) <[email protected]>
	Created:	24/2/2000
	Inputs:		The render region to get the attribute map from
	Outputs:	An attribute map (copied) from the render region
	Returns:	-
	Purpose:	Makes an attribute out of the render region's current attribute state
	Notes:		You MUST call DeleteAttributes afterwards to release memory - delete is
				not sufficient
	SeeAlso:	-

********************************************************************************************/
CCAttrMap * CCAttrMap::MakeAttrMapFromRenderRegion(RenderRegion * pRegion)
{
	CCAttrMap * pMap = new CCAttrMap;
	ENSURE(pMap,"No mem for attrmap");
	if(!pMap)
		return NULL;

	// let's get every attribute in the render region
	AttributeValue * pAttrVal = NULL;
	NodeAttribute * pNewAttr = NULL;

	for (UINT32 i = 0; i < ATTR_FIRST_FREE_ID; i++)
	{
		pAttrVal = pRegion->GetCurrentAttribute(i);

		// make a new node out of this attribute value
		pNewAttr = pAttrVal->MakeNode();
		
		// Karim 12/04/2000
		// AttributeValues _do_not_have_to_have_ a corresponding NodeAttribute,
		// so can we please *check* that MakeNode didn't just return NULL!
		if (pNewAttr != NULL)
		{
			if(!pNewAttr->IsLinkedToNodeGeometry())
				pMap->SetAt(pNewAttr->GetAttributeType(),pNewAttr);
			else
			{
				delete pNewAttr;
				pNewAttr = AttributeManager::GetDefaultAttribute((AttrIndex) i);
				if(pNewAttr)
				{
					ENSURE(pNewAttr->IsLinkedToNodeGeometry(),"Incorrect NodeAttribute returned by GetDefaultAttribute");
					pMap->SetAt(pNewAttr->GetAttributeType(), pNewAttr);
				}
				else
					return NULL;
			}
		}
	}

	pMap->attrMapCreator = NULL;

	return pMap;
}
开发者ID:Amadiro,项目名称:xara-cairo,代码行数:59,代码来源:attrmap.cpp

示例2: Blend

BOOL AttrWebAddress::Blend(BlendAttrParam* pBlendParam)
{
	//Check our parameter
	ERROR2IF(pBlendParam == NULL, FALSE, "AttrWebAddress::Blend - NULL parameter");
	
	//Try and blend our WebAddressAttribute member variable
	if (Value.Blend(pBlendParam))
	{
		// Get the blended attr val. After this call, the ptr is our reponsibility
		// so we have to delete it if it's no longer needed
		AttributeValue* pBlendedAttrVal = pBlendParam->GetBlendedAttrVal();

		if (pBlendedAttrVal != NULL)
		{
			// We have a blended attr val, so ask it to make a NodeAttribute out of itself
			// and set the pBlendParam's blended NodeAttribute ptr to it
			NodeAttribute* pBlendedAttr = pBlendedAttrVal->MakeNode();
			pBlendParam->SetBlendedAttr(pBlendedAttr);

			if (pBlendedAttr != NULL)
			{
				// We were able to make a blended NodeAttribute
				// so delete the blended attr val, and return TRUE
				delete pBlendedAttrVal;
				return TRUE;
			}
			else
			{
				// Couldn't make a blended NodeAttribute, so give the blended attr val back
				// and return FALSE
				pBlendParam->SetBlendedAttrVal(pBlendedAttrVal);
				return FALSE;
			}
		}
	}
	 	
	return FALSE;
}
开发者ID:UIKit0,项目名称:xara-xtreme,代码行数:38,代码来源:webattr.cpp


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