58 const std::string& startingPrefix,
59 const std::string& endingPrefix,
60 bool shouldIncludeStart =
true,
61 bool shouldIncludeEnd =
true);
79 std::string m_programName;
80 std::vector<std::string> m_arguments;
92 return m_arguments.empty();
98 static_assert(std::is_integral_v<T>,
99 "expect argument type to be integer");
102 return optInt ? *optInt : defaultInt;
108 static_assert(std::is_floating_point_v<T>,
109 "expect argument type to be floating-point");
112 return optFloat ? *optFloat : defaultFloat;
123 std::string argument = m_arguments.front();
124 m_arguments.erase(m_arguments.begin());
126 if constexpr(std::is_same_v<T, std::string>)
132 static_assert(std::is_integral_v<T> || std::is_floating_point_v<T>,
133 "expect argument type to be integer or floating-point");
Helper for parsing command line arguments.
Definition CommandLineArguments.h:16
std::string retrieveString(const std::string &defaultString="")
Get the first argument passed in and remove it from the internal buffer.
Definition CommandLineArguments.cpp:24
CommandLineArguments(int argc, char *argv[])
Definition CommandLineArguments.cpp:9
bool isEmpty() const
Check if there are arguments yet to be parsed.
Definition CommandLineArguments.h:90
std::vector< std::string > retrieveOptionArguments(const std::string &optionPrefix)
Get the arguments for an option. This method assumes that the options specified are of the form "{- |...
Definition CommandLineArguments.cpp:40
std::string getProgramName() const
Get the program name.
Definition CommandLineArguments.h:85
std::optional< T > retrieve()
Definition CommandLineArguments.h:116
T retrieveFloat(T defaultFloat=0.0f)
Get a float from the arguments. Similar to retrieveString(const std::string&), while the result is co...
Definition CommandLineArguments.h:106
T retrieveInt(T defaultInt=0)
Get an integer from the arguments. Similar to retrieveString(const std::string&), while the result is...
Definition CommandLineArguments.h:96
std::vector< std::string > retrieveStrings(std::size_t numValues)
Get the first N arguments passed in and remove them from the internal buffer.
Definition CommandLineArguments.cpp:30
NumberType parse_number(const std::string_view numberStr)
Returns a number by processing its string representation. Accepts all types supported by parse_float(...
Definition string_utils.h:447
The root for all renderer implementations.
Definition assertion.h:9
String manipulation helpers.