Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: shell/src/Command.h

Issue 9987009: Interface for the libadblockplus API (Closed)
Left Patch Set: Rename to FilterEngine, add a dummy implementation Created March 26, 2013, 1:50 p.m.
Right Patch Set: Reduce redundant redundancy Created March 27, 2013, 6:45 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
LEFTRIGHT
(no file at all)
1
Felix Dahlke 2013/03/27 08:18:26 Gosh, missed that. Removed it :)
1 #ifndef COMMAND_H 2 #ifndef COMMAND_H
2 #define COMMAND_H 3 #define COMMAND_H
3 4
4 #include <map> 5 #include <map>
5 #include <stdexcept> 6 #include <stdexcept>
6 #include <string> 7 #include <string>
7 8
8 class Command 9 class Command
9 { 10 {
10 public: 11 public:
11 const std::string name; 12 const std::string name;
12 13
13 explicit Command(const std::string& name); 14 explicit Command(const std::string& name);
14 virtual ~Command(); 15 virtual ~Command();
15 virtual void operator()(const std::string& arguments) = 0; 16 virtual void operator()(const std::string& arguments) = 0;
16 virtual std::string GetDescription() const = 0; 17 virtual std::string GetDescription() const = 0;
17 virtual std::string GetUsage() const = 0; 18 virtual std::string GetUsage() const = 0;
19
20 protected:
21 void ShowUsage() const;
18 }; 22 };
19 23
20 typedef std::map<const std::string, Command*> CommandMap; 24 typedef std::map<const std::string, Command*> CommandMap;
21 25
22 class NoSuchCommandError : public std::runtime_error 26 class NoSuchCommandError : public std::runtime_error
23 { 27 {
24 public: 28 public:
25 explicit NoSuchCommandError(const std::string& commandName); 29 explicit NoSuchCommandError(const std::string& commandName);
26 }; 30 };
27 31
28 #endif 32 #endif
LEFTRIGHT

Powered by Google App Engine
This is Rietveld