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


C++ ArchivePtr类代码示例

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


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

示例1: serialize

 void serialize(ArchivePtr& par)
 {
    par->update(m_b);
    par->update(m_d);
    par->update(m_i);
    par->update(m_str);
 }
开发者ID:davidgrogan123,项目名称:kotr,代码行数:7,代码来源:test_object.cpp

示例2: TestParser

	void TestParser(const String& dir, const String& suff, const String& pattern) {
		suffix = suff;
		ArchivePtr arch = FileSystem::Instance().OpenArchive("EngineData");
		if (arch) {
			arch->Scan(this, dir + "/" + pattern);
		}
	}
开发者ID:obhi-d,项目名称:nextar,代码行数:7,代码来源:ParserTests.cpp

示例3: absArchivePath

void ResourceLoader::loadFromModel( Path path2model, const Directory dir )
{
  VariantMap archives = config::load( path2model );
  for( auto& entry : archives )
  {
    Path absArchivePath( entry.second.toString() );

    if( !absArchivePath.exist() )
    {
      Path rpath = entry.second.toString();
      absArchivePath = dir/rpath;
    }
    Logger::warning( "ResourceLoader: try mount archive " + absArchivePath.toString() );

    Directory absDir = absArchivePath.directory();
    absArchivePath = absDir.find( absArchivePath.baseName(), Path::ignoreCase );       

    ArchivePtr archive = FileSystem::instance().mountArchive( absArchivePath );

    if( archive.isValid() )
    {
      emit _d->onStartLoadingSignal( entry.first );

      NFile archiveInfo = archive->createAndOpenFile( archiveDescFile );
      loadAtlases( archiveInfo, true );

      //FileSystem::instance().unmountArchive( archive );
    }
    else
    {
      Logger::warning( "ResourceLoader: cannot load archive " + absArchivePath.toString() );
    }
  }
}
开发者ID:andrelago13,项目名称:caesaria-game,代码行数:34,代码来源:resourceloader.cpp

示例4: loadFiles

void ResourceLoader::loadFiles(Path path)
{
  ArchivePtr archive = FileSystem::instance().mountArchive( path );
  if( archive.isValid() )
  {
    loadFiles( archive );
    FileSystem::instance().unmountArchive( archive );
  }
}
开发者ID:andrelago13,项目名称:caesaria-game,代码行数:9,代码来源:resourceloader.cpp

示例5: Listing

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

示例6: restore

