X-Git-Url: https://git.dlugolecki.net.pl/?p=command.git;a=blobdiff_plain;f=include%2Fcallable.h;h=bf74377de5ebe5e7823cefdaf873adfb9e2a3953;hp=7e6e503c436e23f086306d7c0dd33f1267795eff;hb=c85d60a873e21052a470c172df4ba56a1c0d59c6;hpb=2900a7396aa582dcf622b968c286059b28d9c0a8 diff --git a/include/callable.h b/include/callable.h index 7e6e503..bf74377 100644 --- a/include/callable.h +++ b/include/callable.h @@ -36,6 +36,38 @@ namespace command { this->func(value); } }; + + /** + * Template specialization of Callable behaviour class. + * Allows passing functions with void argument + */ + template<> + class Callable { + 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 */