summaryrefslogtreecommitdiff
path: root/src/FbTk/MacroCommand.cc
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2007-12-20 20:52:20 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2007-12-20 20:52:20 (GMT)
commitaef3155784f11d2a7238f314049228e46080374e (patch)
tree0b11cb88c1bef1b908b4552e1c6cb211d88fd3b5 /src/FbTk/MacroCommand.cc
parent03dce043b78103a977bd6c48b81bb1b462aaac5f (diff)
downloadfluxbox_lack-aef3155784f11d2a7238f314049228e46080374e.zip
fluxbox_lack-aef3155784f11d2a7238f314049228e46080374e.tar.bz2
convert macro command parsing to use new StringUtil function
Diffstat (limited to 'src/FbTk/MacroCommand.cc')
-rw-r--r--src/FbTk/MacroCommand.cc26
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
31namespace FbTk { 32namespace FbTk {
@@ -35,21 +36,16 @@ namespace {
35template <typename M> 36template <typename M>
36M *addCommands(M *macro, const std::string &args, bool trusted) { 37M *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)