MCPcopy Create free account
hub / github.com/Haivision/srt / DetermineTypeFromHelpText

Method DetermineTypeFromHelpText

apps/apputil.cpp:160–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158// OPTION LIBRARY
159
160OptionScheme::Args OptionName::DetermineTypeFromHelpText(const std::string& helptext)
161{
162 if (helptext.empty())
163 return OptionScheme::ARG_NONE;
164
165 if (helptext[0] == '<')
166 {
167 // If the argument is <one-argument>, then it's ARG_NONE.
168 // If it's <multiple-arguments...>, then it's ARG_VAR.
169 // When closing angle bracket isn't found, fallback to ARG_ONE.
170 size_t pos = helptext.find('>');
171 if (pos == std::string::npos)
172 return OptionScheme::ARG_ONE; // mistake, but acceptable
173
174 if (pos >= 4 && helptext.substr(pos-3, 4) == "...>")
175 return OptionScheme::ARG_VAR;
176
177 // We have < and > without ..., simply one argument
178 return OptionScheme::ARG_ONE;
179 }
180
181 if (helptext[0] == '[')
182 {
183 // Argument in [] means it is optional; in this case
184 // you should state that the argument can be given or not.
185 return OptionScheme::ARG_VAR;
186 }
187
188 // Also as fallback
189 return OptionScheme::ARG_NONE;
190}
191
192options_t ProcessOptions(char* const* argv, int argc, std::vector<OptionScheme> scheme)
193{

Callers

nothing calls this directly

Calls 2

emptyMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected