| OLD | NEW |
| 1 #ifndef COMMAND_H | 1 #ifndef COMMAND_H |
| 2 #define COMMAND_H | 2 #define COMMAND_H |
| 3 | 3 |
| 4 #include <map> | 4 #include <map> |
| 5 #include <stdexcept> | 5 #include <stdexcept> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 class Command | 8 class Command |
| 9 { | 9 { |
| 10 public: | 10 public: |
| 11 const std::string name; | 11 const std::string name; |
| 12 | 12 |
| 13 explicit Command(const std::string& name); | 13 explicit Command(const std::string& name); |
| 14 virtual ~Command(); | 14 virtual ~Command(); |
| 15 virtual void operator()(const std::string& arguments) = 0; | 15 virtual void operator()(const std::string& arguments) = 0; |
| 16 virtual std::string GetDescription() const = 0; | 16 virtual std::string GetDescription() const = 0; |
| 17 virtual std::string GetUsage() const = 0; | 17 virtual std::string GetUsage() const = 0; |
| 18 |
| 19 protected: |
| 20 void ShowUsage() const; |
| 18 }; | 21 }; |
| 19 | 22 |
| 20 typedef std::map<const std::string, Command*> CommandMap; | 23 typedef std::map<const std::string, Command*> CommandMap; |
| 21 | 24 |
| 22 class NoSuchCommandError : public std::runtime_error | 25 class NoSuchCommandError : public std::runtime_error |
| 23 { | 26 { |
| 24 public: | 27 public: |
| 25 explicit NoSuchCommandError(const std::string& commandName); | 28 explicit NoSuchCommandError(const std::string& commandName); |
| 26 }; | 29 }; |
| 27 | 30 |
| 28 #endif | 31 #endif |
| OLD | NEW |