1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-26 04:01:53 +02:00

Minimize namespace pollution by SurfaceCollection class.

This commit is contained in:
Maarten ter Huurne 2010-07-28 03:08:26 +02:00
parent d082f7f280
commit c84fea65a2
3 changed files with 23 additions and 17 deletions

View File

@ -32,6 +32,8 @@
#include "utilities.h"
#include "touchscreen.h"
#include "inputmanager.h"
#include "asfont.h"
#include "surface.h"
const int MAX_VOLUME_SCALE_FACTOR = 200;
// Default values - going to add settings adjustment, saving, loading and such

View File

@ -19,8 +19,12 @@
***************************************************************************/
#include "surfacecollection.h"
#include "surface.h"
#include "utilities.h"
using namespace std;
using std::cout;
using std::endl;
using std::string;
SurfaceCollection::SurfaceCollection(bool defaultAlpha, const string &skin) {
surfaces.set_empty_key(" ");

View File

@ -21,12 +21,11 @@
#define SURFACECOLLECTION_H
#include <google/dense_hash_map>
#include <string>
#include "surface.h"
#include "utilities.h"
class Surface;
using google::dense_hash_map;
typedef dense_hash_map<string, Surface *> SurfaceHash;
typedef google::dense_hash_map<std::string, Surface *> SurfaceHash;
/**
Hash Map of surfaces that loads surfaces not already loaded and reuses already loaded ones.
@ -36,28 +35,29 @@ Hash Map of surfaces that loads surfaces not already loaded and reuses already l
class SurfaceCollection {
private:
SurfaceHash surfaces;
string skin;
std::string skin;
public:
SurfaceCollection(bool defaultAlpha=true, const string &skin="default");
SurfaceCollection(
bool defaultAlpha = true, const std::string &skin = "default");
~SurfaceCollection();
void setSkin(const string &skin);
string getSkinFilePath(const string &file);
void setSkin(const std::string &skin);
std::string getSkinFilePath(const std::string &file);
bool defaultAlpha;
void debug();
Surface *add(Surface *s, const string &path);
Surface *add(const string &path, bool alpha=true);
Surface *addSkinRes(const string &path, bool alpha=true);
void del(const string &path);
Surface *add(Surface *s, const std::string &path);
Surface *add(const std::string &path, bool alpha=true);
Surface *addSkinRes(const std::string &path, bool alpha=true);
void del(const std::string &path);
void clear();
void move(const string &from, const string &to);
bool exists(const string &path);
void move(const std::string &from, const std::string &to);
bool exists(const std::string &path);
Surface *operator[](const string &);
Surface *skinRes(const string &);
Surface *operator[](const std::string &);
Surface *skinRes(const std::string &);
};
#endif