diff options
Diffstat (limited to 'src/FbTk/MacroCommand.cc')
-rw-r--r-- | src/FbTk/MacroCommand.cc | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/src/FbTk/MacroCommand.cc b/src/FbTk/MacroCommand.cc index 55d403c..3a05179 100644 --- a/src/FbTk/MacroCommand.cc +++ b/src/FbTk/MacroCommand.cc | |||
@@ -26,6 +26,7 @@ | |||
26 | #include "ObjectRegistry.hh" | 26 | #include "ObjectRegistry.hh" |
27 | #include "StringUtil.hh" | 27 | #include "StringUtil.hh" |
28 | 28 | ||
29 | #include <list> | ||
29 | #include <string> | 30 | #include <string> |
30 | 31 | ||
31 | namespace FbTk { | 32 | namespace FbTk { |
@@ -35,21 +36,16 @@ namespace { | |||
35 | template <typename M> | 36 | template <typename M> |
36 | M *addCommands(M *macro, const std::string &args, bool trusted) { | 37 | M *addCommands(M *macro, const std::string &args, bool trusted) { |
37 | 38 | ||
38 | std::string cmd; | 39 | std::string blah; |
39 | int err = 0; | 40 | std::list<std::string> cmds; |
40 | int pos = 0; | 41 | StringUtil::stringTokensBetween(cmds, args, blah, '{', '}'); |
41 | 42 | RefCount<Command> cmd(0); | |
42 | while (true) { | 43 | |
43 | RefCount<Command> next(0); | 44 | std::list<std::string>::iterator it = cmds.begin(), it_end = cmds.end(); |
44 | pos += err; | 45 | for (; it != it_end; ++it) { |
45 | err = StringUtil::getStringBetween(cmd, args.c_str() + pos, | 46 | cmd = ObjectRegistry<Command>::instance().parse(*it, trusted); |
46 | '{', '}', " \t\n", true); | 47 | if (*cmd) |
47 | if (err == 0) | 48 | macro->add(cmd); |
48 | break; | ||
49 | if (err > 0) | ||
50 | next = ObjectRegistry<Command>::instance().parse(cmd, trusted); | ||
51 | if (*next != 0) | ||
52 | macro->add(next); | ||
53 | } | 49 | } |
54 | 50 | ||
55 | if (macro->size() > 0) | 51 | if (macro->size() > 0) |