diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/getopt/small/last_getopt_easy_setup.h | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 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 60dddda225..f5fabad227 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; + } + }; } |