using stringstream header in FbTk
fluxgen fluxgen
2 files changed,
16 insertions(+),
40 deletions(-)
M
src/FbCommandFactory.cc
→
src/FbCommandFactory.cc
@@ -34,22 +34,10 @@ #include "Screen.hh"
#include "FbTk/StringUtil.hh" #include "FbTk/MacroCommand.hh" +#include "FbTk/stringstream.hh" #include <string> -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif // HAVE_CONFIG_H - -#ifdef HAVE_SSTREAM -#include <sstream> -#define FB_istringstream istringstream -#elif HAVE_STRSTREAM -#include <strstream> -#define FB_istringstream istrstream -#else -#error "You dont have sstream or strstream headers!" -#endif // HAVE_STRSTREAM using namespace std;@@ -151,11 +139,11 @@ "workspace11",
"workspace12", /* end note */ "workspacemenu", - "" + 0 }; for (int i=0;; ++i) { - if (strcmp(commands[i], "") == 0) + if (commands[i] == 0) break; addCommand(commands[i]); }@@ -229,13 +217,13 @@ return new CurrentWindowCmd(&FluxboxWindow::maximizeVertical);
else if (command == "maximizehorizontal") return new CurrentWindowCmd(&FluxboxWindow::maximizeHorizontal); else if (command == "resize") { - FB_istringstream is(arguments.c_str()); + FbTk_istringstream is(arguments.c_str()); int dx = 0, dy = 0; is >> dx >> dy; return new ResizeCmd(dx, dy); } else if (command == "resizeto") { - FB_istringstream is(arguments.c_str()); + FbTk_istringstream is(arguments.c_str()); int dx = 0, dy = 0; is >> dx >> dy; return new ResizeToCmd(dx, dy);@@ -245,13 +233,13 @@ return new ResizeCmd(atoi(arguments.c_str()),0);
else if (command == "resizevertical") return new ResizeCmd(0,atoi(arguments.c_str())); else if (command == "moveto") { - FB_istringstream is(arguments.c_str()); + FbTk_istringstream is(arguments.c_str()); int dx = 0, dy = 0; is >> dx >> dy; return new MoveToCmd(dx,dy); } else if (command == "move") { - FB_istringstream is(arguments.c_str()); + FbTk_istringstream is(arguments.c_str()); int dx = 0, dy = 0; is >> dx >> dy; return new MoveCmd(dx, dy);@@ -367,7 +355,7 @@ // special commands
// else if (command == "deiconify") { - FB_istringstream iss(arguments); + FbTk_istringstream iss(arguments); string mode; string d; DeiconifyCmd::Destination dest;@@ -419,7 +407,7 @@ }
c= FbTk::StringUtil::toLower(cmd); FbTk::Command* fbcmd= stringToCommand(c,a); - if ( fbcmd ) { + if (fbcmd) { FbTk::RefCount<FbTk::Command> rfbcmd(fbcmd); macro->add(rfbcmd); }
M
src/Remember.cc
→
src/Remember.cc
@@ -36,6 +36,7 @@ #include "FbTk/I18n.hh"
#include "FbTk/StringUtil.hh" #include "FbTk/MenuItem.hh" #include "FbTk/App.hh" +#include "FbTk/stringstream.hh" #include <X11/Xlib.h>@@ -52,19 +53,6 @@ #include <string>
#include <memory> #include <set> -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif // HAVE_CONFIG_H - -#ifdef HAVE_SSTREAM -#include <sstream> -#define FB_istringstream istringstream -#elif HAVE_STRSTREAM -#include <strstream> -#define FB_istringstream istrstream -#else -#error "You dont have sstream or strstream headers!" -#endif // HAVE_STRSTREAM using namespace std;@@ -173,7 +161,7 @@ bool error = false;
if (pos > 0) { option = str.substr(0, pos); if (option == "screen") { - FB_istringstream iss(str.c_str() + pos + 1); + FbTk_istringstream iss(str.c_str() + pos + 1); iss >> screen; } else { error = true;@@ -333,7 +321,7 @@ if (!str_key.size())
continue; //read next line if (str_key == "Workspace") { unsigned int w; - FB_istringstream iss(str_label.c_str()); + FbTk_istringstream iss(str_label.c_str()); iss >> w; app.rememberWorkspace(w); } else if (str_key == "Head") {@@ -356,17 +344,17 @@ l = Fluxbox::instance()->getAboveDockLayer();
} else if (str_label == "MENU") { l = Fluxbox::instance()->getMenuLayer(); } else { - FB_istringstream iss(str_label.c_str()); + FbTk_istringstream iss(str_label.c_str()); iss >> l; } app.rememberLayer(l); } else if (str_key == "Dimensions") { unsigned int h,w; - FB_istringstream iss(str_label.c_str()); + FbTk_istringstream iss(str_label.c_str()); iss >> w >> h; app.rememberDimensions(w,h); } else if (str_key == "Position") { - FB_istringstream iss; + FbTk_istringstream iss; unsigned int r= 0; unsigned int x= 0; unsigned int y= 0;@@ -426,7 +414,7 @@ } else {
unsigned int mask; const char * str = str_label.c_str(); // it'll have at least one char and \0, so this is safe - FB_istringstream iss(str); + FbTk_istringstream iss(str); // check for hex if (str[0] == '0' && str[1] == 'x') { iss.seekg(2);