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

Side by Side Diff: shell/src/Command.h

Issue 10016005: Add API calls and stubs for filter matching and subscription management (Closed)
Patch Set: Created April 3, 2013, 12:42 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
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
OLDNEW

Powered by Google App Engine
This is Rietveld