本文整理汇总了C++中ItemPtr::get方法的典型用法代码示例。如果您正苦于以下问题:C++ ItemPtr::get方法的具体用法?C++ ItemPtr::get怎么用?C++ ItemPtr::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemPtr
的用法示例。
在下文中一共展示了ItemPtr::get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: store
ArchivePtr ItemTreeArchiver::store(ArchivePtr parentArchive, ItemPtr item)
{
itemIdCounter = 0;
return storeIter(parentArchive, item.get());
}
示例2: restoreItemIter
bool ItemTreeArchiver::restoreItemIter(Archive* archive, ItemPtr& parentItem)
{
ItemPtr item;
string pluginName;
string className;
if(!(archive->read("plugin", pluginName) && archive->read("class", className))) {
messageView->putln(_("Archive is broken."));
return false;
}
const char* actualPluginName = PluginManager::instance()->guessActualPluginName(pluginName);
if(actualPluginName) {
item = ItemManager::create(actualPluginName, className);
}
if(!item) {
messageView->putln(
format(_("Item type %1% of %2% cannot be restored. It's not a registered type."))
% className % pluginName);
} else {
bool restored = false;
string name;
if(archive->read("name", name)) {
item->setName(name);
bool isRootItem = dynamic_pointer_cast<RootItem>(item);
if(isRootItem) {
item = parentItem;
restored = true;
} else {
messageView->putln(format(_("Restoring %1% \"%2%\"")) % className % name);
messageView->flush();
YamlNodePtr dataNode = archive->find("data");
if(!dataNode->isValid()) {
restored = true;
} else if(dataNode->type() == YAML_MAPPING) {
Archive* dataArchive = static_cast<Archive*>(dataNode->toMapping());
dataArchive->inheritSharedInfoFrom(archive);
dataArchive->setCurrentParentItem(parentItem.get());
restored = item->restore(*dataArchive);
}
if(restored) {
parentItem->addChildItem(item);
}
}
if(!restored) {
messageView->putln(format(_("%1% \"%2%\" cannot be restored.")) % className % name);
item = 0;
} else {
int id;
if(archive->read("id", id) && (id >= 0)) {
archive->registerItemId(item.get(), id);
}
YamlSequencePtr children = archive->findSequence("children");
if(children->isValid()) {
for(int i=0; i < children->size(); ++i) {
Archive* childArchive = dynamic_cast<Archive*>(children->get(i).toMapping());
childArchive->inheritSharedInfoFrom(archive);
restoreItemIter(childArchive, item);
}
}
}
}
}
return (item);
}
示例3: checkItem
bool ItemTreeView::checkItem(ItemPtr item, bool checked, int id)
{
return impl->checkItem(item.get(), checked, id);
}
示例4: clone
ItemPtr Item::clone()
{
ItemPtr item = ItemPtr(new Item);
*(item.get()) = *this;
return item;
}
示例5: isItemChecked
bool ItemTreeView::isItemChecked(ItemPtr item, int id)
{
return impl->isItemChecked(item.get(), id);
}