Fix some namespace stuff
This commit is contained in:
parent
71c9ff0507
commit
9fa14bd5ff
2 changed files with 21 additions and 28 deletions
|
@ -20,7 +20,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: Remember.cc,v 1.1 2003/04/26 07:57:00 rathnor Exp $
|
// $Id: Remember.cc,v 1.2 2003/04/26 11:24:55 rathnor Exp $
|
||||||
|
|
||||||
#include "Remember.hh"
|
#include "Remember.hh"
|
||||||
#include "StringUtil.hh"
|
#include "StringUtil.hh"
|
||||||
|
@ -40,12 +40,8 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
/*
|
#include <string>
|
||||||
#include <string>
|
#include <memory>
|
||||||
#include <memory>
|
|
||||||
#include <stdio.h>
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef MAXPATHLEN
|
#ifndef MAXPATHLEN
|
||||||
#define MAXPATHLEN 255
|
#define MAXPATHLEN 255
|
||||||
|
@ -196,8 +192,8 @@ Application* Remember::find(const char* app_name) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Remember::parseApp(ifstream &file, Application *a) {
|
int Remember::parseApp(std::ifstream &file, Application *a) {
|
||||||
string line;
|
std::string line;
|
||||||
int row = 0;
|
int row = 0;
|
||||||
while (! file.eof()) {
|
while (! file.eof()) {
|
||||||
if (getline(file, line)) {
|
if (getline(file, line)) {
|
||||||
|
@ -218,17 +214,17 @@ int Remember::parseApp(ifstream &file, Application *a) {
|
||||||
continue; //read next line
|
continue; //read next line
|
||||||
if (str_key == "Workspace") {
|
if (str_key == "Workspace") {
|
||||||
unsigned int w;
|
unsigned int w;
|
||||||
istringstream iss(str_label.c_str());
|
std::istringstream iss(str_label.c_str());
|
||||||
iss >> w;
|
iss >> w;
|
||||||
a->rememberWorkspace(w);
|
a->rememberWorkspace(w);
|
||||||
} else if (str_key == "Dimensions") {
|
} else if (str_key == "Dimensions") {
|
||||||
unsigned int h,w;
|
unsigned int h,w;
|
||||||
istringstream iss(str_label.c_str());
|
std::istringstream iss(str_label.c_str());
|
||||||
iss >> w >> h;
|
iss >> w >> h;
|
||||||
a->rememberDimensions(w,h);
|
a->rememberDimensions(w,h);
|
||||||
} else if (str_key == "Position") {
|
} else if (str_key == "Position") {
|
||||||
unsigned int x,y;
|
unsigned int x,y;
|
||||||
istringstream iss(str_label);
|
std::istringstream iss(str_label);
|
||||||
iss >> x >> y;
|
iss >> x >> y;
|
||||||
a->rememberPosition(x,y);
|
a->rememberPosition(x,y);
|
||||||
} else if (str_key == "Shaded") {
|
} else if (str_key == "Shaded") {
|
||||||
|
@ -255,7 +251,7 @@ int Remember::parseApp(ifstream &file, Application *a) {
|
||||||
unsigned int mask;
|
unsigned int mask;
|
||||||
const char * str = str_label.c_str();
|
const char * str = str_label.c_str();
|
||||||
// it'll have at least one char and \0, so this is safe
|
// it'll have at least one char and \0, so this is safe
|
||||||
istringstream iss(str);
|
std::istringstream iss(str);
|
||||||
// check for hex
|
// check for hex
|
||||||
if (str[0] == '0' && str[1] == 'x') {
|
if (str[0] == '0' && str[1] == 'x') {
|
||||||
iss.seekg(2);
|
iss.seekg(2);
|
||||||
|
@ -285,23 +281,23 @@ void Remember::load() {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
cerr << "Loading apps file..." << endl;
|
cerr << "Loading apps file..." << endl;
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
string apps_string = getenv("HOME")+string("/.")+RC_PATH+string("/")+"apps";
|
std::string apps_string = getenv("HOME")+std::string("/.")+RC_PATH+std::string("/")+"apps";
|
||||||
ifstream apps_file(apps_string.c_str());
|
std::ifstream apps_file(apps_string.c_str());
|
||||||
if (!apps_file.fail()) {
|
if (!apps_file.fail()) {
|
||||||
if (!apps_file.eof()) {
|
if (!apps_file.eof()) {
|
||||||
string line;
|
std::string line;
|
||||||
int row = 0;
|
int row = 0;
|
||||||
while (getline(apps_file, line) && ! apps_file.eof()) {
|
while (getline(apps_file, line) && ! apps_file.eof()) {
|
||||||
row++;
|
row++;
|
||||||
if (line[0] == '#')
|
if (line[0] == '#')
|
||||||
continue;
|
continue;
|
||||||
string key;
|
std::string key;
|
||||||
int pos=0;
|
int pos=0;
|
||||||
int err = StringUtil::getStringBetween(key, line.c_str(), '[', ']');
|
int err = StringUtil::getStringBetween(key, line.c_str(), '[', ']');
|
||||||
|
|
||||||
if (err >0 && key == "app") {
|
if (err >0 && key == "app") {
|
||||||
pos += err;
|
pos += err;
|
||||||
string label;
|
std::string label;
|
||||||
err = StringUtil::getStringBetween(label, line.c_str()+pos, '(', ')');
|
err = StringUtil::getStringBetween(label, line.c_str()+pos, '(', ')');
|
||||||
if (err>0) {
|
if (err>0) {
|
||||||
Application *a;
|
Application *a;
|
||||||
|
@ -332,8 +328,8 @@ void Remember::save() {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
cerr << "Saving apps file..." << endl;
|
cerr << "Saving apps file..." << endl;
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
string apps_string = getenv("HOME")+string("/.")+RC_PATH+string("/")+"apps";
|
std::string apps_string = getenv("HOME")+std::string("/.")+RC_PATH+std::string("/")+"apps";
|
||||||
ofstream apps_file(apps_string.c_str());
|
std::ofstream apps_file(apps_string.c_str());
|
||||||
Apps::iterator it = apps.begin();
|
Apps::iterator it = apps.begin();
|
||||||
Apps::iterator it_end = apps.end();
|
Apps::iterator it_end = apps.end();
|
||||||
for (; it != it_end; ++it) {
|
for (; it != it_end; ++it) {
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: Remember.hh,v 1.1 2003/04/26 07:57:00 rathnor Exp $
|
// $Id: Remember.hh,v 1.2 2003/04/26 11:24:55 rathnor Exp $
|
||||||
|
|
||||||
/* Based on the original "Remember patch" by Xavier Brouckaert */
|
/* Based on the original "Remember patch" by Xavier Brouckaert */
|
||||||
|
|
||||||
|
@ -30,14 +30,11 @@
|
||||||
#include "Window.hh"
|
#include "Window.hh"
|
||||||
#include "AtomHandler.hh"
|
#include "AtomHandler.hh"
|
||||||
#include "Screen.hh"
|
#include "Screen.hh"
|
||||||
|
|
||||||
/*
|
|
||||||
#include <iostream>
|
|
||||||
#include <string>
|
|
||||||
#include "StringUtil.hh"
|
#include "StringUtil.hh"
|
||||||
*/
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
class Application {
|
class Application {
|
||||||
public:
|
public:
|
||||||
|
@ -123,7 +120,7 @@ public:
|
||||||
REM_LASTATTRIB // not actually used
|
REM_LASTATTRIB // not actually used
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::map<string,Application *> Apps;
|
typedef std::map<std::string,Application *> Apps;
|
||||||
Remember();
|
Remember();
|
||||||
|
|
||||||
Application* find(WinClient &winclient);
|
Application* find(WinClient &winclient);
|
||||||
|
@ -166,7 +163,7 @@ public:
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// returns number of lines read
|
// returns number of lines read
|
||||||
int parseApp(ifstream &file, Application *a);
|
int parseApp(std::ifstream &file, Application *a);
|
||||||
Apps apps;
|
Apps apps;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue