Date:2010-07-28 03:08:26 (13 years 8 months ago)
Author:Maarten ter Huurne
Commit:c84fea65a23f479fcced80a8bff8e5c9cc44564e
Message:Minimize namespace pollution by SurfaceCollection class.

Files: src/gmenu2x.h (1 diff)
src/surfacecollection.cpp (1 diff)
src/surfacecollection.h (2 diffs)

Change Details

src/gmenu2x.h
3232#include "utilities.h"
3333#include "touchscreen.h"
3434#include "inputmanager.h"
35#include "asfont.h"
36#include "surface.h"
3537
3638const int MAX_VOLUME_SCALE_FACTOR = 200;
3739// Default values - going to add settings adjustment, saving, loading and such
src/surfacecollection.cpp
1919 ***************************************************************************/
2020
2121#include "surfacecollection.h"
22#include "surface.h"
23#include "utilities.h"
2224
23using namespace std;
25using std::cout;
26using std::endl;
27using std::string;
2428
2529SurfaceCollection::SurfaceCollection(bool defaultAlpha, const string &skin) {
2630    surfaces.set_empty_key(" ");
src/surfacecollection.h
2121#define SURFACECOLLECTION_H
2222
2323#include <google/dense_hash_map>
24#include <string>
2425
25#include "surface.h"
26#include "utilities.h"
26class Surface;
2727
28using google::dense_hash_map;
29typedef dense_hash_map<string, Surface *> SurfaceHash;
28typedef google::dense_hash_map<std::string, Surface *> SurfaceHash;
3029
3130/**
3231Hash Map of surfaces that loads surfaces not already loaded and reuses already loaded ones.
...... 
3635class SurfaceCollection {
3736private:
3837    SurfaceHash surfaces;
39    string skin;
38    std::string skin;
4039
4140public:
42    SurfaceCollection(bool defaultAlpha=true, const string &skin="default");
41    SurfaceCollection(
42            bool defaultAlpha = true, const std::string &skin = "default");
4343    ~SurfaceCollection();
4444
45    void setSkin(const string &skin);
46    string getSkinFilePath(const string &file);
45    void setSkin(const std::string &skin);
46    std::string getSkinFilePath(const std::string &file);
4747
4848    bool defaultAlpha;
4949    void debug();
5050
51    Surface *add(Surface *s, const string &path);
52    Surface *add(const string &path, bool alpha=true);
53    Surface *addSkinRes(const string &path, bool alpha=true);
54    void del(const string &path);
51    Surface *add(Surface *s, const std::string &path);
52    Surface *add(const std::string &path, bool alpha=true);
53    Surface *addSkinRes(const std::string &path, bool alpha=true);
54    void del(const std::string &path);
5555    void clear();
56    void move(const string &from, const string &to);
57    bool exists(const string &path);
56    void move(const std::string &from, const std::string &to);
57    bool exists(const std::string &path);
5858
59    Surface *operator[](const string &);
60    Surface *skinRes(const string &);
59    Surface *operator[](const std::string &);
60    Surface *skinRes(const std::string &);
6161};
6262
6363#endif

Archive Download the corresponding diff file



interactive