Definition at line 99 of file Options.h.
◆ Options()
| Options |
( |
size_t | qty, |
|
|
char ** | args ) |
|
inline |
Definition at line 103 of file Options.h.
104 {
105 assert(0 < qty);
106 assert(args);
107
108 ArgCarriage carriage(qty, args);
109
110
111 carriage.advance();
112
113
114 if (carriage)
115 {
116 std::string option;
117
118 if (isOption(*carriage, &option))
119 {
120 do
121 {
122 carriage.advance();
123
124 const std::pair<Items::iterator, bool> inserted =
125 items_.insert(std::make_pair(option,
OptionArgs()));
126
127 if (inserted.second)
128 {
129 OptionArgs& optionArgs = inserted.first->second;
130
131 while (carriage && !isOption(*carriage, &option))
132 {
133 optionArgs.push_back(*carriage);
134
135 carriage.advance();
136 }
137 }
138 else
139 {
141 }
142 }
143 while (carriage);
144 }
145 else
146 {
148 }
149 }
150 }
std::vector< OptionArg > OptionArgs
void throwDuplicatedOption(const Char *option)
void throwBadOption(const Char *arg)
◆ args() [1/2]
| const OptionArgs * args |
( |
const char * | option | ) |
const |
|
inline |
Definition at line 160 of file Options.h.
161 {
162 return args(option ? std::string(option) : std::string());
163 }
bool args(const Options &options, const Char *option, Iterator target, size_t minQty=0, size_t maxQty=static_cast< size_t >(-1))
◆ args() [2/2]
| const OptionArgs * args |
( |
const std::string & | option | ) |
const |
|
inline |
Definition at line 166 of file Options.h.
167 {
168 const auto foundItem = items_.find(option);
169 return (foundItem != items_.end() ? &foundItem->second : nullptr);
170 }
◆ get()
template<class Iterator>
| void get |
( |
Iterator | target | ) |
const |
|
inline |
Definition at line 154 of file Options.h.
155 {
156 std::transform(items_.begin(), items_.end(), target, PairFirst<Option, OptionArgs>());
157 }