forked from mrkite/minutor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entityidentifier.h
72 lines (58 loc) · 1.93 KB
/
entityidentifier.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/** Copyright (c) 2014, EtlamGit */
#ifndef ENTITYIDENTIFIER_H_
#define ENTITYIDENTIFIER_H_
#include <QString>
#include <QColor>
#include <QList>
#include <QMap>
class JSONArray;
class JSONObject;
class EntityInfo {
public:
EntityInfo(QString name, QString category, QColor brushColor,
QColor penColor);
QString name;
QString category;
QColor brushColor;
QColor penColor;
};
class EntityIdentifier {
public:
// singleton: access to global usable instance
static EntityIdentifier &Instance();
int addDefinitions(JSONArray *, int packID = -1);
void enableDefinitions(int id);
void disableDefinitions(int id);
// interface to list of main categories
typedef QList<QPair<QString, QColor>> TcatList;
int getNumCategories() const;
TcatList const &getCategoryList() const;
QColor getCategoryColor(const QString name) const;
// interface to single EntityInfo objects
EntityInfo const &getEntityInfo(const QString id) const;
QColor getBrushColor(const QString id) const;
QColor getPenColor(const QString id) const;
private:
// singleton: prevent access to constructor and copyconstructor
EntityIdentifier();
~EntityIdentifier();
EntityIdentifier(const EntityIdentifier &);
EntityIdentifier &operator=(const EntityIdentifier &);
void parseCategoryDefinition(JSONObject *data, int packID);
void parseEntityDefinition(JSONObject *entity, QString const &category,
QColor catcolor, int packID);
TcatList categories; // main categories for entities
bool addCategory(QPair<QString, QColor> cat);
typedef QMap<QString, EntityInfo> TentityMap; // key:id_name value:EntityInfo
TentityMap dummyMap;
class TpackInfo {
public:
int packID;
bool enabled;
TentityMap map;
explicit TpackInfo(int packID) : packID(packID), enabled(true) {}
};
QList< TpackInfo > packs;
TentityMap& getMapForPackID(int packID);
};
#endif // ENTITYIDENTIFIER_H_