~ubuntu-branches/ubuntu/vivid/mir/vivid

« back to all changes in this revision

Viewing changes to src/platform/options/default_configuration.cpp

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2014-08-11 19:52:06 UTC
  • mto: This revision was merged to the branch mainline in revision 77.
  • Revision ID: package-import@ubuntu.com-20140811195206-05ee991qbzvdbmel
Tags: upstream-0.6.0+14.10.20140811
ImportĀ upstreamĀ versionĀ 0.6.0+14.10.20140811

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
char const* const mo::frontend_threads_opt        = "ipc-thread-pool";
42
42
char const* const mo::name_opt                    = "name";
43
43
char const* const mo::offscreen_opt               = "offscreen";
 
44
char const* const mo::fatal_abort_opt             = "on-fatal-error-abort";
 
45
 
44
46
 
45
47
char const* const mo::glog                 = "glog";
46
48
char const* const mo::glog_stderrthreshold = "glog-stderrthreshold";
63
65
}
64
66
 
65
67
mo::DefaultConfiguration::DefaultConfiguration(int argc, char const* argv[]) :
 
68
    DefaultConfiguration(
 
69
        argc, argv,
 
70
        [](int argc, char const* const* argv)
 
71
        {
 
72
            if (argc)
 
73
            {
 
74
                std::ostringstream help_text;
 
75
                help_text << "Unknown command line options:";
 
76
                for (auto opt = argv; opt != argv+argc ; ++opt)
 
77
                    help_text << ' ' << *opt;
 
78
                BOOST_THROW_EXCEPTION(mir::AbnormalExit(help_text.str()));
 
79
            }
 
80
        })
 
81
{
 
82
}
 
83
 
 
84
mo::DefaultConfiguration::DefaultConfiguration(
 
85
    int argc,
 
86
    char const* argv[],
 
87
    std::function<void(int argc, char const* const* argv)> const& handler) :
66
88
    argc(argc),
67
89
    argv(argv),
 
90
    unparsed_arguments_handler{handler},
68
91
    program_options(std::make_shared<boost::program_options::options_description>(
69
92
    "Command-line options.\n"
70
93
    "Environment variables capitalise long form with prefix \"MIR_SERVER_\" and \"_\" in place of \"-\""))
119
142
        (name_opt, po::value<std::string>(),
120
143
            "When nested, the name Mir uses when registering with the host.")
121
144
        (offscreen_opt,
122
 
            "Render to offscreen buffers instead of the real outputs.");
 
145
            "Render to offscreen buffers instead of the real outputs.")
 
146
        (fatal_abort_opt, "On \"fatal error\" conditions [e.g. drivers behaving "
 
147
            "in unexpected ways] abort (to get a core dump)");
123
148
 
124
149
        add_platform_options();
125
150
}
187
212
 
188
213
        options.parse_arguments(desc, argc, argv);
189
214
 
 
215
        auto const unparsed_arguments = options.unparsed_command_line();
 
216
        std::vector<char const*> tokens;
 
217
        for (auto const& token : unparsed_arguments)
 
218
            tokens.push_back(token.c_str());
 
219
        unparsed_arguments_handler(tokens.size(), tokens.data());
 
220
 
190
221
        if (options.is_set("help"))
191
222
        {
192
223
            std::ostringstream help_text;