aboutsummaryrefslogtreecommitdiff
path: root/src/ClientPattern.cc
diff options
context:
space:
mode:
authormathias <mathias>2006-10-27 06:57:43 (GMT)
committermathias <mathias>2006-10-27 06:57:43 (GMT)
commit10082d821d6691f42a8d8ad6fa2e42e5b3f44edd (patch)
tree99c94a6105cf35612307e307be343eda2aea8baf /src/ClientPattern.cc
parent34b7f7ddfc3e914238fd0d30ff50c4f37c2a6dd8 (diff)
downloadfluxbox-10082d821d6691f42a8d8ad6fa2e42e5b3f44edd.zip
fluxbox-10082d821d6691f42a8d8ad6fa2e42e5b3f44edd.tar.bz2
cosmetic patch from slava semushin, removes whitespaces and
uses only those things from "namespace std" what we really need.
Diffstat (limited to 'src/ClientPattern.cc')
-rw-r--r--src/ClientPattern.cc28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/ClientPattern.cc b/src/ClientPattern.cc
index 0016ea7..8ac0cc5 100644
--- a/src/ClientPattern.cc
+++ b/src/ClientPattern.cc
@@ -47,10 +47,10 @@
47#endif 47#endif
48 48
49// needed as well for index on some systems (e.g. solaris) 49// needed as well for index on some systems (e.g. solaris)
50#include <strings.h> 50#include <strings.h>
51 51
52using std::string;
52 53
53using namespace std;
54 54
55ClientPattern::ClientPattern(): 55ClientPattern::ClientPattern():
56 m_matchlimit(0), 56 m_matchlimit(0),
@@ -63,13 +63,13 @@ ClientPattern::ClientPattern(const char *str):
63{ 63{
64 /* A rough grammar of a pattern is: 64 /* A rough grammar of a pattern is:
65 PATTERN ::= MATCH+ LIMIT? 65 PATTERN ::= MATCH+ LIMIT?
66 MATCH ::= '(' word ')' 66 MATCH ::= '(' word ')'
67 | '(' propertyname '=' word ')' 67 | '(' propertyname '=' word ')'
68 LIMIT ::= '{' number '}' 68 LIMIT ::= '{' number '}'
69 69
70 i.e. one or more match definitions, followed by 70 i.e. one or more match definitions, followed by
71 an optional limit on the number of apps to match to 71 an optional limit on the number of apps to match to
72 72
73 Match definitions are enclosed in parentheses, and if no 73 Match definitions are enclosed in parentheses, and if no
74 property name is given, then CLASSNAME is assumed. 74 property name is given, then CLASSNAME is assumed.
75 If no limit is specified, no limit is applied (i.e. limit = infinity) 75 If no limit is specified, no limit is applied (i.e. limit = infinity)
@@ -81,7 +81,7 @@ ClientPattern::ClientPattern(const char *str):
81 string match; 81 string match;
82 int err = 1; // for starting first loop 82 int err = 1; // for starting first loop
83 while (had_error == 0 && err > 0) { 83 while (had_error == 0 && err > 0) {
84 err = FbTk::StringUtil::getStringBetween(match, 84 err = FbTk::StringUtil::getStringBetween(match,
85 str + pos, 85 str + pos,
86 '(', ')', " \t\n", true); 86 '(', ')', " \t\n", true);
87 if (err > 0) { 87 if (err > 0) {
@@ -115,7 +115,7 @@ ClientPattern::ClientPattern(const char *str):
115 } 115 }
116 } 116 }
117 pos += err; 117 pos += err;
118 } 118 }
119 } 119 }
120 if (pos == 0 && had_error == 0) { 120 if (pos == 0 && had_error == 0) {
121 // no match terms given, this is not allowed 121 // no match terms given, this is not allowed
@@ -125,7 +125,7 @@ ClientPattern::ClientPattern(const char *str):
125 if (had_error == 0) { 125 if (had_error == 0) {
126 // otherwise, we check for a number 126 // otherwise, we check for a number
127 string number; 127 string number;
128 err = FbTk::StringUtil::getStringBetween(number, 128 err = FbTk::StringUtil::getStringBetween(number,
129 str+pos, 129 str+pos,
130 '{', '}'); 130 '{', '}');
131 if (err > 0) { 131 if (err > 0) {
@@ -134,7 +134,7 @@ ClientPattern::ClientPattern(const char *str):
134 pos+=err; 134 pos+=err;
135 } 135 }
136 // we don't care if there isn't one 136 // we don't care if there isn't one
137 137
138 // there shouldn't be anything else on the line 138 // there shouldn't be anything else on the line
139 match = str + pos; 139 match = str + pos;
140 size_t uerr;// need a special type here 140 size_t uerr;// need a special type here
@@ -154,7 +154,7 @@ ClientPattern::ClientPattern(const char *str):
154 m_terms.pop_back(); 154 m_terms.pop_back();
155 } 155 }
156 } 156 }
157} 157}
158 158
159ClientPattern::~ClientPattern() { 159ClientPattern::~ClientPattern() {
160 // delete all the terms 160 // delete all the terms
@@ -165,7 +165,7 @@ ClientPattern::~ClientPattern() {
165} 165}
166 166
167// return a string representation of this pattern 167// return a string representation of this pattern
168std::string ClientPattern::toString() const { 168string ClientPattern::toString() const {
169 string pat; 169 string pat;
170 Terms::const_iterator it = m_terms.begin(); 170 Terms::const_iterator it = m_terms.begin();
171 Terms::const_iterator it_end = m_terms.end(); 171 Terms::const_iterator it_end = m_terms.end();
@@ -206,7 +206,7 @@ std::string ClientPattern::toString() const {
206 206
207// does this client match this pattern? 207// does this client match this pattern?
208bool ClientPattern::match(const WinClient &win) const { 208bool ClientPattern::match(const WinClient &win) const {
209 if (m_matchlimit != 0 && m_nummatches >= m_matchlimit || 209 if (m_matchlimit != 0 && m_nummatches >= m_matchlimit ||
210 m_terms.empty()) 210 m_terms.empty())
211 return false; // already matched out 211 return false; // already matched out
212 212
@@ -225,7 +225,7 @@ bool ClientPattern::match(const WinClient &win) const {
225// add an expression to match against 225// add an expression to match against
226// The first argument is a regular expression, the second is the member 226// The first argument is a regular expression, the second is the member
227// function that we wish to match against. 227// function that we wish to match against.
228bool ClientPattern::addTerm(const std::string &str, WinProperty prop) { 228bool ClientPattern::addTerm(const string &str, WinProperty prop) {
229 229
230 Term *term = new Term(str, true); 230 Term *term = new Term(str, true);
231 term->orig = str; 231 term->orig = str;
@@ -239,7 +239,7 @@ bool ClientPattern::addTerm(const std::string &str, WinProperty prop) {
239 return true; 239 return true;
240} 240}
241 241
242std::string ClientPattern::getProperty(WinProperty prop, const WinClient &client) const { 242string ClientPattern::getProperty(WinProperty prop, const WinClient &client) const {
243 switch (prop) { 243 switch (prop) {
244 case TITLE: 244 case TITLE:
245 return client.title(); 245 return client.title();