aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/LogicCommands.cc
diff options
context:
space:
mode:
authorPavel Labath <pavelo@centrum.sk>2011-05-01 14:47:53 (GMT)
committerPavel Labath <pavelo@centrum.sk>2011-05-10 11:00:45 (GMT)
commit4b47675441b76620519b0204497686b09113daaa (patch)
treec3494c61a82b84418761000d5fc7fc5d12188204 /src/FbTk/LogicCommands.cc
parentfa15400cc24ddcfd6e361bd068ae1986b9f9e561 (diff)
downloadfluxbox-4b47675441b76620519b0204497686b09113daaa.zip
fluxbox-4b47675441b76620519b0204497686b09113daaa.tar.bz2
Make RefCount<> more sensible
the previous version of operator*() made no sense. E.g., it violated the invariant (*ptr).foo <=> ptr->foo. The dereferencing operator now returns a reference to the pointed-to object, rather than a pointer to it. I also added a bool conversion operator, which can be used in testing the NULL-ness of the pointer. Anyone wondering if that could be done in a simpler way is encouraged to read <http://www.artima.com/cppsource/safebool.html>. And, finally, I removed the mutable flag from the m_data member, since it does not need it.
Diffstat (limited to 'src/FbTk/LogicCommands.cc')
-rw-r--r--src/FbTk/LogicCommands.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/FbTk/LogicCommands.cc b/src/FbTk/LogicCommands.cc
index b3abe31..bda67f5 100644
--- a/src/FbTk/LogicCommands.cc
+++ b/src/FbTk/LogicCommands.cc
@@ -44,7 +44,7 @@ M *addCommands(M *macro, const string &args, bool trusted) {
44 std::vector<std::string>::iterator it = cmds.begin(), it_end = cmds.end(); 44 std::vector<std::string>::iterator it = cmds.begin(), it_end = cmds.end();
45 for (; it != it_end; ++it) { 45 for (; it != it_end; ++it) {
46 cmd = CommandParser<bool>::instance().parse(*it, trusted); 46 cmd = CommandParser<bool>::instance().parse(*it, trusted);
47 if (*cmd) 47 if (cmd)
48 macro->add(cmd); 48 macro->add(cmd);
49 } 49 }
50 50
@@ -91,13 +91,13 @@ Command<void> *IfCommand::parse(const std::string &command, const std::string &a
91 return 0; 91 return 0;
92 92
93 cond = CommandParser<bool>::instance().parse(cmds[0], trusted); 93 cond = CommandParser<bool>::instance().parse(cmds[0], trusted);
94 if (*cond == 0) 94 if (cond == 0)
95 return 0; 95 return 0;
96 96
97 t = CommandParser<void>::instance().parse(cmds[1], trusted); 97 t = CommandParser<void>::instance().parse(cmds[1], trusted);
98 if (cmds.size() >= 3) 98 if (cmds.size() >= 3)
99 f = CommandParser<void>::instance().parse(cmds[2], trusted); 99 f = CommandParser<void>::instance().parse(cmds[2], trusted);
100 if (*t == 0 && *f == 0) 100 if (t == 0 && f == 0)
101 return 0; 101 return 0;
102 102
103 return new IfCommand(cond, t, f); 103 return new IfCommand(cond, t, f);