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


C++ CKernel::getCoverageReaderPluginManager方法代码示例

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


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

示例1: processArgs

int processArgs(options_description desc, int ac, char* av[])
{
    try {
        positional_options_description p;
        variables_map vm;
        store(command_line_parser(ac, av).options(desc).positional(p).run(), vm);
        notify(vm);

        if (!vm.count("type")) {
            std::cerr << "[ERROR] Type is missing." << std::endl << desc;
            return 1;
        }
        if (vm.count("mode") && !vm.count("path")) {
            std::cerr << "[ERROR] Path to input directory is missing." << std::endl << desc;
            return 1;
        }
        std::string type = vm["type"].as<std::string>();


        if (type == "coverage") {
            if (vm.count("list")) {
                printPluginNames("coverage", kernel.getCoverageReaderPluginManager().getPluginNames());
                return 0;
            }
            if (vm.count("mode")) {
                std::string mode = vm["mode"].as<std::string>();
                try {
                    ICoverageReaderPlugin *plugin = kernel.getCoverageReaderPluginManager().getPlugin(mode);
                    CCoverageMatrix *matrix = plugin->read(vm);
                    if (vm.count("output")) {
                        std::string output = vm["output"].as<std::string>();
                        matrix->save(output);
                    }
                    if (matrix) {
                        delete matrix;
                    }
                } catch (std::out_of_range &e) {
                    std::cerr << "[ERROR] Unknown read mode. " << std::endl;
                    printPluginNames("coverage", kernel.getCoverageReaderPluginManager().getPluginNames());
                    return 1;
                }
                return 0;
            }
        } else if (type == "results") {
            if (vm.count("list")) {
                printPluginNames("results", kernel.getResultsReaderPluginManager().getPluginNames());
                return 0;
            }
            if (vm.count("mode")) {
                std::string mode = vm["mode"].as<std::string>();
                std::string path = vm["path"].as<std::string>();
                try {
                    IResultsReaderPlugin *plugin = kernel.getResultsReaderPluginManager().getPlugin(mode);
                    CResultsMatrix *results = plugin->read(path);
                    if (vm.count("output")) {
                        std::string output = vm["output"].as<std::string>();
                        results->save(output);
                    }
                    if (results) {
                        delete results;
                    }
                } catch (std::out_of_range &e) {
                    std::cerr << "[ERROR] Unknown read mode. " << std::endl;
                    printPluginNames("results", kernel.getResultsReaderPluginManager().getPluginNames());
                    return 1;
                }
                return 0;
            }
        } else if (type == "changeset") {
            if (vm.count("list")) {
                printPluginNames("changeset", kernel.getChangesetReaderPluginManager().getPluginNames());
                return 0;
            }
            if (vm.count("mode")) {
                std::string mode = vm["mode"].as<std::string>();
                std::string path = vm["path"].as<std::string>();
                try {
                    IChangesetReaderPlugin *plugin = kernel.getChangesetReaderPluginManager().getPlugin(mode);
                    CChangeset *changeset = plugin->read(path);
                    if (vm.count("output")) {
                        std::string output = vm["output"].as<std::string>();
                        changeset->save(output);
                    }
                    if (changeset) {
                        delete changeset;
                    }
                } catch (std::out_of_range &e) {
                    std::cerr << "[ERROR] Unknown read mode. " << std::endl;
                    printPluginNames("changeset", kernel.getChangesetReaderPluginManager().getPluginNames());
                    return 1;
                }
                return 0;
            }
        } else {
            std::cerr << "[ERROR] Unknown type." << std::endl << desc;
            return 1;
        }

    } catch(std::exception& e) {
        std::cerr << e.what() << std::endl;
//.........这里部分代码省略.........
开发者ID:sed-szeged,项目名称:soda,代码行数:101,代码来源:main.cpp


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