util/OptionParser: make string pointers "const"
This commit is contained in:
parent
36a6405e8b
commit
4a304bf34e
@ -40,7 +40,7 @@ bool
|
|||||||
OptionParser::ParseNext() noexcept
|
OptionParser::ParseNext() noexcept
|
||||||
{
|
{
|
||||||
assert(HasEntries());
|
assert(HasEntries());
|
||||||
char *arg = *argv;
|
const char *arg = *argv;
|
||||||
++argv;
|
++argv;
|
||||||
--argc;
|
--argc;
|
||||||
if (arg[0] == '-') {
|
if (arg[0] == '-') {
|
||||||
|
@ -30,16 +30,16 @@ class OptionDef;
|
|||||||
class OptionParser
|
class OptionParser
|
||||||
{
|
{
|
||||||
int argc;
|
int argc;
|
||||||
char **argv;
|
char *const*argv;
|
||||||
char *option = nullptr;
|
const char *option = nullptr;
|
||||||
char *option_raw = nullptr;
|
const char *option_raw = nullptr;
|
||||||
bool is_long = false;
|
bool is_long = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Constructs #OptionParser.
|
* Constructs #OptionParser.
|
||||||
*/
|
*/
|
||||||
constexpr OptionParser(int _argc, char **_argv) noexcept
|
constexpr OptionParser(int _argc, char *const*_argv) noexcept
|
||||||
:argc(_argc - 1), argv(_argv + 1) {}
|
:argc(_argc - 1), argv(_argv + 1) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,7 +52,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Gets the last parsed option.
|
* Gets the last parsed option.
|
||||||
*/
|
*/
|
||||||
char *GetOption() noexcept {
|
const char *GetOption() noexcept {
|
||||||
assert(option_raw != nullptr);
|
assert(option_raw != nullptr);
|
||||||
return option_raw;
|
return option_raw;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user