Added mechanism to understand passed Option without value.
[command.git] / include / callable.h
index 7e6e503c436e23f086306d7c0dd33f1267795eff..bf74377de5ebe5e7823cefdaf873adfb9e2a3953 100644 (file)
@@ -36,6 +36,38 @@ namespace command {
             this->func(value);
         }
     };
+
+    /**
+     * Template specialization of Callable behaviour class.
+     * Allows passing functions with void argument
+     */
+    template<>
+    class Callable<void> {
+    protected:
+        /**
+         * Function handling user Arguments
+         */
+        void (*func)(void);
+
+    public:
+        /**
+         * Default constructor.
+         *
+         * @param function Function that will be invoked
+         */
+        Callable(void (*function)(void))
+            : func(function) {
+        }
+        virtual ~Callable() { }
+
+    protected:
+        /**
+         * Executes command
+         */
+        void call() {
+            this->func();
+        }
+    };
 }
 
 #endif /* __COMMAND_DESCRIPTIVE_H */