Tome
A generic data editor for games supporting arbitrary input and output formats.
fielddefinition.h
1 #ifndef FIELDDEFINITION_H
2 #define FIELDDEFINITION_H
3 
4 #include <QString>
5 #include <QVariant>
6 
7 #include "../../Components/Model/component.h"
8 
9 
10 namespace Tome
11 {
16  {
17  public:
21  Component component;
22 
26  QVariant defaultValue;
27 
31  QString description;
32 
36  QString displayName;
37 
42 
46  QString fieldType;
47 
51  QString id;
52  };
53 
54  inline bool operator==(const FieldDefinition& lhs, const FieldDefinition& rhs){ return lhs.id == rhs.id; }
55  inline bool operator!=(const FieldDefinition& lhs, const FieldDefinition& rhs){ return !(lhs == rhs); }
56 
57  inline bool fieldDefinitionLessThanDisplayName(const FieldDefinition& e1, const FieldDefinition& e2)
58  {
59  return e1.displayName.toLower() < e2.displayName.toLower();
60  }
61 
62  inline bool fieldDefinitionLessThanComponentAndDisplayName(const FieldDefinition& e1, const FieldDefinition& e2)
63  {
64  QString lhs = QString("%1%2").arg(e1.component, e1.displayName);
65  QString rhs = QString("%1%2").arg(e2.component, e2.displayName);
66  return lhs.toLower() < rhs.toLower();
67  }
68 }
69 
70 #endif // FIELDDEFINITION_H
Definition: commandlineoptions.h:6
Component component
Component this field definition belongs to.
Definition: fielddefinition.h:21
QString fieldDefinitionSetName
Name of the set this field definition belongs to.
Definition: fielddefinition.h:41
QVariant defaultValue
Default value of this field.
Definition: fielddefinition.h:26
Field that can be added to a record to hold data.
Definition: fielddefinition.h:15
QString displayName
Display name of this field.
Definition: fielddefinition.h:36
QString id
Unique id of this field definition.
Definition: fielddefinition.h:51
QString description
Textual description of this field.
Definition: fielddefinition.h:31
QString fieldType
Type of the values of this field.
Definition: fielddefinition.h:46