本文整理汇总了C++中SmartPointer::CreateChild方法的典型用法代码示例。如果您正苦于以下问题:C++ SmartPointer::CreateChild方法的具体用法?C++ SmartPointer::CreateChild怎么用?C++ SmartPointer::CreateChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SmartPointer
的用法示例。
在下文中一共展示了SmartPointer::CreateChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
SmartPointer<const IStatus> EditorHistoryItem::SaveState(const SmartPointer<IMemento>& memento)
{
if (!IsRestored())
{
memento->PutMemento(this->memento);
}
else if (input.IsNotNull())
{
const IPersistableElement* persistable = input->GetPersistable();
if (persistable != nullptr)
{
/*
* Store IPersistable of the IEditorInput in a separate section
* since it could potentially use a tag already used in the parent
* memento and thus overwrite data.
*/
IMemento::Pointer persistableMemento = memento->CreateChild(WorkbenchConstants::TAG_PERSISTABLE);
persistable->SaveState(persistableMemento);
memento->PutString(WorkbenchConstants::TAG_FACTORY_ID,
persistable->GetFactoryId());
if (descriptor.IsNotNull() && !descriptor->GetId().isEmpty())
{
memento->PutString(WorkbenchConstants::TAG_ID, descriptor->GetId());
}
// save the name and tooltip separately so they can be restored
// without having to instantiate the input, which can activate plugins
memento->PutString(WorkbenchConstants::TAG_NAME, input->GetName());
memento->PutString(WorkbenchConstants::TAG_TOOLTIP, input->GetToolTipText());
}
}
return Status::OK_STATUS(BERRY_STATUS_LOC);
}
示例2: OK_STATUS
SmartPointer<const IStatus> EditorHistory::SaveState(const SmartPointer<IMemento>& memento) const
{
for (auto iter = fifoList.begin(); iter != fifoList.end(); ++iter)
{
if ((*iter)->CanSave())
{
IMemento::Pointer itemMemento = memento->CreateChild(WorkbenchConstants::TAG_FILE);
(*iter)->SaveState(itemMemento);
}
}
return Status::OK_STATUS(BERRY_STATUS_LOC);
}