diff options
author | Max Kellermann <max@musicpd.org> | 2018-01-16 10:13:39 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-01-16 10:13:39 +0100 |
commit | 42c1fe963bc0606f938c1fdef67ff8793850cb00 (patch) | |
tree | ca55a4a95d68059bcdefa04a1f876c570f8cecdd /src/util/OptionParser.hxx | |
parent | 465b154fc0fb26aa60f103f62829288bb6dfa18e (diff) |
util/OptionParser: add "noexcept"
Diffstat (limited to 'src/util/OptionParser.hxx')
-rw-r--r-- | src/util/OptionParser.hxx | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/util/OptionParser.hxx b/src/util/OptionParser.hxx index aa0f9fa7b..c83e8b36c 100644 --- a/src/util/OptionParser.hxx +++ b/src/util/OptionParser.hxx @@ -39,18 +39,18 @@ public: /** * Constructs #OptionParser. */ - OptionParser(int _argc, char **_argv) + OptionParser(int _argc, char **_argv) noexcept :argc(_argc - 1), argv(_argv + 1) {} /** * Checks if there are command line entries to process. */ - bool HasEntries() const { return argc > 0; } + bool HasEntries() const noexcept { return argc > 0; } /** * Gets the last parsed option. */ - char *GetOption() { + char *GetOption() noexcept { assert(option_raw != nullptr); return option_raw; } @@ -58,13 +58,14 @@ public: /** * Checks if current option is a specified option. */ - bool CheckOption(const OptionDef& opt); + bool CheckOption(const OptionDef &opt) const noexcept; /** * Checks if current option is a specified option * or specified alternative option. */ - bool CheckOption(const OptionDef& opt, const OptionDef &alt_opt) { + bool CheckOption(const OptionDef &opt, + const OptionDef &alt_opt) const noexcept { return CheckOption(opt) || CheckOption(alt_opt); } @@ -74,12 +75,12 @@ public: * Regardless of result, advances current position to the next * command line entry. */ - bool ParseNext(); + bool ParseNext() noexcept; /** * Checks if specified string is a command line option. */ - static bool IsOption(const char *s) { + static bool IsOption(const char *s) noexcept { assert(s != nullptr); return s[0] == '-'; } |