bool ItemTreeArchiver::restore(ArchivePtr archive, ItemPtr parentItem)
{
    bool result = false;

    archive->setCurrentParentItem(0);

    try {
        result = restoreItemIter(archive.get(), parentItem);
    } catch (const YamlNode::Exception& ex) {
        messageView->put(ex.message());
    }

    archive->setCurrentParentItem(0);

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

示例7: initialize

void initialize(ClimateType climate)
{
    VariantMap climateArchives = config::load( SETTINGS_RC_PATH( climateModel ) );

    std::string optName;
    if( climate == central ) {
        optName = CAESARIA_STR_A(central);
    }
    else if( climate == northen )  {
        optName = "north";
    }
    else if( climate == desert ) {
        optName = "south";
    }

    StringArray archives = climateArchives.get( optName ).toStringArray();

    for( auto& str : archives )
    {
        Path archivePath = str;
        Directory dir = archivePath.directory();

        archivePath = dir.find( archivePath.baseName(), Path::ignoreCase );

        ArchivePtr archive = FileSystem::instance().mountArchive( archivePath );

        if( archive.isNull() )
        {
            Logger::warning( "ClimateManager: can't load file " + archivePath.toString() );
            continue;
        }

        ResourceLoader rc;
        NFile atlasInfo = archive->createAndOpenFile( "info" );
        if( atlasInfo.isOpen() )
        {
            rc.loadAtlases( atlasInfo, false );
        }
        else
        {
            rc.loadFiles( archive );
        }
    }
}
开发者ID:andrelago13,项目名称:caesaria-game,代码行数:44,代码来源:climatemanager.cpp

示例8: Listing

bool SensorVisualizerItem::store(Archive& archive)
{
    ListingPtr subItems = new Listing();

    for(size_t i=0; i < impl->subItems.size(); i++){
        Item* item = impl->subItems[i];
        string pluginName, className;
        ItemManager::getClassIdentifier(item, pluginName, className);

        ArchivePtr subArchive = new Archive();
        subArchive->write("class", className);
        subArchive->write("name", item->name());
        item->store(*subArchive);

        subItems->append(subArchive);
    }

    archive.insert("subItems", subItems);

    return true;
}
开发者ID:kindsenior,项目名称:choreonoid,代码行数:21,代码来源:SensorVisualizerItem.cpp

示例9: tr

void ArchiveListWidget::deleteItem()
{
    ArchiveListWidgetItem *archiveItem =
        qobject_cast<ArchiveListWidgetItem *>(sender());
    if(archiveItem)
    {
        ArchivePtr archive = archiveItem->archive();

        QMessageBox::StandardButton confirm =
            QMessageBox::question(this, tr("Confirm delete"),
                                  tr("Are you sure you want to delete"
                                     " archive %1 (this cannot be undone)?")
                                      .arg(archive->name()));
        if(confirm == QMessageBox::Yes)
        {
            QList<ArchivePtr> archiveList;
            archiveList.append(archive);
            emit deleteArchives(archiveList);
        }
    }
}
开发者ID:Tarsnap,项目名称:tarsnap-gui,代码行数:21,代码来源:archivelistwidget.cpp

示例10: Listing

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

示例11: main

int main(void)
{
	// Get hold of the Manager class
	ManagerPtr manager = getManager();

	// Use the manager to look up a particular archive format
	ArchiveTypePtr archiveType = manager->getArchiveTypeByCode("grp-duke3d");

	// Open an archive file on disk
	stream::file_sptr file(new stream::file());
	file->open("duke3d.grp");

	// We cheat here - we should check and load any supplementary files, but
	// for the sake of keeping this example simple we know this format doesn't
	// need any supps.
	camoto::SuppData supps;

	// Use the archive format handler to read in the file we opened as an archive
	ArchivePtr arch = archiveType->open(file, supps);

	// Get a list of all the files in the archive
	const Archive::VC_ENTRYPTR& contents = arch->getFileList();

	// Print the size of the list (the number of files in the archive)
	std::cout << "Found " << contents.size() << " files.\n";

	// Run through the list of files and show the filename
	for (Archive::VC_ENTRYPTR::const_iterator i = contents.begin(); i != contents.end(); i++) {
		const Archive::EntryPtr subfile = *i;
		std::cout << subfile->strName << "\n";
	}
	std::cout << "Done." << std::endl;

	// No cleanup required because all the Ptr variables are shared pointers,
	// which get destroyed automatically when they go out of scope (and nobody
	// else is using them!)

	return 0;
}
开发者ID:HendrikR,项目名称:libgamearchive,代码行数:39,代码来源:hello.cpp

示例12: selectArchive

void ArchiveListWidget::selectArchive(ArchivePtr archive)
{
    if(!archive)
    {
        DEBUG << "Null ArchivePtr passed.";
        return;
    }

    for(int i = 0; i < count(); ++i)
    {
        ArchiveListWidgetItem *archiveItem =
            static_cast<ArchiveListWidgetItem *>(item(i));
        if(archiveItem
           && (archiveItem->archive()->objectKey() == archive->objectKey()))
        {
            clearSelection();
            setCurrentItem(archiveItem);
            scrollToItem(currentItem(), QAbstractItemView::EnsureVisible);
            break;
        }
    }
}
开发者ID:Tarsnap,项目名称:tarsnap-gui,代码行数:22,代码来源:archivelistwidget.cpp

示例13: addArchive

void ArchiveListWidget::addArchive(ArchivePtr archive)
{
    if(!archive)
    {
        DEBUG << "Null ArchivePtr passed.";
        return;
    }

    // Find insertion position based on sorted timestamps.
    int pos = 0;
    for(; pos < count(); ++pos)
    {
        ArchiveListWidgetItem *archiveItem =
            static_cast<ArchiveListWidgetItem *>(item(pos));
        if(archiveItem
           && (archive->timestamp() > archiveItem->archive()->timestamp()))
        {
            break;
        }
    }
    insertArchive(archive, pos);
}
开发者ID:Tarsnap,项目名称:tarsnap-gui,代码行数:22,代码来源:archivelistwidget.cpp

示例14: insertArchive

void ArchiveListWidget::insertArchive(ArchivePtr archive, int pos)
{
    if(!archive)
    {
        DEBUG << "Null ArchivePtr passed.";
        return;
    }

    ArchiveListWidgetItem *item = new ArchiveListWidgetItem(archive);
    connect(item, &ArchiveListWidgetItem::requestDelete, this,
            &ArchiveListWidget::deleteItem);
    connect(item, &ArchiveListWidgetItem::requestInspect, this,
            &ArchiveListWidget::inspectItem);
    connect(item, &ArchiveListWidgetItem::requestRestore, this,
            &ArchiveListWidget::restoreItem);
    connect(item, &ArchiveListWidgetItem::requestGoToJob, this,
            &ArchiveListWidget::goToJob);
    connect(item, &ArchiveListWidgetItem::removeItem, this,
            &ArchiveListWidget::removeItem);
    insertItem(pos, item);
    setItemWidget(item, item->widget());
    item->setHidden(!archive->name().contains(_filter));
    emit countChanged(count(), visibleItemsCount());
}
开发者ID:Tarsnap,项目名称:tarsnap-gui,代码行数:24,代码来源:archivelistwidget.cpp

示例15: Archive

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


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