aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/LogicCommands.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/LogicCommands.hh')
-rw-r--r--src/FbTk/LogicCommands.hh56
1 files changed, 28 insertions, 28 deletions
diff --git a/src/FbTk/LogicCommands.hh b/src/FbTk/LogicCommands.hh
index 96d648e..5e84473 100644
--- a/src/FbTk/LogicCommands.hh
+++ b/src/FbTk/LogicCommands.hh
@@ -30,66 +30,66 @@
30 30
31namespace FbTk { 31namespace FbTk {
32 32
33/// executes a boolcommand and uses the result to decide what to do 33/// executes a Command<bool> and uses the result to decide what to do
34class IfCommand: public Command { 34class IfCommand: public Command<void> {
35public: 35public:
36 IfCommand(RefCount<BoolCommand> &cond, 36 IfCommand(RefCount<Command<bool> > &cond,
37 RefCount<Command> &t, RefCount<Command> &f): 37 RefCount<Command<void> > &t, RefCount<Command<void> > &f):
38 m_cond(cond), m_t(t), m_f(f) { } 38 m_cond(cond), m_t(t), m_f(f) { }
39 void execute() { 39 void execute() {
40 if (m_cond->bool_execute()) { 40 if (m_cond->execute()) {
41 if (*m_t) m_t->execute(); 41 if (*m_t) m_t->execute();
42 } else 42 } else
43 if (*m_f) m_f->execute(); 43 if (*m_f) m_f->execute();
44 } 44 }
45 static Command *parse(const std::string &cmd, const std::string &args, 45 static Command<void> *parse(const std::string &cmd, const std::string &args,
46 bool trusted); 46 bool trusted);
47private: 47private:
48 RefCount<BoolCommand> m_cond; 48 RefCount<Command<bool> > m_cond;
49 RefCount<Command> m_t, m_f; 49 RefCount<Command<void> > m_t, m_f;
50}; 50};
51 51
52/// executes a list of boolcommands until one is true 52/// executes a list of Command<bool>s until one is true
53class OrCommand: public BoolCommand { 53class OrCommand: public Command<bool> {
54public: 54public:
55 void add(RefCount<BoolCommand> &com); 55 void add(RefCount<Command<bool> > &com);
56 size_t size() const; 56 size_t size() const;
57 bool bool_execute(); 57 bool execute();
58 58
59private: 59private:
60 std::vector<RefCount<BoolCommand> > m_commandlist; 60 std::vector<RefCount<Command<bool> > > m_commandlist;
61}; 61};
62 62
63/// executes a list of boolcommands until one is false 63/// executes a list of Command<bool>s until one is false
64class AndCommand: public BoolCommand { 64class AndCommand: public Command<bool> {
65public: 65public:
66 void add(RefCount<BoolCommand> &com); 66 void add(RefCount<Command<bool> > &com);
67 size_t size() const; 67 size_t size() const;
68 bool bool_execute(); 68 bool execute();
69 69
70private: 70private:
71 std::vector<RefCount<BoolCommand> > m_commandlist; 71 std::vector<RefCount<Command<bool> > > m_commandlist;
72}; 72};
73 73
74/// executes a list of boolcommands, returning the parity 74/// executes a list of Command<bool>s, returning the parity
75class XorCommand: public BoolCommand { 75class XorCommand: public Command<bool> {
76public: 76public:
77 void add(RefCount<BoolCommand> &com); 77 void add(RefCount<Command<bool> > &com);
78 size_t size() const; 78 size_t size() const;
79 bool bool_execute(); 79 bool execute();
80 80
81private: 81private:
82 std::vector<RefCount<BoolCommand> > m_commandlist; 82 std::vector<RefCount<Command<bool> > > m_commandlist;
83}; 83};
84 84
85/// executes a boolcommand and returns the negation 85/// executes a Command<bool> and returns the negation
86class NotCommand: public BoolCommand { 86class NotCommand: public Command<bool> {
87public: 87public:
88 NotCommand(RefCount<BoolCommand> &com): m_command(com) { } 88 NotCommand(RefCount<Command<bool> > &com): m_command(com) { }
89 bool bool_execute() { return !m_command->bool_execute(); } 89 bool execute() { return !m_command->execute(); }
90 90
91private: 91private:
92 RefCount<BoolCommand> m_command; 92 RefCount<Command<bool> > m_command;
93}; 93};
94 94
95} // end namespace FbTk 95} // end namespace FbTk