Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/jarro2783/cxxopts.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjetil Andresen <kjetil.andrese@gmail.com>2020-08-11 01:01:29 +0300
committerGitHub <noreply@github.com>2020-08-11 01:01:29 +0300
commit15e8a74e95ac0f1c45068f5db8ea31776d946b30 (patch)
tree1ee7903f065a9beeb184886e08834feff28c5fb2 /include
parent07f5cb24f1d75aad6c27eafd83863a78a37f16cb (diff)
Support 'const char**' arguments in Options::parse (#250)
`cxxopts` doesn't modify the contents of the argv strings. This changes the parse function to take a reference to a `const char**`.
Diffstat (limited to 'include')
-rw-r--r--include/cxxopts.hpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/include/cxxopts.hpp b/include/cxxopts.hpp
index ae95343..995b893 100644
--- a/include/cxxopts.hpp
+++ b/include/cxxopts.hpp
@@ -1211,7 +1211,7 @@ namespace cxxopts
>,
std::vector<std::string>,
bool allow_unrecognised,
- int&, char**&);
+ int&, const char**&);
size_t
count(const std::string& o) const
@@ -1251,7 +1251,7 @@ namespace cxxopts
private:
void
- parse(int& argc, char**& argv);
+ parse(int& argc, const char**& argv);
void
add_to_option(const std::string& option, const std::string& arg);
@@ -1274,7 +1274,7 @@ namespace cxxopts
checked_parse_arg
(
int argc,
- char* argv[],
+ const char* argv[],
int& current,
const std::shared_ptr<OptionDetails>& value,
const std::string& name
@@ -1361,7 +1361,7 @@ namespace cxxopts
}
ParseResult
- parse(int& argc, char**& argv);
+ parse(int& argc, const char**& argv);
OptionAdder
add_options(std::string group = "");
@@ -1620,7 +1620,7 @@ ParseResult::ParseResult
> options,
std::vector<std::string> positional,
bool allow_unrecognised,
- int& argc, char**& argv
+ int& argc, const char**& argv
)
: m_options(std::move(options))
, m_positional(std::move(positional))
@@ -1734,7 +1734,7 @@ void
ParseResult::checked_parse_arg
(
int argc,
- char* argv[],
+ const char* argv[],
int& current,
const std::shared_ptr<OptionDetails>& value,
const std::string& name
@@ -1835,7 +1835,7 @@ Options::parse_positional(std::initializer_list<std::string> options)
inline
ParseResult
-Options::parse(int& argc, char**& argv)
+Options::parse(int& argc, const char**& argv)
{
ParseResult result(m_options, m_positional, m_allow_unrecognised, argc, argv);
return result;
@@ -1843,7 +1843,7 @@ Options::parse(int& argc, char**& argv)
inline
void
-ParseResult::parse(int& argc, char**& argv)
+ParseResult::parse(int& argc, const char**& argv)
{
int current = 1;