aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/LogicCommands.cc
diff options
context:
space:
mode:
authormarkt <markt>2007-11-22 04:07:57 (GMT)
committermarkt <markt>2007-11-22 04:07:57 (GMT)
commit675bc5d66aa08311e99cb00cf836d16a910a73df (patch)
tree9118f77bcc38631f944cdf4a07d2173011a29a9b /src/FbTk/LogicCommands.cc
parent08ebff4b319f51b4263cded0bb9c04103bcd9c3a (diff)
downloadfluxbox-675bc5d66aa08311e99cb00cf836d16a910a73df.zip
fluxbox-675bc5d66aa08311e99cb00cf836d16a910a73df.tar.bz2
added conditional statements to keys file
Diffstat (limited to 'src/FbTk/LogicCommands.cc')
-rw-r--r--src/FbTk/LogicCommands.cc75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/FbTk/LogicCommands.cc b/src/FbTk/LogicCommands.cc
new file mode 100644
index 0000000..99b5b53
--- /dev/null
+++ b/src/FbTk/LogicCommands.cc
@@ -0,0 +1,75 @@
1// LogicCommands.cc for FbTk
2// Copyright (c) 2007 Fluxbox Team (fluxgen at fluxbox dot org)
3//
4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"),
6// to deal in the Software without restriction, including without limitation
7// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8// and/or sell copies of the Software, and to permit persons to whom the
9// Software is furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE.
21
22// $Id: $
23
24#include "LogicCommands.hh"
25
26namespace FbTk {
27
28void OrCommand::add(RefCount<BoolCommand> &com) {
29 m_commandlist.push_back(com);
30}
31
32size_t OrCommand::size() const {
33 return m_commandlist.size();
34}
35
36bool OrCommand::bool_execute() {
37 for (size_t i=0; i < m_commandlist.size(); ++i) {
38 if (m_commandlist[i]->bool_execute())
39 return true;
40 }
41 return false;
42}
43
44void AndCommand::add(RefCount<BoolCommand> &com) {
45 m_commandlist.push_back(com);
46}
47
48size_t AndCommand::size() const {
49 return m_commandlist.size();
50}
51
52bool AndCommand::bool_execute() {
53 for (size_t i=0; i < m_commandlist.size(); ++i) {
54 if (!m_commandlist[i]->bool_execute())
55 return false;
56 }
57 return true;
58}
59
60void XorCommand::add(RefCount<BoolCommand> &com) {
61 m_commandlist.push_back(com);
62}
63
64size_t XorCommand::size() const {
65 return m_commandlist.size();
66}
67
68bool XorCommand::bool_execute() {
69 bool ret = false;
70 for (size_t i=0; i < m_commandlist.size(); ++i)
71 ret ^= m_commandlist[i]->bool_execute();
72 return ret;
73}
74
75}; // end namespace FbTk