X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FConsole%2FTraits.hh;h=2e848821939f8f153d75a9da2db930b07d5c45ab;hb=82e8df5de8b11448423388632e8602ad97bc7885;hp=df2a6a842740a69db7bd658a03fb514a6800fdfe;hpb=4941cc3d46b3c8066eee01846e2d8de01b87e4e2;p=senf.git diff --git a/Utils/Console/Traits.hh b/Utils/Console/Traits.hh index df2a6a8..2e84882 100644 --- a/Utils/Console/Traits.hh +++ b/Utils/Console/Traits.hh @@ -211,6 +211,32 @@ namespace console { # define SENF_CONSOLE_REGISTER_ENUM_MEMBER(Class, Type, Values) \ SENF_CONSOLE_REGISTER_ENUM_(Class::, Type, Values) + template + struct FlagCollection + { + operator unsigned long() const { return value; } + FlagCollection() : value (0) {} + FlagCollection(unsigned long value_) : value (value_) {} + FlagCollection(Enum value_) : value (value_) {} + unsigned long value; + }; + + template + struct ArgumentTraits< FlagCollection > + { + typedef FlagCollection type; + static void parse(ParseCommandInfo::TokensRange const & tokens, type & out); + static std::string description(); + static std::string str(type const & value); + }; + + template + struct ReturnValueTraits< FlagCollection > + { + typedef FlagCollection type; + static void format(type const & value, std::ostream & os); + }; + }} ///////////////////////////////hh.e////////////////////////////////////////