TemplateClassInstanceTypeNode* NamespaceTypeNode::addTemplateClassInstance(TemplateClassInstanceNode* node) { std::string name = node->m_name->m_str; std::string localName = node->m_name->m_str; name += "<"; localName += "<"; auto begin = node->m_templateArguments.m_arguments.begin(); auto end = node->m_templateArguments.m_arguments.end(); for (auto it = begin; it != end; ++it) { if (it != begin) { name += ", "; localName += ", "; } TypeNode* paramTypeNode = it->m_typeNode; std::string paramName; paramTypeNode->getActualTypeFullName(paramName); name += paramName; paramTypeNode->getFullName(paramName); localName += paramName; } name += ">"; localName += ">"; TemplateClassInstanceTypeNode* result = m_children.addTypeNode<TemplateClassInstanceTypeNode>(this, name, node->m_name); if (result) { result->m_localName = localName; result->m_templateClassInstanceNode = node; CopyChildren(result, node->m_classTypeNode); } return result; }
void CopyChildren(ClassTypeNode* dst, ClassTypeNode* src) { auto it = src->m_children.begin(); auto end = src->m_children.end(); for (; it != end; ++it) { TypeNode* srcChild = *it; switch (srcChild->m_category) { case tc_enum_type: dst->addEnum(static_cast<EnumTypeNode*>(srcChild)->m_enumNode); break; case tc_class_type: { ClassTypeNode* dstChild = dst->addClass(static_cast<ClassTypeNode*>(srcChild)->m_classNode); CopyChildren(dstChild, static_cast<ClassTypeNode*>(srcChild)); } break; case tc_typedef: dst->addTypedef(static_cast<TypedefTypeNode*>(srcChild)->m_typedefNode); break; case tc_type_declaration: dst->addTypeDeclaration(static_cast<TypeDeclarationTypeNode*>(srcChild)->m_typeDeclarationNode); break; default: assert(false); } } }
void CDragDropTreeCtrl::CopyChildren(HTREEITEM hDest, HTREEITEM hSrc) { // Get the first subitem. HTREEITEM hItem = GetChildItem(hSrc); if (hItem == NULL) return; // item has no children // Create a copy of it at the destination. TVITEMEX tvItem = { 0 }; tvItem.mask = TVIF_CHILDREN | TVIF_DI_SETITEM | TVIF_EXPANDEDIMAGE | TVIF_HANDLE | TVIF_IMAGE | TVIF_INTEGRAL | TVIF_PARAM | TVIF_SELECTEDIMAGE | TVIF_STATE | TVIF_STATEEX | TVIF_TEXT; tvItem.hItem = hItem; GetItem((TVITEM*)&tvItem); TVINSERTSTRUCT tvInsertItem = { 0 }; tvInsertItem.itemex = tvItem; tvInsertItem.hInsertAfter = TVI_SORT; tvInsertItem.hParent = hDest; HTREEITEM hNewItem = InsertItem(&tvInsertItem); // If the subitem has subitems, copy them, too. if (ItemHasChildren(hItem)) CopyChildren(hNewItem, hItem); // Do the same for other subitems of hSrc. while ((hItem = GetNextSiblingItem(hItem)) != NULL) { tvItem.mask = TVIF_CHILDREN | TVIF_DI_SETITEM | TVIF_EXPANDEDIMAGE | TVIF_HANDLE | TVIF_IMAGE | TVIF_INTEGRAL | TVIF_PARAM | TVIF_SELECTEDIMAGE | TVIF_STATE | TVIF_STATEEX | TVIF_TEXT; tvItem.hItem = hSrc; GetItem((TVITEM*)&tvItem); tvInsertItem.itemex = tvItem; tvInsertItem.hInsertAfter = TVI_SORT; tvInsertItem.hParent = hDest; hNewItem = InsertItem(&tvInsertItem); if (ItemHasChildren(hItem)) CopyChildren(hNewItem, hItem); } }
wxJigsawShape::wxJigsawShape(const wxJigsawShape & shape) : xsSerializable(shape), m_Parent(shape.m_Parent), m_Name(shape.m_Name), m_Description(shape.m_Description), m_Bitmap(shape.m_Bitmap), m_Colour(shape.m_Colour), m_Style(shape.m_Style), m_HasNotch(shape.m_HasNotch), m_HasBump(shape.m_HasBump), m_HasCShape(shape.m_HasCShape), m_MinSize(shape.m_MinSize), m_Position(shape.m_Position), m_NeedCalcLabelSize(shape.m_NeedCalcLabelSize), m_LabelSize(shape.m_LabelSize), m_Emit(shape.m_Emit), m_EmitOpen(shape.m_EmitOpen), m_EmitIntra(shape.m_EmitIntra), m_EmitClose(shape.m_EmitClose) { m_InputParameters.DeleteContents(true); CopyInputParameters(*this, shape); m_Children.DeleteContents(true); CopyChildren(*this, shape); InitSerialization(); }
void CDragDropTreeCtrl::CopyTree(HTREEITEM hDest, HTREEITEM hSrc) { // Get the attributes of item to be copied. TVITEMEX tvItem = { 0 }; tvItem.mask = TVIF_CHILDREN | TVIF_DI_SETITEM | TVIF_EXPANDEDIMAGE | TVIF_HANDLE | TVIF_IMAGE | TVIF_INTEGRAL | TVIF_PARAM | TVIF_SELECTEDIMAGE | TVIF_STATE | TVIF_STATEEX | TVIF_TEXT; tvItem.hItem = hSrc; GetItem((TVITEM*)&tvItem); // Create an exact copy of the item at the destination. TVINSERTSTRUCT tvInsertItem = { 0 }; tvInsertItem.itemex = tvItem; tvInsertItem.hInsertAfter = TVI_SORT; tvInsertItem.hParent = hDest; HTREEITEM hNewItem = InsertItem(&tvInsertItem); // If the item has subitems, copy them, too. if (ItemHasChildren(hSrc)) CopyChildren(hNewItem, hSrc); // Select the newly added item. SelectItem(hNewItem); }