Utils/Termlib: Extend the completion API
[senf.git] / Utils / Console / Traits.ct
index f3e0a72..8749e9a 100644 (file)
@@ -31,7 +31,7 @@
 ///////////////////////////////ct.p////////////////////////////////////////
 
 template <class Type>
-prefix_ void
+prefix_ bool
 senf::console::senf_console_parse_argument(ParseCommandInfo::TokensRange const & tokens,
                                            Type & out)
 {
@@ -44,6 +44,7 @@ senf::console::senf_console_parse_argument(ParseCommandInfo::TokensRange const &
     catch (std::bad_cast & ex) {
         throw SyntaxErrorException("parameter syntax error");
     }
+    return false;
 }
 
 ///////////////////////////////////////////////////////////////////////////
@@ -87,8 +88,8 @@ format(type const & value, std::ostream & os)
 {
     unsigned n (0);
     std::stringstream ss;
-    for (unsigned bit (0); bit<sizeof(value.value)*CHAR_BIT; ++bit) {
-        unsigned long flag (1<<bit);
+    unsigned long flag (1);
+    for (unsigned bit (0); bit<sizeof(value.value)*CHAR_BIT; ++bit, flag<<=1) {
         if (value.value & flag) {
             if (n++) ss << " ";
             senf::console::format(static_cast<Enum>(flag), ss);