1 // Copyright 2015 Samsung Electronics Co, Ltd. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef WRT_COMMON_COMMAND_LINE_H_
6 #define WRT_COMMON_COMMAND_LINE_H_
16 // CommandLine only uses long options
17 typedef std::map<std::string, std::string> OptionMap;
18 // Arguments which except for option strings
19 typedef std::vector<std::string> Arguments;
21 static void Init(int argc, char* argv[]);
22 static CommandLine* ForCurrentProcess();
25 // Test if options_ has 'option_name'
26 bool HasOptionName(const std::string& option_name);
27 // Get the option's value
28 std::string GetOptionValue(const std::string& option_name);
29 // Get command string include options and arguments
30 std::string GetCommandString();
32 std::string appid() const { return appid_; }
33 std::string program() const { return program_; }
34 const OptionMap& options() const { return options_; }
35 const Arguments& arguments() const { return arguments_; }
36 char** argv() const { return argv_; }
37 int argc() const { return argc_; }
40 CommandLine(int argc, char* argv[]);
41 virtual ~CommandLine();
43 void AppendOption(const char* value);
45 // The singleton CommandLine instance of current process
46 static CommandLine* current_process_commandline_;
58 #endif // WRT_COMMON_COMMAND_LINE_H_