diff options
author | Mark Tiefenbruck <mark@fluxbox.org> | 2008-01-11 07:41:22 (GMT) |
---|---|---|
committer | Mark Tiefenbruck <mark@fluxbox.org> | 2008-01-11 07:41:22 (GMT) |
commit | 9f2f65a698c4cc71373a7fe9d73a0889e0d3487b (patch) | |
tree | 4ad67db771d73ea3c48f80a1244037fc9754edd2 /src/FbTk/MacroCommand.cc | |
parent | 1f01d84c080d607a91eb417efcaf5e500b5f1d7e (diff) | |
download | fluxbox-9f2f65a698c4cc71373a7fe9d73a0889e0d3487b.zip fluxbox-9f2f65a698c4cc71373a7fe9d73a0889e0d3487b.tar.bz2 |
make FbTk::Command a template class, split parsing information out of ObjectRegistry
Diffstat (limited to 'src/FbTk/MacroCommand.cc')
-rw-r--r-- | src/FbTk/MacroCommand.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/FbTk/MacroCommand.cc b/src/FbTk/MacroCommand.cc index 63e532f..372cde9 100644 --- a/src/FbTk/MacroCommand.cc +++ b/src/FbTk/MacroCommand.cc | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | #include "MacroCommand.hh" | 22 | #include "MacroCommand.hh" |
23 | 23 | ||
24 | #include "ObjectRegistry.hh" | 24 | #include "CommandParser.hh" |
25 | #include "StringUtil.hh" | 25 | #include "StringUtil.hh" |
26 | 26 | ||
27 | #include <list> | 27 | #include <list> |
@@ -36,11 +36,11 @@ M *addCommands(M *macro, const std::string &args, bool trusted) { | |||
36 | std::string blah; | 36 | std::string blah; |
37 | std::list<std::string> cmds; | 37 | std::list<std::string> cmds; |
38 | StringUtil::stringTokensBetween(cmds, args, blah, '{', '}'); | 38 | StringUtil::stringTokensBetween(cmds, args, blah, '{', '}'); |
39 | RefCount<Command> cmd(0); | 39 | RefCount<Command<void> > cmd(0); |
40 | 40 | ||
41 | std::list<std::string>::iterator it = cmds.begin(), it_end = cmds.end(); | 41 | std::list<std::string>::iterator it = cmds.begin(), it_end = cmds.end(); |
42 | for (; it != it_end; ++it) { | 42 | for (; it != it_end; ++it) { |
43 | cmd = ObjectRegistry<Command>::instance().parse(*it, trusted); | 43 | cmd = CommandParser<void>::instance().parse(*it, trusted); |
44 | if (*cmd) | 44 | if (*cmd) |
45 | macro->add(cmd); | 45 | macro->add(cmd); |
46 | } | 46 | } |
@@ -52,21 +52,21 @@ M *addCommands(M *macro, const std::string &args, bool trusted) { | |||
52 | return 0; | 52 | return 0; |
53 | } | 53 | } |
54 | 54 | ||
55 | Command *parseMacroCmd(const std::string &command, const std::string &args, | 55 | Command<void> *parseMacroCmd(const std::string &command, const std::string &args, |
56 | bool trusted) { | 56 | bool trusted) { |
57 | if (command == "macrocmd") | 57 | if (command == "macrocmd") |
58 | return addCommands<MacroCommand>(new MacroCommand, args, trusted); | 58 | return addCommands<MacroCommand >(new MacroCommand, args, trusted); |
59 | else if (command == "togglecmd") | 59 | else if (command == "togglecmd") |
60 | return addCommands<ToggleCommand>(new ToggleCommand, args, trusted); | 60 | return addCommands<ToggleCommand >(new ToggleCommand, args, trusted); |
61 | return 0; | 61 | return 0; |
62 | } | 62 | } |
63 | 63 | ||
64 | REGISTER_OBJECT_PARSER(macrocmd, parseMacroCmd, Command); | 64 | REGISTER_COMMAND_PARSER(macrocmd, parseMacroCmd, void); |
65 | REGISTER_OBJECT_PARSER(togglecmd, parseMacroCmd, Command); | 65 | REGISTER_COMMAND_PARSER(togglecmd, parseMacroCmd, void); |
66 | 66 | ||
67 | }; // end anonymous namespace | 67 | }; // end anonymous namespace |
68 | 68 | ||
69 | void MacroCommand::add(RefCount<Command> &com) { | 69 | void MacroCommand::add(RefCount<Command<void> > &com) { |
70 | m_commandlist.push_back(com); | 70 | m_commandlist.push_back(com); |
71 | } | 71 | } |
72 | 72 | ||
@@ -83,7 +83,7 @@ ToggleCommand::ToggleCommand() { | |||
83 | m_state = 0; | 83 | m_state = 0; |
84 | } | 84 | } |
85 | 85 | ||
86 | void ToggleCommand::add(RefCount<Command> &com) { | 86 | void ToggleCommand::add(RefCount<Command<void> > &com) { |
87 | m_commandlist.push_back(com); | 87 | m_commandlist.push_back(com); |
88 | } | 88 | } |
89 | 89 | ||