diff options
author | rathnor <rathnor> | 2003-04-26 12:01:55 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2003-04-26 12:01:55 (GMT) |
commit | 007fb25e821c0ea8fb6419626464a8d9d79aa9b2 (patch) | |
tree | 26fd40ad586609cb104898ed06d34d0767cba610 /src | |
parent | 9fa14bd5ffb7caac30232e9014ccc114424c678e (diff) | |
download | fluxbox_lack-007fb25e821c0ea8fb6419626464a8d9d79aa9b2.zip fluxbox_lack-007fb25e821c0ea8fb6419626464a8d9d79aa9b2.tar.bz2 |
more namespace corrections (doh)
Diffstat (limited to 'src')
-rw-r--r-- | src/Remember.cc | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/src/Remember.cc b/src/Remember.cc index d4af300..81de0b3 100644 --- a/src/Remember.cc +++ b/src/Remember.cc | |||
@@ -20,7 +20,7 @@ | |||
20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
21 | // DEALINGS IN THE SOFTWARE. | 21 | // DEALINGS IN THE SOFTWARE. |
22 | 22 | ||
23 | // $Id: Remember.cc,v 1.2 2003/04/26 11:24:55 rathnor Exp $ | 23 | // $Id: Remember.cc,v 1.3 2003/04/26 12:01:55 rathnor Exp $ |
24 | 24 | ||
25 | #include "Remember.hh" | 25 | #include "Remember.hh" |
26 | #include "StringUtil.hh" | 26 | #include "StringUtil.hh" |
@@ -47,6 +47,8 @@ | |||
47 | #define MAXPATHLEN 255 | 47 | #define MAXPATHLEN 255 |
48 | #endif // MAXPATHLEN | 48 | #endif // MAXPATHLEN |
49 | 49 | ||
50 | using namespace std; | ||
51 | |||
50 | namespace { | 52 | namespace { |
51 | 53 | ||
52 | class RememberMenuItem : public FbTk::MenuItem { | 54 | class RememberMenuItem : public FbTk::MenuItem { |
@@ -155,7 +157,7 @@ const char * getWMClass(Window w) { | |||
155 | cerr<<"Failed to read class hint!"<<endl; | 157 | cerr<<"Failed to read class hint!"<<endl; |
156 | return 0; | 158 | return 0; |
157 | } else { | 159 | } else { |
158 | std::string m_class_name; | 160 | string m_class_name; |
159 | if (ch.res_name != 0) { | 161 | if (ch.res_name != 0) { |
160 | //m_instance_name = const_cast<char *>(ch.res_name); | 162 | //m_instance_name = const_cast<char *>(ch.res_name); |
161 | XFree(ch.res_name); | 163 | XFree(ch.res_name); |
@@ -192,15 +194,15 @@ Application* Remember::find(const char* app_name) { | |||
192 | return NULL; | 194 | return NULL; |
193 | } | 195 | } |
194 | 196 | ||
195 | int Remember::parseApp(std::ifstream &file, Application *a) { | 197 | int Remember::parseApp(ifstream &file, Application *a) { |
196 | std::string line; | 198 | string line; |
197 | int row = 0; | 199 | int row = 0; |
198 | while (! file.eof()) { | 200 | while (! file.eof()) { |
199 | if (getline(file, line)) { | 201 | if (getline(file, line)) { |
200 | row++; | 202 | row++; |
201 | if (line[0] != '#') { //the line is commented | 203 | if (line[0] != '#') { //the line is commented |
202 | int parse_pos = 0, err = 0; | 204 | int parse_pos = 0, err = 0; |
203 | std::string str_key, str_label; | 205 | string str_key, str_label; |
204 | err = StringUtil::getStringBetween(str_key, line.c_str(), '[', ']'); | 206 | err = StringUtil::getStringBetween(str_key, line.c_str(), '[', ']'); |
205 | if (err > 0 ) { | 207 | if (err > 0 ) { |
206 | parse_pos += err; | 208 | parse_pos += err; |
@@ -214,17 +216,17 @@ int Remember::parseApp(std::ifstream &file, Application *a) { | |||
214 | continue; //read next line | 216 | continue; //read next line |
215 | if (str_key == "Workspace") { | 217 | if (str_key == "Workspace") { |
216 | unsigned int w; | 218 | unsigned int w; |
217 | std::istringstream iss(str_label.c_str()); | 219 | istringstream iss(str_label.c_str()); |
218 | iss >> w; | 220 | iss >> w; |
219 | a->rememberWorkspace(w); | 221 | a->rememberWorkspace(w); |
220 | } else if (str_key == "Dimensions") { | 222 | } else if (str_key == "Dimensions") { |
221 | unsigned int h,w; | 223 | unsigned int h,w; |
222 | std::istringstream iss(str_label.c_str()); | 224 | istringstream iss(str_label.c_str()); |
223 | iss >> w >> h; | 225 | iss >> w >> h; |
224 | a->rememberDimensions(w,h); | 226 | a->rememberDimensions(w,h); |
225 | } else if (str_key == "Position") { | 227 | } else if (str_key == "Position") { |
226 | unsigned int x,y; | 228 | unsigned int x,y; |
227 | std::istringstream iss(str_label); | 229 | istringstream iss(str_label); |
228 | iss >> x >> y; | 230 | iss >> x >> y; |
229 | a->rememberPosition(x,y); | 231 | a->rememberPosition(x,y); |
230 | } else if (str_key == "Shaded") { | 232 | } else if (str_key == "Shaded") { |
@@ -251,7 +253,7 @@ int Remember::parseApp(std::ifstream &file, Application *a) { | |||
251 | unsigned int mask; | 253 | unsigned int mask; |
252 | const char * str = str_label.c_str(); | 254 | const char * str = str_label.c_str(); |
253 | // it'll have at least one char and \0, so this is safe | 255 | // it'll have at least one char and \0, so this is safe |
254 | std::istringstream iss(str); | 256 | istringstream iss(str); |
255 | // check for hex | 257 | // check for hex |
256 | if (str[0] == '0' && str[1] == 'x') { | 258 | if (str[0] == '0' && str[1] == 'x') { |
257 | iss.seekg(2); | 259 | iss.seekg(2); |
@@ -281,23 +283,23 @@ void Remember::load() { | |||
281 | #ifdef DEBUG | 283 | #ifdef DEBUG |
282 | cerr << "Loading apps file..." << endl; | 284 | cerr << "Loading apps file..." << endl; |
283 | #endif // DEBUG | 285 | #endif // DEBUG |
284 | std::string apps_string = getenv("HOME")+std::string("/.")+RC_PATH+std::string("/")+"apps"; | 286 | string apps_string = getenv("HOME")+string("/.")+RC_PATH+string("/")+"apps"; |
285 | std::ifstream apps_file(apps_string.c_str()); | 287 | ifstream apps_file(apps_string.c_str()); |
286 | if (!apps_file.fail()) { | 288 | if (!apps_file.fail()) { |
287 | if (!apps_file.eof()) { | 289 | if (!apps_file.eof()) { |
288 | std::string line; | 290 | string line; |
289 | int row = 0; | 291 | int row = 0; |
290 | while (getline(apps_file, line) && ! apps_file.eof()) { | 292 | while (getline(apps_file, line) && ! apps_file.eof()) { |
291 | row++; | 293 | row++; |
292 | if (line[0] == '#') | 294 | if (line[0] == '#') |
293 | continue; | 295 | continue; |
294 | std::string key; | 296 | string key; |
295 | int pos=0; | 297 | int pos=0; |
296 | int err = StringUtil::getStringBetween(key, line.c_str(), '[', ']'); | 298 | int err = StringUtil::getStringBetween(key, line.c_str(), '[', ']'); |
297 | 299 | ||
298 | if (err >0 && key == "app") { | 300 | if (err >0 && key == "app") { |
299 | pos += err; | 301 | pos += err; |
300 | std::string label; | 302 | string label; |
301 | err = StringUtil::getStringBetween(label, line.c_str()+pos, '(', ')'); | 303 | err = StringUtil::getStringBetween(label, line.c_str()+pos, '(', ')'); |
302 | if (err>0) { | 304 | if (err>0) { |
303 | Application *a; | 305 | Application *a; |
@@ -328,8 +330,8 @@ void Remember::save() { | |||
328 | #ifdef DEBUG | 330 | #ifdef DEBUG |
329 | cerr << "Saving apps file..." << endl; | 331 | cerr << "Saving apps file..." << endl; |
330 | #endif // DEBUG | 332 | #endif // DEBUG |
331 | std::string apps_string = getenv("HOME")+std::string("/.")+RC_PATH+std::string("/")+"apps"; | 333 | string apps_string = getenv("HOME")+string("/.")+RC_PATH+string("/")+"apps"; |
332 | std::ofstream apps_file(apps_string.c_str()); | 334 | ofstream apps_file(apps_string.c_str()); |
333 | Apps::iterator it = apps.begin(); | 335 | Apps::iterator it = apps.begin(); |
334 | Apps::iterator it_end = apps.end(); | 336 | Apps::iterator it_end = apps.end(); |
335 | for (; it != it_end; ++it) { | 337 | for (; it != it_end; ++it) { |