LCOV - code coverage report
Current view: top level - dbe/apps - SchemaMain.cpp (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 39 0
Test Date: 2025-12-21 13:07:08 Functions: 0.0 % 2 0

            Line data    Source code
       1              : #include "dbe/SchemaMainWindow.hpp"
       2              : #include <QApplication>
       3              : #include <boost/program_options.hpp>
       4              : #include <iostream>
       5              : #include <string>
       6              : 
       7              : namespace bop = boost::program_options;
       8              : 
       9            0 : int main(int argc, char *argv[]) {
      10            0 :     std::string oksfn;
      11              : 
      12            0 :     bop::options_description options_description("Allowed options", 128);
      13              : 
      14            0 :     options_description.add_options()("help,h", "Provide help message")
      15            0 :                                      ("file,f", bop::value<std::string>(&oksfn)->default_value(oksfn), "OKS schema file name");
      16              : 
      17            0 :     bop::variables_map options_map;
      18              : 
      19            0 :     try {
      20            0 :         bop::parsed_options parsed = bop::command_line_parser(argc, argv).options(options_description).allow_unregistered().run();
      21              : 
      22              :         // This is to properly catch any positional argument (not supported)
      23            0 :         const auto& unknown = bop::collect_unrecognized(parsed.options, bop::include_positional);
      24            0 :         if(unknown.size() != 0) {
      25            0 :             std::cerr << "Incorrect command line argument, unrecognized options: ";
      26            0 :             for(const auto& o : unknown) {
      27            0 :                 std::cerr << o << " ";
      28              :             }
      29            0 :             std::cerr << std::endl;
      30              : 
      31              :             return EXIT_FAILURE;
      32              :         }
      33              : 
      34            0 :         bop::store(parsed, options_map);
      35            0 :         bop::notify(options_map);
      36              : 
      37            0 :         auto display_help_message = [&options_description]()
      38              :         {
      39            0 :             std::cout
      40            0 :             << "TDAQ online database schema editor"
      41            0 :             << std::endl
      42            0 :             << std::endl
      43            0 :             << "Usage: schemaeditor [options]"
      44            0 :             << std::endl
      45            0 :             << std::endl
      46            0 :             << options_description
      47            0 :             << std::endl;
      48            0 :         };
      49              : 
      50            0 :         if(options_map.count("help")) {
      51            0 :             display_help_message();
      52              :             return EXIT_SUCCESS;
      53              :         }
      54            0 :     }
      55            0 :     catch(std::exception const & e) {
      56            0 :         std::cerr << "Incorrect command line argument: " << e.what() << std::endl;
      57            0 :         return EXIT_FAILURE;
      58            0 :     }
      59              : 
      60              : 
      61            0 :     QApplication a(argc, argv);
      62              : 
      63            0 :     dbse::SchemaMainWindow w(QString::fromStdString(oksfn));
      64              : 
      65            0 :     w.show();
      66              : 
      67            0 :     return a.exec();
      68            0 : }
        

Generated by: LCOV version 2.0-1