Tome
A generic data editor for games supporting arbitrary input and output formats.
record.h
1 #ifndef RECORD_H
2 #define RECORD_H
3 
4 #include <QMap>
5 #include <QString>
6 #include <QVariant>
7 
8 #include "recordfieldvaluemap.h"
9 
10 
11 namespace Tome
12 {
16  class Record
17  {
18  public:
22  QVariant id;
23 
27  QString displayName;
28 
33 
37  RecordFieldValueMap fieldValues;
38 
42  QVariant parentId;
43 
47  bool readOnly = false;
48 
52  QString recordSetName;
53  };
54 
55  inline bool operator==(const Record& lhs, const Record& rhs){ return lhs.id == rhs.id; }
56  inline bool operator!=(const Record& lhs, const Record& rhs){ return !(lhs == rhs); }
57 
58  inline bool recordLessThanDisplayName(const Record& e1, const Record& e2)
59  {
60  return e1.displayName.toLower() < e2.displayName.toLower();
61  }
62 
63  inline bool recordLessThanId(const Record& e1, const Record& e2)
64  {
65  return e1.id.toString().toLower() < e2.id.toString().toLower();
66  }
67 }
68 
69 #endif // RECORD_H
Definition: commandlineoptions.h:6
QString displayName
Display name of this record.
Definition: record.h:27
RecordFieldValueMap fieldValues
Values of all fields of this record.
Definition: record.h:37
QVariant id
Unique id of this record.
Definition: record.h:22
QString recordSetName
Name of the set this record belongs to.
Definition: record.h:52
QVariant parentId
Id of the parent of this record, or null if this record is a root of the record tree.
Definition: record.h:42
bool readOnly
Whether to prevent this record from being edited, reparented or removed.
Definition: record.h:47
QString editorIconFieldId
Id of the field to use as editor icon for this record.
Definition: record.h:32
Data record that combines the values of various fields.
Definition: record.h:16