aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2005-02-13 16:36:54 (GMT)
committerfluxgen <fluxgen>2005-02-13 16:36:54 (GMT)
commitbac15c745e259b69dafd901d48c16c63c3f91ee1 (patch)
tree03a05e68f1418916efd114665661f3b6b4719db7 /src
parentb8a39c1e6c3fd7d21188193cdb874da474149d33 (diff)
downloadfluxbox_paul-bac15c745e259b69dafd901d48c16c63c3f91ee1.zip
fluxbox_paul-bac15c745e259b69dafd901d48c16c63c3f91ee1.tar.bz2
using stringstream header in FbTk
Diffstat (limited to 'src')
-rw-r--r--src/FbCommandFactory.cc30
-rw-r--r--src/Remember.cc26
2 files changed, 16 insertions, 40 deletions
diff --git a/src/FbCommandFactory.cc b/src/FbCommandFactory.cc
index 7d9a8fb..86f9eff 100644
--- a/src/FbCommandFactory.cc
+++ b/src/FbCommandFactory.cc
@@ -34,22 +34,10 @@
34 34
35#include "FbTk/StringUtil.hh" 35#include "FbTk/StringUtil.hh"
36#include "FbTk/MacroCommand.hh" 36#include "FbTk/MacroCommand.hh"
37#include "FbTk/stringstream.hh"
37 38
38#include <string> 39#include <string>
39 40
40#ifdef HAVE_CONFIG_H
41#include "config.h"
42#endif // HAVE_CONFIG_H
43
44#ifdef HAVE_SSTREAM
45#include <sstream>
46#define FB_istringstream istringstream
47#elif HAVE_STRSTREAM
48#include <strstream>
49#define FB_istringstream istrstream
50#else
51#error "You dont have sstream or strstream headers!"
52#endif // HAVE_STRSTREAM
53 41
54using namespace std; 42using namespace std;
55 43
@@ -151,11 +139,11 @@ FbCommandFactory::FbCommandFactory() {
151 "workspace12", 139 "workspace12",
152 /* end note */ 140 /* end note */
153 "workspacemenu", 141 "workspacemenu",
154 "" 142 0
155 }; 143 };
156 144
157 for (int i=0;; ++i) { 145 for (int i=0;; ++i) {
158 if (strcmp(commands[i], "") == 0) 146 if (commands[i] == 0)
159 break; 147 break;
160 addCommand(commands[i]); 148 addCommand(commands[i]);
161 } 149 }
@@ -229,13 +217,13 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
229 else if (command == "maximizehorizontal") 217 else if (command == "maximizehorizontal")
230 return new CurrentWindowCmd(&FluxboxWindow::maximizeHorizontal); 218 return new CurrentWindowCmd(&FluxboxWindow::maximizeHorizontal);
231 else if (command == "resize") { 219 else if (command == "resize") {
232 FB_istringstream is(arguments.c_str()); 220 FbTk_istringstream is(arguments.c_str());
233 int dx = 0, dy = 0; 221 int dx = 0, dy = 0;
234 is >> dx >> dy; 222 is >> dx >> dy;
235 return new ResizeCmd(dx, dy); 223 return new ResizeCmd(dx, dy);
236 } 224 }
237 else if (command == "resizeto") { 225 else if (command == "resizeto") {
238 FB_istringstream is(arguments.c_str()); 226 FbTk_istringstream is(arguments.c_str());
239 int dx = 0, dy = 0; 227 int dx = 0, dy = 0;
240 is >> dx >> dy; 228 is >> dx >> dy;
241 return new ResizeToCmd(dx, dy); 229 return new ResizeToCmd(dx, dy);
@@ -245,13 +233,13 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
245 else if (command == "resizevertical") 233 else if (command == "resizevertical")
246 return new ResizeCmd(0,atoi(arguments.c_str())); 234 return new ResizeCmd(0,atoi(arguments.c_str()));
247 else if (command == "moveto") { 235 else if (command == "moveto") {
248 FB_istringstream is(arguments.c_str()); 236 FbTk_istringstream is(arguments.c_str());
249 int dx = 0, dy = 0; 237 int dx = 0, dy = 0;
250 is >> dx >> dy; 238 is >> dx >> dy;
251 return new MoveToCmd(dx,dy); 239 return new MoveToCmd(dx,dy);
252 } 240 }
253 else if (command == "move") { 241 else if (command == "move") {
254 FB_istringstream is(arguments.c_str()); 242 FbTk_istringstream is(arguments.c_str());
255 int dx = 0, dy = 0; 243 int dx = 0, dy = 0;
256 is >> dx >> dy; 244 is >> dx >> dy;
257 return new MoveCmd(dx, dy); 245 return new MoveCmd(dx, dy);
@@ -367,7 +355,7 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
367 // 355 //
368 else if (command == "deiconify") { 356 else if (command == "deiconify") {
369 357
370 FB_istringstream iss(arguments); 358 FbTk_istringstream iss(arguments);
371 string mode; 359 string mode;
372 string d; 360 string d;
373 DeiconifyCmd::Destination dest; 361 DeiconifyCmd::Destination dest;
@@ -419,7 +407,7 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
419 c= FbTk::StringUtil::toLower(cmd); 407 c= FbTk::StringUtil::toLower(cmd);
420 408
421 FbTk::Command* fbcmd= stringToCommand(c,a); 409 FbTk::Command* fbcmd= stringToCommand(c,a);
422 if ( fbcmd ) { 410 if (fbcmd) {
423 FbTk::RefCount<FbTk::Command> rfbcmd(fbcmd); 411 FbTk::RefCount<FbTk::Command> rfbcmd(fbcmd);
424 macro->add(rfbcmd); 412 macro->add(rfbcmd);
425 } 413 }
diff --git a/src/Remember.cc b/src/Remember.cc
index 2bf1e1f..fb65444 100644
--- a/src/Remember.cc
+++ b/src/Remember.cc
@@ -36,6 +36,7 @@
36#include "FbTk/StringUtil.hh" 36#include "FbTk/StringUtil.hh"
37#include "FbTk/MenuItem.hh" 37#include "FbTk/MenuItem.hh"
38#include "FbTk/App.hh" 38#include "FbTk/App.hh"
39#include "FbTk/stringstream.hh"
39 40
40 41
41#include <X11/Xlib.h> 42#include <X11/Xlib.h>
@@ -52,19 +53,6 @@
52#include <memory> 53#include <memory>
53#include <set> 54#include <set>
54 55
55#ifdef HAVE_CONFIG_H
56#include "config.h"
57#endif // HAVE_CONFIG_H
58
59#ifdef HAVE_SSTREAM
60#include <sstream>
61#define FB_istringstream istringstream
62#elif HAVE_STRSTREAM
63#include <strstream>
64#define FB_istringstream istrstream
65#else
66#error "You dont have sstream or strstream headers!"
67#endif // HAVE_STRSTREAM
68 56
69using namespace std; 57using namespace std;
70 58
@@ -173,7 +161,7 @@ bool handleStartupItem(const string &line, int offset) {
173 if (pos > 0) { 161 if (pos > 0) {
174 option = str.substr(0, pos); 162 option = str.substr(0, pos);
175 if (option == "screen") { 163 if (option == "screen") {
176 FB_istringstream iss(str.c_str() + pos + 1); 164 FbTk_istringstream iss(str.c_str() + pos + 1);
177 iss >> screen; 165 iss >> screen;
178 } else { 166 } else {
179 error = true; 167 error = true;
@@ -333,7 +321,7 @@ int Remember::parseApp(ifstream &file, Application &app, string *first_line) {
333 continue; //read next line 321 continue; //read next line
334 if (str_key == "Workspace") { 322 if (str_key == "Workspace") {
335 unsigned int w; 323 unsigned int w;
336 FB_istringstream iss(str_label.c_str()); 324 FbTk_istringstream iss(str_label.c_str());
337 iss >> w; 325 iss >> w;
338 app.rememberWorkspace(w); 326 app.rememberWorkspace(w);
339 } else if (str_key == "Head") { 327 } else if (str_key == "Head") {
@@ -356,17 +344,17 @@ int Remember::parseApp(ifstream &file, Application &app, string *first_line) {
356 } else if (str_label == "MENU") { 344 } else if (str_label == "MENU") {
357 l = Fluxbox::instance()->getMenuLayer(); 345 l = Fluxbox::instance()->getMenuLayer();
358 } else { 346 } else {
359 FB_istringstream iss(str_label.c_str()); 347 FbTk_istringstream iss(str_label.c_str());
360 iss >> l; 348 iss >> l;
361 } 349 }
362 app.rememberLayer(l); 350 app.rememberLayer(l);
363 } else if (str_key == "Dimensions") { 351 } else if (str_key == "Dimensions") {
364 unsigned int h,w; 352 unsigned int h,w;
365 FB_istringstream iss(str_label.c_str()); 353 FbTk_istringstream iss(str_label.c_str());
366 iss >> w >> h; 354 iss >> w >> h;
367 app.rememberDimensions(w,h); 355 app.rememberDimensions(w,h);
368 } else if (str_key == "Position") { 356 } else if (str_key == "Position") {
369 FB_istringstream iss; 357 FbTk_istringstream iss;
370 unsigned int r= 0; 358 unsigned int r= 0;
371 unsigned int x= 0; 359 unsigned int x= 0;
372 unsigned int y= 0; 360 unsigned int y= 0;
@@ -426,7 +414,7 @@ int Remember::parseApp(ifstream &file, Application &app, string *first_line) {
426 unsigned int mask; 414 unsigned int mask;
427 const char * str = str_label.c_str(); 415 const char * str = str_label.c_str();
428 // it'll have at least one char and \0, so this is safe 416 // it'll have at least one char and \0, so this is safe
429 FB_istringstream iss(str); 417 FbTk_istringstream iss(str);
430 // check for hex 418 // check for hex
431 if (str[0] == '0' && str[1] == 'x') { 419 if (str[0] == '0' && str[1] == 'x') {
432 iss.seekg(2); 420 iss.seekg(2);