aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/LogicCommands.cc
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2007-12-16 03:36:01 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2007-12-16 03:36:01 (GMT)
commit8516f1e2a21a374127ccfa3f7b8de2443e67fe33 (patch)
treea66f212f856981584b2b44bfc772096c5ee7bebe /src/FbTk/LogicCommands.cc
parent90f4f1ecc1635fd5d144f86d64b1674958d0a59f (diff)
downloadfluxbox-8516f1e2a21a374127ccfa3f7b8de2443e67fe33.zip
fluxbox-8516f1e2a21a374127ccfa3f7b8de2443e67fe33.tar.bz2
changed CommandRegistry to a template class, renamed to ObjectRegistry<Type>
Diffstat (limited to 'src/FbTk/LogicCommands.cc')
-rw-r--r--src/FbTk/LogicCommands.cc24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/FbTk/LogicCommands.cc b/src/FbTk/LogicCommands.cc
index 1c6f238..df5f2d5 100644
--- a/src/FbTk/LogicCommands.cc
+++ b/src/FbTk/LogicCommands.cc
@@ -23,7 +23,7 @@
23 23
24#include "LogicCommands.hh" 24#include "LogicCommands.hh"
25 25
26#include "CommandRegistry.hh" 26#include "ObjectRegistry.hh"
27#include "StringUtil.hh" 27#include "StringUtil.hh"
28 28
29using FbTk::StringUtil::removeFirstWhitespace; 29using FbTk::StringUtil::removeFirstWhitespace;
@@ -47,7 +47,7 @@ M *addCommands(M *macro, const string &args, bool trusted) {
47 if (err == 0) 47 if (err == 0)
48 break; 48 break;
49 49
50 tmp = CommandRegistry::instance().parseBoolLine(cmd, trusted); 50 tmp = ObjectRegistry<BoolCommand>::instance().parse(cmd, trusted);
51 if (*tmp) 51 if (*tmp)
52 macro->add(tmp); 52 macro->add(tmp);
53 } 53 }
@@ -62,7 +62,7 @@ BoolCommand *parseLogicCommand(const string &command, const string &args,
62 bool trusted) { 62 bool trusted) {
63 if (command == "not") { 63 if (command == "not") {
64 BoolCommand *boolcmd = 64 BoolCommand *boolcmd =
65 CommandRegistry::instance().parseBoolLine(args, trusted); 65 ObjectRegistry<BoolCommand>::instance().parse(args, trusted);
66 if (!boolcmd) 66 if (!boolcmd)
67 return 0; 67 return 0;
68 RefCount<BoolCommand> ref(boolcmd); 68 RefCount<BoolCommand> ref(boolcmd);
@@ -76,10 +76,10 @@ BoolCommand *parseLogicCommand(const string &command, const string &args,
76 return 0; 76 return 0;
77} 77}
78 78
79REGISTER_BOOLCOMMAND_PARSER(not, parseLogicCommand); 79REGISTER_OBJECT_PARSER(not, parseLogicCommand, BoolCommand);
80REGISTER_BOOLCOMMAND_PARSER(and, parseLogicCommand); 80REGISTER_OBJECT_PARSER(and, parseLogicCommand, BoolCommand);
81REGISTER_BOOLCOMMAND_PARSER(or, parseLogicCommand); 81REGISTER_OBJECT_PARSER(or, parseLogicCommand, BoolCommand);
82REGISTER_BOOLCOMMAND_PARSER(xor, parseLogicCommand); 82REGISTER_OBJECT_PARSER(xor, parseLogicCommand, BoolCommand);
83 83
84}; // end anonymous namespace 84}; // end anonymous namespace
85 85
@@ -93,7 +93,7 @@ Command *IfCommand::parse(const std::string &command, const std::string &args,
93 err = StringUtil::getStringBetween(cmd, args.c_str(), 93 err = StringUtil::getStringBetween(cmd, args.c_str(),
94 '{', '}', " \t\n", true); 94 '{', '}', " \t\n", true);
95 if (err > 0) 95 if (err > 0)
96 cond = CommandRegistry::instance().parseBoolLine(cmd, trusted); 96 cond = ObjectRegistry<BoolCommand>::instance().parse(cmd, trusted);
97 if (err == 0 || *cond == 0) 97 if (err == 0 || *cond == 0)
98 return 0; 98 return 0;
99 99
@@ -102,21 +102,21 @@ Command *IfCommand::parse(const std::string &command, const std::string &args,
102 '{', '}', " \t\n", true); 102 '{', '}', " \t\n", true);
103 if (err == 0) 103 if (err == 0)
104 return 0; 104 return 0;
105 t = CommandRegistry::instance().parseLine(cmd, trusted); 105 t = ObjectRegistry<Command>::instance().parse(cmd, trusted);
106 106
107 pos += err; 107 pos += err;
108 err = StringUtil::getStringBetween(cmd, args.c_str() + pos, 108 err = StringUtil::getStringBetween(cmd, args.c_str() + pos,
109 '{', '}', " \t\n", true); 109 '{', '}', " \t\n", true);
110 if (err > 0) 110 if (err > 0)
111 f = CommandRegistry::instance().parseLine(cmd, trusted); 111 f = ObjectRegistry<Command>::instance().parse(cmd, trusted);
112 if (err == 0 || *t == 0 && *f == 0) 112 if (err == 0 || *t == 0 && *f == 0)
113 return 0; 113 return 0;
114 114
115 return new IfCommand(cond, t, f); 115 return new IfCommand(cond, t, f);
116} 116}
117 117
118REGISTER_COMMAND_PARSER(if, IfCommand::parse); 118REGISTER_OBJECT_PARSER(if, IfCommand::parse, Command);
119REGISTER_COMMAND_PARSER(cond, IfCommand::parse); 119REGISTER_OBJECT_PARSER(cond, IfCommand::parse, Command);
120 120
121void OrCommand::add(RefCount<BoolCommand> &com) { 121void OrCommand::add(RefCount<BoolCommand> &com) {
122 m_commandlist.push_back(com); 122 m_commandlist.push_back(com);