more namespace corrections (doh)

This commit is contained in:
rathnor 2003-04-26 12:01:55 +00:00
parent 9fa14bd5ff
commit 007fb25e82

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: Remember.cc,v 1.2 2003/04/26 11:24:55 rathnor Exp $
// $Id: Remember.cc,v 1.3 2003/04/26 12:01:55 rathnor Exp $
#include "Remember.hh"
#include "StringUtil.hh"
@ -47,6 +47,8 @@
#define MAXPATHLEN 255
#endif // MAXPATHLEN
using namespace std;
namespace {
class RememberMenuItem : public FbTk::MenuItem {
@ -155,7 +157,7 @@ const char * getWMClass(Window w) {
cerr<<"Failed to read class hint!"<<endl;
return 0;
} else {
std::string m_class_name;
string m_class_name;
if (ch.res_name != 0) {
//m_instance_name = const_cast<char *>(ch.res_name);
XFree(ch.res_name);
@ -192,15 +194,15 @@ Application* Remember::find(const char* app_name) {
return NULL;
}
int Remember::parseApp(std::ifstream &file, Application *a) {
std::string line;
int Remember::parseApp(ifstream &file, Application *a) {
string line;
int row = 0;
while (! file.eof()) {
if (getline(file, line)) {
row++;
if (line[0] != '#') { //the line is commented
int parse_pos = 0, err = 0;
std::string str_key, str_label;
string str_key, str_label;
err = StringUtil::getStringBetween(str_key, line.c_str(), '[', ']');
if (err > 0 ) {
parse_pos += err;
@ -214,17 +216,17 @@ int Remember::parseApp(std::ifstream &file, Application *a) {
continue; //read next line
if (str_key == "Workspace") {
unsigned int w;
std::istringstream iss(str_label.c_str());
istringstream iss(str_label.c_str());
iss >> w;
a->rememberWorkspace(w);
} else if (str_key == "Dimensions") {
unsigned int h,w;
std::istringstream iss(str_label.c_str());
istringstream iss(str_label.c_str());
iss >> w >> h;
a->rememberDimensions(w,h);
} else if (str_key == "Position") {
unsigned int x,y;
std::istringstream iss(str_label);
istringstream iss(str_label);
iss >> x >> y;
a->rememberPosition(x,y);
} else if (str_key == "Shaded") {
@ -251,7 +253,7 @@ int Remember::parseApp(std::ifstream &file, Application *a) {
unsigned int mask;
const char * str = str_label.c_str();
// it'll have at least one char and \0, so this is safe
std::istringstream iss(str);
istringstream iss(str);
// check for hex
if (str[0] == '0' && str[1] == 'x') {
iss.seekg(2);
@ -281,23 +283,23 @@ void Remember::load() {
#ifdef DEBUG
cerr << "Loading apps file..." << endl;
#endif // DEBUG
std::string apps_string = getenv("HOME")+std::string("/.")+RC_PATH+std::string("/")+"apps";
std::ifstream apps_file(apps_string.c_str());
string apps_string = getenv("HOME")+string("/.")+RC_PATH+string("/")+"apps";
ifstream apps_file(apps_string.c_str());
if (!apps_file.fail()) {
if (!apps_file.eof()) {
std::string line;
string line;
int row = 0;
while (getline(apps_file, line) && ! apps_file.eof()) {
row++;
if (line[0] == '#')
continue;
std::string key;
string key;
int pos=0;
int err = StringUtil::getStringBetween(key, line.c_str(), '[', ']');
if (err >0 && key == "app") {
pos += err;
std::string label;
string label;
err = StringUtil::getStringBetween(label, line.c_str()+pos, '(', ')');
if (err>0) {
Application *a;
@ -328,8 +330,8 @@ void Remember::save() {
#ifdef DEBUG
cerr << "Saving apps file..." << endl;
#endif // DEBUG
std::string apps_string = getenv("HOME")+std::string("/.")+RC_PATH+std::string("/")+"apps";
std::ofstream apps_file(apps_string.c_str());
string apps_string = getenv("HOME")+string("/.")+RC_PATH+string("/")+"apps";
ofstream apps_file(apps_string.c_str());
Apps::iterator it = apps.begin();
Apps::iterator it_end = apps.end();
for (; it != it_end; ++it) {