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


C++ ArchivePtr::insert方法代码示例

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


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

示例1: storeIter

ArchivePtr ItemTreeArchiver::storeIter(ArchivePtr& parentArchive, Item* item)
{
    string pluginName;
    string className;

    if(!ItemManager::getClassIdentifier(item, pluginName, className)) {
        messageView->putln(format(_("\"%1%\" cannot be stored. Its type is not registered.")) % item->name());
        return 0;
    }

    ArchivePtr archive = new Archive();
    archive->inheritSharedInfoFrom(parentArchive);

    messageView->putln(format(_("Storing %1% \"%2%\"")) % className % item->name());
    messageView->flush();

    ArchivePtr dataArchive = new Archive();
    dataArchive->inheritSharedInfoFrom(parentArchive);

    if(!item->store(*dataArchive)) {
        messageView->putln(format(_("\"%1%\" cannot be stored.")) % item->name());
        return 0;
    }

    archive->registerItemId(item, itemIdCounter);
    archive->write("id", itemIdCounter);
    itemIdCounter++;

    archive->write("name", item->name(), YAML_DOUBLE_QUOTED);
    archive->write("plugin", pluginName);
    archive->write("class", className);

    if(!dataArchive->empty()) {
        archive->insert("data", dataArchive);
    }

    YamlSequencePtr children = new YamlSequence();

    for(Item* childItem = item->childItem(); childItem; childItem = childItem->nextItem()) {
        if(childItem->isSubItem()) {
            continue;
        }
        ArchivePtr childArchive = storeIter(archive, childItem);
        if(childArchive) {
            children->append(childArchive);
        }
    }

    if(!children->empty()) {
        archive->insert("children", children);
    }

    return archive;
}
开发者ID:thomas-moulard,项目名称:choreonoid-deb,代码行数:54,代码来源:ItemTreeArchiver.cpp

示例2: storeAllViewAreaLayouts

void ViewArea::storeAllViewAreaLayouts(ArchivePtr archive)
{
    ListingPtr layouts = new Listing();
    for(size_t i=0; i < viewAreas.size(); ++i){
        ArchivePtr layout = new Archive();
        layout->inheritSharedInfoFrom(*archive);
        viewAreas[i]->storeLayout(layout);
        layouts->append(layout);
    }
    if(!layouts->empty()){
        archive->insert("viewAreas", layouts);
    }
}
开发者ID:arntanguy,项目名称:choreonoid,代码行数:13,代码来源:ViewArea.cpp

示例3: storeViewStates

bool ViewManager::storeViewStates(ArchivePtr archive, const std::string& key)
{
    // assign view ids first
    int id = 0;
    ModuleNameToClassNameToViewInfoMap::iterator p;
    for(p = moduleNameToClassNameToViewInfoMap.begin(); p != moduleNameToClassNameToViewInfoMap.end(); ++p){
        ClassNameToViewInfoMap& viewInfoMap = *p->second;
        for(ClassNameToViewInfoMap::iterator q = viewInfoMap.begin(); q != viewInfoMap.end(); ++q){
            ViewInfoPtr& viewInfo = q->second;
            InstanceInfoList& instances = viewInfo->instances;
            for(InstanceInfoList::iterator p = instances.begin(); p != instances.end(); ++p){            
                archive->registerViewId((*p)->view, id++);
            }
        }
    }
    
    ListingPtr viewList = new Listing();

    for(p = moduleNameToClassNameToViewInfoMap.begin(); p != moduleNameToClassNameToViewInfoMap.end(); ++p){
        const std::string& moduleName = p->first;
        ClassNameToViewInfoMap& viewInfoMap = *p->second;
        for(ClassNameToViewInfoMap::iterator q = viewInfoMap.begin(); q != viewInfoMap.end(); ++q){
            ViewInfoPtr& viewInfo = q->second;
            InstanceInfoList& instances = viewInfo->instances;
            for(InstanceInfoList::iterator p = instances.begin(); p != instances.end(); ++p){            
                View* view = (*p)->view;
                ArchivePtr viewArchive = storeView(*archive, moduleName, *viewInfo, view);
                if(viewArchive){
                    viewList->append(viewArchive);
                }
            }
        }
    }

    if(!viewList->empty()){
        archive->insert(key, viewList);
        return true;
    }
    return false;
}
开发者ID:fkanehiro,项目名称:choreonoid,代码行数:40,代码来源:ViewManager.cpp


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