From bac15c745e259b69dafd901d48c16c63c3f91ee1 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Sun, 13 Feb 2005 16:36:54 +0000 Subject: using stringstream header in FbTk --- src/FbCommandFactory.cc | 30 +++++++++--------------------- src/Remember.cc | 26 +++++++------------------- 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 @@ #include "FbTk/StringUtil.hh" #include "FbTk/MacroCommand.hh" +#include "FbTk/stringstream.hh" #include -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif // HAVE_CONFIG_H - -#ifdef HAVE_SSTREAM -#include -#define FB_istringstream istringstream -#elif HAVE_STRSTREAM -#include -#define FB_istringstream istrstream -#else -#error "You dont have sstream or strstream headers!" -#endif // HAVE_STRSTREAM using namespace std; @@ -151,11 +139,11 @@ FbCommandFactory::FbCommandFactory() { "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 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command, 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 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command, 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 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command, // else if (command == "deiconify") { - FB_istringstream iss(arguments); + FbTk_istringstream iss(arguments); string mode; string d; DeiconifyCmd::Destination dest; @@ -419,7 +407,7 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command, c= FbTk::StringUtil::toLower(cmd); FbTk::Command* fbcmd= stringToCommand(c,a); - if ( fbcmd ) { + if (fbcmd) { FbTk::RefCount rfbcmd(fbcmd); macro->add(rfbcmd); } 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 @@ #include "FbTk/StringUtil.hh" #include "FbTk/MenuItem.hh" #include "FbTk/App.hh" +#include "FbTk/stringstream.hh" #include @@ -52,19 +53,6 @@ #include #include -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif // HAVE_CONFIG_H - -#ifdef HAVE_SSTREAM -#include -#define FB_istringstream istringstream -#elif HAVE_STRSTREAM -#include -#define FB_istringstream istrstream -#else -#error "You dont have sstream or strstream headers!" -#endif // HAVE_STRSTREAM using namespace std; @@ -173,7 +161,7 @@ bool handleStartupItem(const string &line, int offset) { 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 @@ int Remember::parseApp(ifstream &file, Application &app, string *first_line) { 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 @@ int Remember::parseApp(ifstream &file, Application &app, string *first_line) { } 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 @@ int Remember::parseApp(ifstream &file, Application &app, string *first_line) { 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); -- cgit v0.11.2