diff options
author | Pavel Labath <pavelo@centrum.sk> | 2011-05-01 14:47:53 (GMT) |
---|---|---|
committer | Pavel Labath <pavelo@centrum.sk> | 2011-05-10 11:00:45 (GMT) |
commit | 4b47675441b76620519b0204497686b09113daaa (patch) | |
tree | c3494c61a82b84418761000d5fc7fc5d12188204 /src/FbTk/LogicCommands.hh | |
parent | fa15400cc24ddcfd6e361bd068ae1986b9f9e561 (diff) | |
download | fluxbox-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.hh')
-rw-r--r-- | src/FbTk/LogicCommands.hh | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/FbTk/LogicCommands.hh b/src/FbTk/LogicCommands.hh index 5e84473..c0cb938 100644 --- a/src/FbTk/LogicCommands.hh +++ b/src/FbTk/LogicCommands.hh | |||
@@ -38,9 +38,9 @@ public: | |||
38 | m_cond(cond), m_t(t), m_f(f) { } | 38 | m_cond(cond), m_t(t), m_f(f) { } |
39 | void execute() { | 39 | void execute() { |
40 | if (m_cond->execute()) { | 40 | if (m_cond->execute()) { |
41 | if (*m_t) m_t->execute(); | 41 | if (m_t) m_t->execute(); |
42 | } else | 42 | } else |
43 | if (*m_f) m_f->execute(); | 43 | if (m_f) m_f->execute(); |
44 | } | 44 | } |
45 | static Command<void> *parse(const std::string &cmd, const std::string &args, | 45 | static Command<void> *parse(const std::string &cmd, const std::string &args, |
46 | bool trusted); | 46 | bool trusted); |