Command  0.3
command.h
1#ifndef __COMMAND_COMMAND_H
2#define __COMMAND_COMMAND_H
3
4#include <string>
5#include <vector>
6#include <typeinfo>
7#include <iostream>
8
9#include "parameter.h"
10#include "grouped.h"
11
12namespace command {
16 class Command : protected Grouped {
17 public:
26 Command(unsigned int argc, char *argv[], std::initializer_list<Parameter *> params)
27 : Grouped(params, "Command") {
28 try {
29 for (unsigned int i = 1; i < argc; i++) {
30 this->understand(argv[i]);
31 }
32 handle();
33 }
34 catch(const std::invalid_argument & exception) {
36 throw;
37 }
38 catch(const std::logic_error & exception) {
40 throw;
41 }
42 }
43
49 }
50 };
51}
52
53#endif /* __COMMAND_COMMAND_H */
Definition: command.h:16
Command(unsigned int argc, char *argv[], std::initializer_list< Parameter * > params)
Definition: command.h:26
~Command()
Definition: command.h:47
Definition: grouped.h:19
virtual void handle()
Definition: grouped.h:57
virtual bool understand(const std::string &value)
Definition: grouped.h:83
void releaseMemory()
Definition: grouped.h:147