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


C++ Importer::finalize方法代码示例

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


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

示例1: scrubCommandsNew

void PFImporterTest::scrubCommandsNew()
{
    platform = "pf";

    std::istringstream instream(
        openTestFile("test_data/pf-scrub-commands-new.conf"));

    Importer* imp = new PFImporter(lib, instream, logger, "test_fw");
    imp->setAddStandardCommentsFlag(true);
    CPPUNIT_ASSERT_NO_THROW( imp->run() );
    imp->finalize();

    compareResults(logger,
                   "test_data/pf-scrub-commands-new.output",
                   "pf-scrub-commands-new.output");
}
开发者ID:UNINETT,项目名称:fwbuilder,代码行数:16,代码来源:PFImporterTest.cpp

示例2: instream

void PFImporterTest::routeTo47Test()
{
    platform = "pf";

    std::istringstream instream(
        openTestFile("test_data/pf-route-to-4.7.conf"));

    Importer* imp = new PFImporter(lib, instream, logger, "test_fw");
    imp->setAddStandardCommentsFlag(true);
    CPPUNIT_ASSERT_NO_THROW( imp->run() );
    imp->finalize();

    db->setPredictableIds();
    db->saveFile("pf-route-to-4.7.fwb");

    compareResults(logger, "test_data/pf-route-to-4.7.output", "pf-route-to-4.7.output");
    compareFwbFiles("test_data/pf-route-to-4.7.fwb", "pf-route-to-4.7.fwb");
}
开发者ID:UNINETT,项目名称:fwbuilder,代码行数:18,代码来源:PFImporterTest.cpp

示例3: importConfig

void importConfig(const string &import_config,
                  FWObject *library,
                  const string &fw_name,
                  bool deduplicate)
{
    QFile f(QString::fromUtf8(import_config.c_str()));
    f.open(QFile::ReadOnly);
    string buffer = QString(f.readAll()).toStdString();
    f.close();

    std::istringstream instream(buffer);
    QueueLogger *logger = new QueueLogger();
    logger->copyToStderr();
    Importer* imp = nullptr;

    QStringList sl_buf = QString::fromUtf8(buffer.c_str()).split("\n");
    PreImport pi(&sl_buf);
    pi.scan();

    switch (pi.getPlatform())
    {
    case PreImport::PIX:
    case PreImport::FWSM:
        imp = new PIXImporter(library, instream, logger, fw_name);
        break;

    case PreImport::IOSACL:
        imp = new IOSImporter(library, instream, logger, fw_name);
        break;

    case PreImport::IPTABLES:
        imp = new IPTImporter(library, instream, logger, fw_name);
        break;

    case PreImport::IPTABLES_WITH_COUNTERS:
        cerr << "This appears to be iptables configuration saved using "
            "command \"iptables-save -c\""
            "and it includes packet counters. Please save configuration "
            "using command \"iptables-save\" without option \"-c\" and "
            "try to import it again."
             << endl;
        exit(1);

    default:
        cerr << "Can not import configuration file: unrecognized firewall platform"
             << endl;
        exit(1);
    }

    if (deduplicate) imp->prepareForDeduplication();
    
    try
    {
        imp->run();
    } catch(ImporterException &e)
    {
        *logger << e.toString() << "\n";
    } catch(ObjectMakerException &e)
    {
        *logger << e.toString() << "\n";
    }

    imp->finalize();

}
开发者ID:cwittmer,项目名称:fwbuilder,代码行数:65,代码来源:import.cpp


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