本文整理汇总了C++中NodeAttribute::SimpleCopy方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeAttribute::SimpleCopy方法的具体用法?C++ NodeAttribute::SimpleCopy怎么用?C++ NodeAttribute::SimpleCopy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeAttribute
的用法示例。
在下文中一共展示了NodeAttribute::SimpleCopy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Copy
CCAttrMap* CCAttrMap::Copy()
{
CCAttrMap *pNewAttrMap = new CCAttrMap( GetCount() );
if( pNewAttrMap != NULL )
{
// iterating all (key, value) pairs
for( iterator Pos = GetStartPosition(); Pos != GetEndPosition(); )
{
CCRuntimeClass *pType;
void *pVal;
GetNextAssoc( Pos, pType, pVal );
// Get the attribute value of this attribute
NodeAttribute* pAttr = (NodeAttribute*)pVal;
// Copy the attribute
NodeAttribute* pNewAttr = (NodeAttribute*) (pAttr->SimpleCopy());
// Stick the new attr into the new attr map
if (pNewAttr != NULL)
pNewAttrMap->SetAt(pNewAttr->GetAttributeType(),pNewAttr);
}
}
pNewAttrMap->attrMapCreator = attrMapCreator;
return pNewAttrMap;
}
示例2: Blend
BOOL NodeAttribute::Blend(BlendAttrParam* pBlendParam)
{
// Check NULL entry param
ERROR3IF(pBlendParam == NULL,"pBlendParam == NULL");
if (pBlendParam == NULL) return FALSE;
// Make a copy of this node, and make this the blended attribute
NodeAttribute* pBlendedAttr = NULL;
NodeAttribute* pAttrToCopy = NULL;
if (pBlendParam->GetBlendRatio() <= 0.5)
pAttrToCopy = this;
else
pAttrToCopy = pBlendParam->GetOtherAttr();
if (pAttrToCopy != NULL)
{
pBlendedAttr = (NodeAttribute*) pAttrToCopy->SimpleCopy();
pBlendParam->SetBlendedAttr(pBlendedAttr);
}
// Return TRUE if we were able to make a copy of this node
return (pBlendedAttr != NULL);
}
示例3: MakeAttributeComplete
BOOL NodeRenderableInk::MakeAttributeComplete(Node* Root,
BOOL CheckForDuplicates, /* = TRUE */
AttrTypeSet* pAffectedAttrTypes, /* = NULL */
BOOL IncludeDefaults, /* = FALSE */
BOOL bIncludeEffectAttrs /* = FALSE */)
{
Node* Current = NULL; // Pointer to the current node in the tree
NodeAttribute* CurAttr;
CCRuntimeClass* AttrType;
BOOL Exists;
Node* PreFirstChild = FindFirstChild(); // Remember the FirstChild of the node before we add
// any new attributes, this will come in handy if we
// need to abort.
// Loop until all attributes are copied, we are not interested in the defaults cos these are the
// same for all docs !.
if (bIncludeEffectAttrs)
Current = NodeAttribute::FindFirstAppliedAttr(this, Root);
else
Current = NodeAttribute::FindPrevAppliedAttr(this, Root);
while (Current && (IncludeDefaults || (!(IS_A(Current->FindParent(), NodeDocument)))) )
{
// Find the next node, snaking up the tree
if (Current->IsAnAttribute())
{
CurAttr = (NodeAttribute*)Current;
if (CurAttr->CanBeAppliedToObject() && CurAttr->ShouldBeOptimized())
{
AttrType = CurAttr->GetAttributeType();
BOOL Required = RequiresAttrib(AttrType) || this->IsCompound();
// Is the attribute required ?
if (Required && (!pAffectedAttrTypes || pAffectedAttrTypes->InSet(AttrType)))
{
Exists = FALSE;
if (CheckForDuplicates)
{
// triggers can have duplicates
if(!CurAttr->CanBeMultiplyApplied())
{
// Does the node already have this child attribute
Exists = (GetChildAttrOfType(AttrType) != NULL);
}
}
#ifdef _DEBUG
if (!CheckForDuplicates)
{
// If we feel there is no need to check for duplicates then there shouldn't be any !
if (!CurAttr->CanBeMultiplyApplied())
{
NodeAttribute* pChildAttr = GetChildAttrOfType(AttrType);
if ((pChildAttr != NULL))
{
#if DEBUG_TREE
DebugTreeDlg::DumpSubTree(this, 4);
#endif
TRACE(_T("Duplicate Attr found at %x %s\n"), pChildAttr, pChildAttr->GetRuntimeClass()->m_lpszClassName);
}
// ERROR3IF((pChildAttr != NULL), "MakeAttributeComplete: Duplicate attr found !");
}
}
#endif
if (!Exists)
{
// Make a copy of the attribute
NodeAttribute* NewAttr = (NodeAttribute*)CurAttr->SimpleCopy();
if (NewAttr == NULL)
{
goto OutOfMemory;
}
// Now add the attribute to this node
NewAttr->AttachNode(this, FIRSTCHILD, TRUE, FALSE);
}
}
}
}
Current = NodeAttribute::FindPrevAppliedAttr(Current, Root);
// in order to copy brush ink nodes we need to break if the parent is NULL, else is violates
if (Current!=NULL && Current->FindParent() == NULL)
break;
}
return TRUE;
OutOfMemory:
// Delete any new attributes added to the node
Current = FindFirstChild();
Node* Next;
while (Current != PreFirstChild)
{
//.........这里部分代码省略.........