diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:17 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:17 +0300 |
commit | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch) | |
tree | dd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/getopt/small/last_getopt_easy_setup.h | |
parent | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff) | |
download | ydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/getopt/small/last_getopt_easy_setup.h')
-rw-r--r-- | library/cpp/getopt/small/last_getopt_easy_setup.h | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/library/cpp/getopt/small/last_getopt_easy_setup.h b/library/cpp/getopt/small/last_getopt_easy_setup.h index f5fabad227..60dddda225 100644 --- a/library/cpp/getopt/small/last_getopt_easy_setup.h +++ b/library/cpp/getopt/small/last_getopt_easy_setup.h @@ -3,7 +3,7 @@ #include "last_getopt_opts.h" namespace NLastGetopt { - /** + /** * Wrapper for TOpts class to make the life a bit easier. * Usual usage: * TEasySetup opts; @@ -16,36 +16,36 @@ namespace NLastGetopt { * * NLastGetopt::TOptsParseResult r(&opts, argc, argv); */ - class TEasySetup: public TOpts { - public: - TEasySetup(const TStringBuf& optstring = TStringBuf()); - TEasySetup& operator()(char shortName, const char* longName, const char* help, bool required = false); - TEasySetup& operator()(char shortName, const char* longName, const char* argName, const char* help, bool required = false); - - template <class TpFunc> - TEasySetup& operator()(char shortName, const char* longName, TpFunc handler, const char* help, bool required = false) { - AdjustParam(longName, help, nullptr, handler, required).AddShortName(shortName); - return *this; - } - - TEasySetup& operator()(const char* longName, const char* help, bool required = false); - TEasySetup& operator()(const char* longName, const char* argName, const char* help, bool required = false); - - template <class TpFunc> - TEasySetup& operator()(const char* longName, TpFunc handler, const char* help, bool required = false) { - AdjustParam(longName, help, nullptr, handler, required); - return *this; - } - - private: - TOpt& AdjustParam(const char* longName, const char* help, const char* argName, bool required); - - template <class TpFunc> - TOpt& AdjustParam(const char* longName, const char* help, const char* argName, TpFunc handler, bool required) { - TOpt& o = AdjustParam(longName, help, argName, required); - o.Handler0(handler); - return o; - } - }; + class TEasySetup: public TOpts { + public: + TEasySetup(const TStringBuf& optstring = TStringBuf()); + TEasySetup& operator()(char shortName, const char* longName, const char* help, bool required = false); + TEasySetup& operator()(char shortName, const char* longName, const char* argName, const char* help, bool required = false); + + template <class TpFunc> + TEasySetup& operator()(char shortName, const char* longName, TpFunc handler, const char* help, bool required = false) { + AdjustParam(longName, help, nullptr, handler, required).AddShortName(shortName); + return *this; + } + + TEasySetup& operator()(const char* longName, const char* help, bool required = false); + TEasySetup& operator()(const char* longName, const char* argName, const char* help, bool required = false); + + template <class TpFunc> + TEasySetup& operator()(const char* longName, TpFunc handler, const char* help, bool required = false) { + AdjustParam(longName, help, nullptr, handler, required); + return *this; + } + + private: + TOpt& AdjustParam(const char* longName, const char* help, const char* argName, bool required); + + template <class TpFunc> + TOpt& AdjustParam(const char* longName, const char* help, const char* argName, TpFunc handler, bool required) { + TOpt& o = AdjustParam(longName, help, argName, required); + o.Handler0(handler); + return o; + } + }; } |