using stringstream header in FbTk

This commit is contained in:
fluxgen 2005-02-13 16:36:54 +00:00
parent b8a39c1e6c
commit bac15c745e
2 changed files with 16 additions and 40 deletions

View file

@ -34,22 +34,10 @@
#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 @@ 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<FbTk::Command> rfbcmd(fbcmd);
macro->add(rfbcmd);
}

View file

@ -36,6 +36,7 @@
#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 <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 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);