Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: experimental/mac_debugger/debug_command_line.h

Issue 10928195: First round of dead file removal (Closed) Base URL: https://github.com/samclegg/nativeclient-sdk.git@master
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Native Client Authors. 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.
4 #ifndef DEBUGGER_BASE_DEBUG_COMMAND_LINE_H_
5 #define DEBUGGER_BASE_DEBUG_COMMAND_LINE_H_
6
7 #include <string>
8 #include <vector>
9
10 namespace debug {
11 /// This class allows to get value of command-line switches.
12 /// CommandLine constructor takes the same arguments as a C/C++ main function:
13 /// http://wiki.answers.com/Q/What_is_main_function_on_C_plus_plus
14 ///
15 /// It also provides conversion to/from string.
16 /// Switches can optionally have a value attached as in "--switch value".
17 /// Switch names shall be prefixed by one or two dashes.
18 class CommandLine {
19 public:
20 CommandLine() {}
21
22 /// Initialize from |argv| vector. Content of the |argv| is copied.
23 /// @param[in] argc number of the program's command-line arguments
24 /// @param[in] argv argument vector
25 CommandLine(int argc, char* argv[]);
26
27 /// Parses command line string.
28 /// @param[in] command_line command line string
29 explicit CommandLine(const std::string& command_line);
30
31 ~CommandLine();
32
33 /// @return number of parameters
34 size_t GetParametersNum() const;
35
36 /// @param[in] pos parameter position, starting from 0
37 /// @return the parameter, whether it's a switch or a value.
38 /// Example: CommandLine cl("cmd.exe --a 1 --b 2");
39 /// cl.GetParameter(0) -> "--aa"
40 /// cl.GetParameter(1) -> "1"
41 /// cl.GetParametersNum() -> 4
42 std::string GetParameter(size_t pos) const;
43
44 /// @return program name, passed in argv[0]
45 std::string GetProgramName() const;
46
47 /// @return command line string
48 std::string ToString() const;
49
50 /// @param[in] name name of the switch, with two, one or no dashes.
51 /// Example: names "--host", "-host" or "host" should match switches with
52 /// actual names "--host" and "-host".
53 /// @param[in] default_value value to return if specified switch is not found
54 /// @return the value associated with the given switch, or |default_value|.
55 std::string GetStringSwitch(const std::string& name,
56 const std::string& default_value) const;
57
58 /// @param[in] name name of the switch, with two, one or no dashes.
59 /// Example: names "--port", "-port" or "port" should match switches with
60 /// actual names "--port" and "-port".
61 /// @param[in] default_value value to return if specified switch is not found
62 /// @return the value associated with the given switch, or |default_value|.
63 int GetIntSwitch(const std::string& name, int default_value) const;
64
65 /// Returns value of the switch that is an address, example:
66 /// CommandLine cl("cmd -mem_start 0000000C00020080");
67 /// cl.GetAddrSwitch("mem_start") -> 0xC00020080 (on win64)
68 /// @param[in] name name of the switch, with two, one or no dashes.
69 /// @return the value associated with the given switch.
70 void* GetAddrSwitch(const std::string& name) const;
71
72 /// @param[in] name name of the switch, with two, one or no dashes.
73 /// Example: names "--flag", "-flag" or "flag" should match switches with
74 /// actual names "--flag" and "-flag".
75 /// @return true if switch is found
76 bool HasSwitch(const std::string& name) const;
77
78 private:
79 std::vector<std::string> argv_;
80 };
81 } // namespace debug
82 #endif // DEBUGGER_BASE_DEBUG_COMMAND_LINE_H_
83
84
OLDNEW
« no previous file with comments | « experimental/mac_debugger/debug_blob.cc ('k') | experimental/mac_debugger/debug_command_line.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698