#include <command_line.h>
Definition at line 56 of file command_line.h.
◆ CommandLine() [1/4]
fml::CommandLine::CommandLine |
( |
| ) |
|
|
default |
◆ CommandLine() [2/4]
fml::CommandLine::CommandLine |
( |
const CommandLine & |
from | ) |
|
|
default |
◆ CommandLine() [3/4]
◆ CommandLine() [4/4]
fml::CommandLine::CommandLine |
( |
const std::string & |
argv0, |
|
|
const std::vector< Option > & |
options, |
|
|
const std::vector< std::string > & |
positional_args |
|
) |
| |
|
explicit |
Definition at line 22 of file command_line.cc.
25 : has_argv0_(true),
29 for (
size_t i = 0;
i < options_.size();
i++) {
30 option_index_[options_[
i].name] =
i;
31 }
32}
const std::string & argv0() const
const std::vector< Option > & options() const
const std::vector< std::string > & positional_args() const
◆ ~CommandLine()
fml::CommandLine::~CommandLine |
( |
| ) |
|
|
default |
◆ argv0()
const std::string & fml::CommandLine::argv0 |
( |
| ) |
const |
|
inline |
◆ GetOptionValue()
bool fml::CommandLine::GetOptionValue |
( |
std::string_view |
name, |
|
|
std::string * |
value |
|
) |
| const |
Definition at line 51 of file command_line.cc.
52 {
53 size_t index;
55 return false;
56 }
57 *
value = options_[index].value;
58 return true;
59}
bool HasOption(std::string_view name, size_t *index=nullptr) const
DEF_SWITCHES_START aot vmservice shared library name
◆ GetOptionValues()
std::vector< std::string_view > fml::CommandLine::GetOptionValues |
( |
std::string_view |
name | ) |
const |
Definition at line 61 of file command_line.cc.
62 {
63 std::vector<std::string_view> ret;
64 for (const auto& option : options_) {
65 if (option.name ==
name) {
66 ret.push_back(option.value);
67 }
68 }
69 return ret;
70}
◆ GetOptionValueWithDefault()
std::string fml::CommandLine::GetOptionValueWithDefault |
( |
std::string_view |
name, |
|
|
std::string_view |
default_value |
|
) |
| const |
Definition at line 72 of file command_line.cc.
74 {
75 size_t index;
77 return {default_value.data(), default_value.size()};
78 }
79 return options_[index].value;
80}
◆ has_argv0()
bool fml::CommandLine::has_argv0 |
( |
| ) |
const |
|
inline |
◆ HasOption()
bool fml::CommandLine::HasOption |
( |
std::string_view |
name, |
|
|
size_t * |
index = nullptr |
|
) |
| const |
Definition at line 40 of file command_line.cc.
40 {
41 auto it = option_index_.find(
name.data());
42 if (it == option_index_.end()) {
43 return false;
44 }
45 if (index) {
46 *index = it->second;
47 }
48 return true;
49}
◆ operator!=()
bool fml::CommandLine::operator!= |
( |
const CommandLine & |
other | ) |
const |
|
inline |
Definition at line 106 of file command_line.h.
bool operator==(const CommandLine &other) const
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ operator==()
bool fml::CommandLine::operator== |
( |
const CommandLine & |
other | ) |
const |
|
inline |
Definition at line 100 of file command_line.h.
100 {
101
102 return has_argv0_ == other.has_argv0_ && argv0_ == other.argv0_ &&
103 options_ == other.options_ &&
104 positional_args_ == other.positional_args_;
105 }
◆ options()
const std::vector< Option > & fml::CommandLine::options |
( |
| ) |
const |
|
inline |
◆ positional_args()
const std::vector< std::string > & fml::CommandLine::positional_args |
( |
| ) |
const |
|
inline |
Definition at line 96 of file command_line.h.
96 {
97 return positional_args_;
98 }
The documentation for this class was generated from the following files: