diff --git a/src/browsedialog.cpp b/src/browsedialog.cpp index d25e24e..240ad0d 100644 --- a/src/browsedialog.cpp +++ b/src/browsedialog.cpp @@ -7,6 +7,7 @@ #include using namespace fastdelegate; +using std::string; BrowseDialog::BrowseDialog(GMenu2X *gmenu2x, const string &title, const string &subtitle) diff --git a/src/button.h b/src/button.h index fc8e918..fb8ac12 100644 --- a/src/button.h +++ b/src/button.h @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2006 by Massimiliano Torromeo * - * massimiliano.torromeo@gmail.com * + * Copyright (C) 2006 by Massimiliano Torromeo * + * massimiliano.torromeo@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -18,17 +18,14 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef BUTTON_H_ -#define BUTTON_H_ +#ifndef BUTTON_H +#define BUTTON_H -#include -#include #include "FastDelegate.h" -using std::string; -using fastdelegate::FastDelegate0; +#include -typedef FastDelegate0<> ButtonAction; +typedef fastdelegate::FastDelegate0<> ButtonAction; class Touchscreen; class Button { @@ -61,4 +58,4 @@ public: void setAction(ButtonAction action); }; -#endif /*BUTTON_H_*/ +#endif // BUTTON_H diff --git a/src/filedialog.h b/src/filedialog.h index bd87207..0f5704a 100644 --- a/src/filedialog.h +++ b/src/filedialog.h @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2006 by Massimiliano Torromeo * - * massimiliano.torromeo@gmail.com * + * Copyright (C) 2006 by Massimiliano Torromeo * + * massimiliano.torromeo@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -18,20 +18,20 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef FILEDIALOG_H_ -#define FILEDIALOG_H_ - -#include +#ifndef FILEDIALOG_H +#define FILEDIALOG_H #include "browsedialog.h" +#include class FileDialog : public BrowseDialog { public: - FileDialog(GMenu2X *gmenu2x, const string &text, const string &filter="", - const string &file="", const string &title = "File Dialog"); + FileDialog(GMenu2X *gmenu2x, const std::string &text, + const std::string &filter="", const std::string &file="", + const std::string &title = "File Dialog"); virtual ~FileDialog(); bool exec(); }; -#endif /*INPUTDIALOG_H_*/ +#endif // FILEDIALOG_H diff --git a/src/filelister.cpp b/src/filelister.cpp index cc3b3b4..b33186c 100644 --- a/src/filelister.cpp +++ b/src/filelister.cpp @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2006 by Massimiliano Torromeo * - * massimiliano.torromeo@gmail.com * + * Copyright (C) 2006 by Massimiliano Torromeo * + * massimiliano.torromeo@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -18,6 +18,11 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#include "filelister.h" + +#include "debug.h" +#include "utilities.h" + //for browsing the filesystem #include #include @@ -27,10 +32,6 @@ #include #include -#include "filelister.h" -#include "utilities.h" -#include "debug.h" - using namespace std; FileLister::FileLister(const string &startPath, bool showDirectories, diff --git a/src/filelister.h b/src/filelister.h index 0c971eb..2497d29 100644 --- a/src/filelister.h +++ b/src/filelister.h @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2006 by Massimiliano Torromeo * - * massimiliano.torromeo@gmail.com * + * Copyright (C) 2006 by Massimiliano Torromeo * + * massimiliano.torromeo@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -18,43 +18,40 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef FILELISTER_H_ -#define FILELISTER_H_ +#ifndef FILELISTER_H +#define FILELISTER_H #include #include -using std::string; -using std::vector; - class FileLister { private: - string path, filter; + std::string path, filter; bool showDirectories, showFiles; - vector directories, files, excludes; + std::vector directories, files, excludes; public: - FileLister(const string &startPath = "/boot/local", bool showDirectories = true, bool showFiles = true); + FileLister(const std::string &startPath = "/boot/local", bool showDirectories = true, bool showFiles = true); void browse(bool clean = true); unsigned int size(); unsigned int dirCount(); unsigned int fileCount(); - string operator[](unsigned int); - string at(unsigned int); + std::string operator[](unsigned int); + std::string at(unsigned int); bool isFile(unsigned int); bool isDirectory(unsigned int); - const string &getPath(); - void setPath(const string &path, bool doBrowse=true); - const string &getFilter(); - void setFilter(const string &filter); + const std::string &getPath(); + void setPath(const std::string &path, bool doBrowse=true); + const std::string &getFilter(); + void setFilter(const std::string &filter); - const vector &getDirectories() { return directories; } - const vector &getFiles() { return files; } - void insertFile(const string &file); - void addExclude(const string &exclude); + const std::vector &getDirectories() { return directories; } + const std::vector &getFiles() { return files; } + void insertFile(const std::string &file); + void addExclude(const std::string &exclude); }; -#endif /*FILELISTER_H_*/ +#endif // FILELISTER_H diff --git a/src/gmenu2x.cpp b/src/gmenu2x.cpp index 85195f5..4e4401c 100644 --- a/src/gmenu2x.cpp +++ b/src/gmenu2x.cpp @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2006 by Massimiliano Torromeo * - * massimiliano.torromeo@gmail.com * + * Copyright (C) 2006 by Massimiliano Torromeo * + * massimiliano.torromeo@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -86,6 +86,9 @@ //#include #endif +using namespace std; +using namespace fastdelegate; + #ifdef _CARD_ROOT const char *CARD_ROOT = _CARD_ROOT; #elif defined(PLATFORM_DINGUX) @@ -98,9 +101,6 @@ const int CARD_ROOT_LEN = strlen(CARD_ROOT)-1; static GMenu2X *app; static string gmenu2x_home; -using namespace std; -using namespace fastdelegate; - // Note: Keep this in sync with the enum! static const char *colorNames[NUM_COLORS] = { "topBarBg", diff --git a/src/gmenu2x.h b/src/gmenu2x.h index d06110c..16ef2e5 100644 --- a/src/gmenu2x.h +++ b/src/gmenu2x.h @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2006 by Massimiliano Torromeo * - * massimiliano.torromeo@gmail.com * + * Copyright (C) 2006 by Massimiliano Torromeo * + * massimiliano.torromeo@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -73,13 +73,9 @@ enum color { NUM_COLORS, }; -using std::string; -using std::vector; -using fastdelegate::FastDelegate0; - -typedef FastDelegate0<> MenuAction; -typedef unordered_map > ConfStrHash; -typedef unordered_map > ConfIntHash; +typedef fastdelegate::FastDelegate0<> MenuAction; +typedef std::tr1::unordered_map > ConfStrHash; +typedef std::tr1::unordered_map > ConfIntHash; typedef struct { unsigned short batt; @@ -87,7 +83,7 @@ typedef struct { } MMSP2ADC; struct MenuOption { - string text; + std::string text; MenuAction action; }; @@ -95,12 +91,12 @@ class Menu; class GMenu2X { private: - string path; //!< Contains the working directory of GMenu2X + std::string path; //!< Contains the working directory of GMenu2X /*! Retrieves the free disk space on the sd @return String containing a human readable representation of the free disk space */ - string getDiskFree(const char *path); + std::string getDiskFree(const char *path); unsigned short cpuX; //!< Offset for displaying cpu clock information unsigned short volumeX; //!< Offset for displaying volume level unsigned short manualX; //!< Offset for displaying the manual indicator in the taskbar @@ -116,7 +112,7 @@ private: */ unsigned short getBatteryLevel(); FILE* batteryHandle, *backlightHandle, *usbHandle, *acHandle; - void browsePath(const string &path, vector* directories, vector* files); + void browsePath(const std::string &path, std::vector* directories, std::vector* files); /*! Starts the scanning of the nand and sd filesystems, searching for dge and gpu files and creating the links in 2 dedicated sections. */ @@ -125,7 +121,7 @@ private: Performs the actual scan in the given path and populates the files vector with the results. The creation of the links is not performed here. @see scanner */ - void scanPath(string path, vector *files); + void scanPath(std::string path, std::vector *files); /*! Displays a selector and launches the specified executable file @@ -137,10 +133,10 @@ private: samba, web; - string ip, defaultgw, lastSelectorDir; + std::string ip, defaultgw, lastSelectorDir; int lastSelectorElement; void readConfig(); - void readConfig(string path); + void readConfig(std::string path); void readTmp(); void initServices(); @@ -174,7 +170,7 @@ public: /* Returns the home directory of gmenu2x, usually * ~/.gmenu2x */ - static const string getHome(void); + static const std::string getHome(void); /* * Variables needed for elements disposition @@ -188,7 +184,7 @@ public: @see path @return String containing the parent directory */ - const string &getExePath(); + const std::string &getExePath(); InputManager input; Touchscreen ts; @@ -200,17 +196,17 @@ public: //Configuration settings bool useSelectionPng; - void setSkin(const string &skin, bool setWallpaper = true); + void setSkin(const std::string &skin, bool setWallpaper = true); #ifdef PLATFORM_GP2X //firmware type and version - string fwType, fwVersion; + std::string fwType, fwVersion; bool isF200() { return ts.initialized(); } // Open2x settings --------------------------------------------------------- bool o2x_usb_net_on_boot, o2x_ftp_on_boot, o2x_telnet_on_boot, o2x_gp2xjoy_on_boot, o2x_usb_host_on_boot, o2x_usb_hid_on_boot, o2x_usb_storage_on_boot; - string o2x_usb_net_ip; + std::string o2x_usb_net_ip; int volumeMode, savedVolumeMode; // just use the const int scale values at top of source #endif @@ -262,7 +258,7 @@ public: void writeConfigOpen2x(); #endif void writeSkinConfig(); - void writeTmp(int selelem=-1, const string &selectordir=""); + void writeTmp(int selelem=-1, const std::string &selectordir=""); void ledOn(); void ledOff(); @@ -276,14 +272,14 @@ public: void initBG(); int drawButton(Button *btn, int x=5, int y=-10); - int drawButton(Surface *s, const string &btn, const string &text, int x=5, int y=-10); - int drawButtonRight(Surface *s, const string &btn, const string &text, int x=5, int y=-10); + int drawButton(Surface *s, const std::string &btn, const std::string &text, int x=5, int y=-10); + int drawButtonRight(Surface *s, const std::string &btn, const std::string &text, int x=5, int y=-10); void drawScrollBar(uint pagesize, uint totalsize, uint pagepos, uint top, uint height); void drawTopBar(Surface *s=NULL); void drawBottomBar(Surface *s=NULL); - Menu* menu; + Menu *menu; }; -#endif +#endif // GMENU2X_H diff --git a/src/imagedialog.h b/src/imagedialog.h index ce900ec..735dc03 100644 --- a/src/imagedialog.h +++ b/src/imagedialog.h @@ -31,7 +31,7 @@ protected: SurfaceCollection previews; public: ImageDialog(GMenu2X *gmenu2x, const std::string &text, - const std::string &filter="", const string &file=""); + const std::string &filter="", const std::string &file=""); virtual ~ImageDialog(); virtual void beforeFileList(); diff --git a/src/link.h b/src/link.h index e849b32..a40f208 100644 --- a/src/link.h +++ b/src/link.h @@ -24,12 +24,9 @@ #include "button.h" #include -#include class Surface; -using std::string; - class GMenu2X; /** @@ -44,7 +41,7 @@ private: protected: GMenu2X *gmenu2x; bool edited; - string title, description, icon, iconPath; + std::string title, description, icon, iconPath; Surface *iconSurface; Surface *icon_hover; @@ -62,15 +59,15 @@ public: void setSize(int w, int h); void setPosition(int x, int y); - const string &getTitle(); - void setTitle(const string &title); - const string &getDescription(); - void setDescription(const string &description); - const string &getIcon(); - void setIcon(const string &icon); - virtual const string &searchIcon(); - const string &getIconPath(); - void setIconPath(const string &icon); + const std::string &getTitle(); + void setTitle(const std::string &title); + const std::string &getDescription(); + void setDescription(const std::string &description); + const std::string &getIcon(); + void setIcon(const std::string &icon); + virtual const std::string &searchIcon(); + const std::string &getIconPath(); + void setIconPath(const std::string &icon); virtual void run(); }; diff --git a/src/linkaction.cpp b/src/linkaction.cpp index af8cc3f..efbc5c0 100644 --- a/src/linkaction.cpp +++ b/src/linkaction.cpp @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2006 by Massimiliano Torromeo * - * massimiliano.torromeo@gmail.com * + * Copyright (C) 2006 by Massimiliano Torromeo * + * massimiliano.torromeo@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -17,11 +17,8 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include -#include -#include "linkaction.h" -using namespace std; +#include "linkaction.h" LinkAction::LinkAction(GMenu2X *gmenu2x, LinkRunAction act) : Link(gmenu2x) { diff --git a/src/linkaction.h b/src/linkaction.h index 6c39fc2..4c8d590 100644 --- a/src/linkaction.h +++ b/src/linkaction.h @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2006 by Massimiliano Torromeo * - * massimiliano.torromeo@gmail.com * + * Copyright (C) 2006 by Massimiliano Torromeo * + * massimiliano.torromeo@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -17,19 +17,14 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ + #ifndef LINKACTION_H #define LINKACTION_H -#include -#include - #include "FastDelegate.h" #include "link.h" -using std::string; -using fastdelegate::FastDelegate0; - -typedef FastDelegate0<> LinkRunAction; +typedef fastdelegate::FastDelegate0<> LinkRunAction; class GMenu2X; @@ -47,4 +42,4 @@ public: virtual void run(); }; -#endif +#endif // LINKACTION_H diff --git a/src/linkapp.h b/src/linkapp.h index 780b17c..ae52f3c 100644 --- a/src/linkapp.h +++ b/src/linkapp.h @@ -24,9 +24,6 @@ #include "link.h" #include -#include - -using std::string; class GMenu2X; class InputManager; @@ -39,69 +36,70 @@ Parses links files. class LinkApp : public Link { private: InputManager &inputMgr; - string sclock, svolume; + std::string sclock, svolume; int iclock, ivolume; //G - string sgamma; + std::string sgamma; //G int igamma; - string exec, params, workdir, manual, selectordir, selectorfilter, selectorscreens; + std::string exec, params, workdir, manual, selectordir, selectorfilter, selectorscreens; bool selectorbrowser, useRamTimings; void drawRun(); - string aliasfile; - string file; + std::string aliasfile; + std::string file; bool wrapper; bool dontleave; public: LinkApp(GMenu2X *gmenu2x, InputManager &inputMgr, const char* linkfile); - virtual const string &searchIcon(); + virtual const std::string &searchIcon(); - const string &getExec(); - void setExec(const string &exec); - const string &getParams(); - void setParams(const string ¶ms); - const string &getWorkdir(); - void setWorkdir(const string &workdir); - const string &getManual(); - void setManual(const string &manual); - const string &getSelectorDir(); - void setSelectorDir(const string &selectordir); + const std::string &getExec(); + void setExec(const std::string &exec); + const std::string &getParams(); + void setParams(const std::string ¶ms); + const std::string &getWorkdir(); + void setWorkdir(const std::string &workdir); + const std::string &getManual(); + void setManual(const std::string &manual); + const std::string &getSelectorDir(); + void setSelectorDir(const std::string &selectordir); bool getSelectorBrowser(); void setSelectorBrowser(bool value); bool getUseRamTimings(); void setUseRamTimings(bool value); - const string &getSelectorScreens(); - void setSelectorScreens(const string &selectorscreens); - const string &getSelectorFilter(); - void setSelectorFilter(const string &selectorfilter); - const string &getAliasFile(); - void setAliasFile(const string &aliasfile); + const std::string &getSelectorScreens(); + void setSelectorScreens(const std::string &selectorscreens); + const std::string &getSelectorFilter(); + void setSelectorFilter(const std::string &selectorfilter); + const std::string &getAliasFile(); + void setAliasFile(const std::string &aliasfile); int clock(); - const string &clockStr(int maxClock); + const std::string &clockStr(int maxClock); void setClock(int mhz); int volume(); - const string &volumeStr(); + const std::string &volumeStr(); void setVolume(int vol); //G int gamma(); - const string &gammaStr(); + const std::string &gammaStr(); void setGamma(int gamma); bool save(); void run(); void showManual(); - void selector(int startSelection=0, const string &selectorDir=""); - void launch(const string &selectedFile="", const string &selectedDir=""); + void selector(int startSelection=0, const std::string &selectorDir=""); + void launch(const std::string &selectedFile="", + const std::string &selectedDir=""); bool targetExists(); - const string &getFile() { return file; } - void renameFile(const string &name); + const std::string &getFile() { return file; } + void renameFile(const std::string &name); bool &needsWrapperRef() { return wrapper; } bool &runsInBackgroundRef() { return dontleave; } }; diff --git a/src/menu.cpp b/src/menu.cpp index 126b32f..582a719 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2006 by Massimiliano Torromeo * - * massimiliano.torromeo@gmail.com * + * Copyright (C) 2006 by Massimiliano Torromeo * + * massimiliano.torromeo@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -74,7 +74,7 @@ void Menu::readSections(std::string parentDir) if (statret != -1) { if (find(sections.begin(), sections.end(), (string)dptr->d_name) == sections.end()) { sections.push_back((string)dptr->d_name); - linklist ll; + vector ll; links.push_back(ll); } } @@ -114,12 +114,12 @@ void Menu::loadIcons() { SECTION MANAGEMENT ====================================*/ void Menu::freeLinks() { - for (vector::iterator section = links.begin(); sectionbegin(); linkend(); link++) + for (vector< vector >::iterator section = links.begin(); section::iterator link = section->begin(); linkend(); link++) delete *link; } -linklist *Menu::sectionLinks(int i) { +vector *Menu::sectionLinks(int i) { if (i<0 || i>(int)links.size()) i = selSectionIndex(); @@ -305,7 +305,7 @@ bool Menu::addSection(const string §ionName) { sectiondir = sectiondir + "/" + sectionName; if (mkdir(sectiondir.c_str(), 0755) == 0) { sections.push_back(sectionName); - linklist ll; + vector ll; links.push_back(ll); return true; } @@ -324,9 +324,9 @@ void Menu::deleteSelectedLink() sectionLinks()->erase( sectionLinks()->begin() + selLinkIndex() ); setLinkIndex(selLinkIndex()); - for (vector::iterator section = links.begin(); + for (vector< vector >::iterator section = links.begin(); !icon_used && sectionbegin(); + for (vector::iterator link = section->begin(); !icon_used && linkend(); link++) icon_used = !iconpath.compare((*link)->getIconPath()); diff --git a/src/menu.h b/src/menu.h index e41997b..4c1f3a0 100644 --- a/src/menu.h +++ b/src/menu.h @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2006 by Massimiliano Torromeo * - * massimiliano.torromeo@gmail.com * + * Copyright (C) 2006 by Massimiliano Torromeo * + * massimiliano.torromeo@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -17,21 +17,18 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ + #ifndef MENU_H #define MENU_H -#include -#include #include "linkaction.h" -using std::string; -using std::vector; +#include +#include class LinkApp; class GMenu2X; -typedef vector linklist; - /** Handles the menu structure @@ -42,8 +39,8 @@ private: GMenu2X *gmenu2x; int iSection, iLink; uint iFirstDispSection, iFirstDispRow; - vector sections; - vector links; + std::vector sections; + std::vector< std::vector > links; void readLinks(); void freeLinks(); @@ -58,19 +55,21 @@ public: Menu(GMenu2X *gmenu2x); ~Menu(); - linklist *sectionLinks(int i = -1); + std::vector *sectionLinks(int i = -1); int selSectionIndex(); - const string &selSection(); + const std::string &selSection(); void decSectionIndex(); void incSectionIndex(); void setSectionIndex(int i); uint firstDispSection(); uint firstDispRow(); - bool addActionLink(uint section, const string &title, LinkRunAction action, const string &description="", const string &icon=""); - bool addLink(string path, string file, string section=""); - bool addSection(const string §ionName); + bool addActionLink(uint section, const std::string &title, + LinkRunAction action, const std::string &description="", + const std::string &icon=""); + bool addLink(std::string path, std::string file, std::string section=""); + bool addSection(const std::string §ionName); void deleteSelectedLink(); void deleteSelectedSection(); @@ -86,8 +85,8 @@ public: void linkDown(); void setLinkIndex(int i); - const vector &getSections() { return sections; } - void renameSection(int index, const string &name); + const std::vector &getSections() { return sections; } + void renameSection(int index, const std::string &name); }; -#endif +#endif // MENU_H diff --git a/src/menusetting.cpp b/src/menusetting.cpp index 98f2fa5..2328080 100644 --- a/src/menusetting.cpp +++ b/src/menusetting.cpp @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2006 by Massimiliano Torromeo * - * massimiliano.torromeo@gmail.com * + * Copyright (C) 2006 by Massimiliano Torromeo * + * massimiliano.torromeo@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -17,10 +17,14 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ + #include "menusetting.h" + #include "asfont.h" #include "gmenu2x.h" +using std::string; + MenuSetting::MenuSetting(GMenu2X *gmenu2x, const string &name, const string &description) : gmenu2x(gmenu2x) diff --git a/src/selector.cpp b/src/selector.cpp index 92e1d33..5c0a82b 100644 --- a/src/selector.cpp +++ b/src/selector.cpp @@ -35,6 +35,7 @@ #include "debug.h" using namespace std; +using std::tr1::unordered_map; #define SELECTOR_ELEMENTS 11 diff --git a/src/selector.h b/src/selector.h index 14cba96..b34e8b9 100644 --- a/src/selector.h +++ b/src/selector.h @@ -29,9 +29,6 @@ class LinkApp; class FileLister; -using std::string; -using std::vector; - class Selector : protected Dialog { private: int selRow; @@ -40,7 +37,7 @@ private: std::tr1::unordered_map aliases; void loadAliases(); - string getAlias(const std::string &key); + std::string getAlias(const std::string &key); void prepare(FileLister *fl, std::vector *screens, std::vector *titles); void freeScreenshots(std::vector *screens); diff --git a/src/surface.cpp b/src/surface.cpp index 9de8010..3b45c43 100644 --- a/src/surface.cpp +++ b/src/surface.cpp @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2006 by Massimiliano Torromeo * - * massimiliano.torromeo@gmail.com * + * Copyright (C) 2006 by Massimiliano Torromeo * + * massimiliano.torromeo@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -19,14 +19,16 @@ ***************************************************************************/ #include "surface.h" -#include "imageio.h" -#include "utilities.h" + #include "debug.h" +#include "imageio.h" #include "surfacecollection.h" +#include "utilities.h" #include #include + using namespace std; RGBAColor strtorgba(const string &strColor) { diff --git a/src/surface.h b/src/surface.h index 7f0070a..c15a3a6 100644 --- a/src/surface.h +++ b/src/surface.h @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2006 by Massimiliano Torromeo * - * massimiliano.torromeo@gmail.com * + * Copyright (C) 2006 by Massimiliano Torromeo * + * massimiliano.torromeo@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -17,21 +17,20 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ + #ifndef SURFACE_H #define SURFACE_H -#include -#include - #include "asfont.h" -using std::string; +#include +#include struct RGBAColor { unsigned short r,g,b,a; }; -RGBAColor strtorgba(const string &strColor); +RGBAColor strtorgba(const std::string &strColor); /** Wrapper around SDL_Surface @@ -41,7 +40,8 @@ class Surface { public: static Surface *openOutputSurface(int width, int height, int bitsperpixel); static Surface *emptySurface(int width, int height); - static Surface *loadImage(const string &img, const string &skin=""); + static Surface *loadImage(const std::string &img, + const std::string &skin=""); Surface(Surface *s); ~Surface(); @@ -66,7 +66,9 @@ public: bool blitCenter(Surface *destination, int x, int y, int w=0, int h=0, int a=-1); bool blitRight(Surface *destination, int x, int y, int w=0, int h=0, int a=-1); - void write(ASFont *font, const string &text, int x, int y, ASFont::HAlign halign = ASFont::HAlignLeft, ASFont::VAlign valign = ASFont::VAlignTop) { + void write(ASFont *font, const std::string &text, int x, int y, + ASFont::HAlign halign = ASFont::HAlignLeft, + ASFont::VAlign valign = ASFont::VAlignTop) { font->write(this, text, x, y, halign, valign); } diff --git a/src/translator.cpp b/src/translator.cpp index 56f3c5c..1883dc2 100644 --- a/src/translator.cpp +++ b/src/translator.cpp @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2006 by Massimiliano Torromeo * - * massimiliano.torromeo@gmail.com * + * Copyright (C) 2006 by Massimiliano Torromeo * + * massimiliano.torromeo@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -18,16 +18,18 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#include "translator.h" + +#include "debug.h" +#include "gmenu2x.h" + #include #include #include #include -#include "translator.h" -#include "debug.h" -#include "gmenu2x.h" - using namespace std; +using std::tr1::unordered_map; Translator::Translator(const string &lang) { _lang = ""; diff --git a/src/translator.h b/src/translator.h index 6d68660..278e341 100644 --- a/src/translator.h +++ b/src/translator.h @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2006 by Massimiliano Torromeo * - * massimiliano.torromeo@gmail.com * + * Copyright (C) 2006 by Massimiliano Torromeo * + * massimiliano.torromeo@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -17,10 +17,12 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ + #ifndef TRANSLATOR_H #define TRANSLATOR_H -#include "utilities.h" +#include +#include /** Hash Map of translation strings. @@ -29,18 +31,19 @@ Hash Map of translation strings. */ class Translator { private: - string _lang; - unordered_map translations; + std::string _lang; + std::tr1::unordered_map translations; public: - Translator(const string &lang=""); + Translator(const std::string &lang=""); ~Translator(); - string lang(); - void setLang(const string &lang); - bool exists(const string &term); - string translate(const string &term,const char *replacestr=NULL,...); - string operator[](const string &term); + std::string lang(); + void setLang(const std::string &lang); + bool exists(const std::string &term); + std::string translate(const std::string &term, + const char *replacestr = NULL, ...); + std::string operator[](const std::string &term); }; -#endif +#endif // TRANSLATOR_H diff --git a/src/utilities.h b/src/utilities.h index 188ad1e..742fdac 100644 --- a/src/utilities.h +++ b/src/utilities.h @@ -23,39 +23,35 @@ #include #include -#include - -using std::tr1::unordered_map; -using std::tr1::hash; -using std::string; -using std::vector; class case_less { public: - bool operator()(const string &left, const string &right) const; + bool operator()(const std::string &left, const std::string &right) const; }; -string trim(const string& s); -string strreplace (string orig, const string &search, const string &replace); -string cmdclean (string cmdline); +std::string trim(const std::string& s); +std::string strreplace (std::string orig, const std::string &search, const std::string &replace); +std::string cmdclean (std::string cmdline); -char *string_copy(const string &); -void string_copy(const string &, char **); +char *string_copy(const std::string &); +void string_copy(const std::string &, char **); -bool fileExists(const string &file); -bool rmtree(string path); +bool fileExists(const std::string &file); +bool rmtree(std::string path); -int max (int a, int b); -int min (int a, int b); -int constrain (int x, int imin, int imax); +int max(int a, int b); +int min(int a, int b); +int constrain(int x, int imin, int imax); -int evalIntConf (int val, int def, int imin, int imax); -int evalIntConf (int *val, int def, int imin, int imax); -const string &evalStrConf (const string &val, const string &def); -const string &evalStrConf (string *val, const string &def); +int evalIntConf(int val, int def, int imin, int imax); +int evalIntConf(int *val, int def, int imin, int imax); +const std::string &evalStrConf(const std::string &val, const std::string &def); +const std::string &evalStrConf(std::string *val, const std::string &def); -bool split (vector &vec, const string &str, const string &delim, bool destructive=true); +bool split(std::vector &vec, const std::string &str, + const std::string &delim, bool destructive=true); -int intTransition(int from, int to, long int tickStart, long duration=500, long tickNow=-1); +int intTransition(int from, int to, long int tickStart, long duration=500, + long tickNow=-1); -#endif +#endif // UTILITIES_H