Tome
A generic data editor for games supporting arbitrary input and output formats.
customtype.h
1 #ifndef CUSTOMTYPE_H
2 #define CUSTOMTYPE_H
3 
4 #include <QMap>
5 #include <QString>
6 #include <QStringList>
7 #include <QVariantMap>
8 
9 namespace Tome
10 {
14  class CustomType
15  {
16  public:
20  QString name;
21 
25  QVariantMap fundamentalFacets;
26 
30  QVariantMap constrainingFacets;
31 
35  QString typeSetName;
36 
41  QString getBaseType() const;
42 
47  QStringList getEnumeration() const;
48 
53  QString getItemType() const;
54 
59  QString getKeyType() const;
60 
65  QString getValueType() const;
66 
71  bool isDerivedType() const;
72 
77  bool isEnumeration() const;
78 
83  bool isList() const;
84 
89  bool isMap() const;
90 
95  void setBaseType(const QString& baseType);
96 
101  void setEnumeration(const QStringList& enumeration);
102 
107  void setItemType(const QString& itemType);
108 
113  void setKeyType(const QString& keyType);
114 
119  void setValueType(const QString& valueType);
120 
121  private:
122  static const QString FacetBaseType;
123  static const QString FacetEnumeration;
124  static const QString FacetItemType;
125  static const QString FacetKeyType;
126  static const QString FacetValueType;
127  };
128 
129  inline bool operator==(const CustomType& lhs, const CustomType& rhs){ return lhs.name == rhs.name; }
130  inline bool operator!=(const CustomType& lhs, const CustomType& rhs){ return !(lhs == rhs); }
131 
132  inline bool customTypeLessThanName(const CustomType& e1, const CustomType& e2)
133  {
134  return e1.name.toLower() < e2.name.toLower();
135  }
136 }
137 
138 #endif // CUSTOMTYPE_H
Definition: commandlineoptions.h:6
void setKeyType(const QString &keyType)
Sets the Key Type fundamental facet of this type.
Definition: customtype.cpp:113
void setBaseType(const QString &baseType)
Sets the BaseType fundamental facet of this type.
Definition: customtype.cpp:97
bool isEnumeration() const
Checks whether this custom type is an enumeration.
Definition: customtype.cpp:81
QVariantMap constrainingFacets
Values of constraining facets of this type, e.g. maximum value of an integer.
Definition: customtype.h:30
void setEnumeration(const QStringList &enumeration)
Sets the Enumeration fundamental facet of this type.
Definition: customtype.cpp:102
QString typeSetName
Name of the set this custom type belongs to.
Definition: customtype.h:35
QString name
Name of this custom type.
Definition: customtype.h:20
bool isDerivedType() const
Checks whether this custom type is a derived type.
Definition: customtype.cpp:76
User-defined type of any field.
Definition: customtype.h:14
QString getBaseType() const
Convenience function for retrieving the BaseType fundamental facet of this type, if available...
Definition: customtype.cpp:13
bool isMap() const
Checks whether this custom type is a map type.
Definition: customtype.cpp:91
QVariantMap fundamentalFacets
Values of fundamental facets of this type, e.g. type of the keys of a map.
Definition: customtype.h:25
void setValueType(const QString &valueType)
Sets the Value Type fundamental facet of this type.
Definition: customtype.cpp:118
QString getItemType() const
Convenience function for retrieving the Item Type fundamental facet of this type, if available...
Definition: customtype.cpp:46
QString getKeyType() const
Convenience function for retrieving the Key Type fundamental facet of this type, if available...
Definition: customtype.cpp:56
void setItemType(const QString &itemType)
Sets the Item Type fundamental facet of this type.
Definition: customtype.cpp:108
QString getValueType() const
Convenience function for retrieving the Value Type fundamental facet of this type, if available. Returns an empty string, if not.
Definition: customtype.cpp:66
QStringList getEnumeration() const
Convenience function for retrieving the Enumeration fundamental facet of this type, if available. Returns an empty list, if not.
Definition: customtype.cpp:23
bool isList() const
Checks whether this custom type is a list type.
Definition: customtype.cpp:86