Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
eventdbentry.h
Go to the documentation of this file.
1/*
2 * Copyright 2020 Twilight
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15*/
16#pragma once
17#include <QObject>
18#include <QJsonValue>
19
20#include "../db_autoport.h"
21
22struct MapDBEntry;
23class QQmlEngine;
24class EventsDB;
25
26// With amazing help of Quicktype!!!
27// https://app.quicktype.io
28
29// In-Game events, there's like a million of them, not kidding lol. Every little
30// thing you do changes and moves around events
31
42struct DB_AUTOPORT EventDBEntry : public QObject {
43 Q_OBJECT
44 Q_PROPERTY(QString getName READ getName CONSTANT)
45 Q_PROPERTY(int getInd READ getInd CONSTANT)
46 Q_PROPERTY(int getByte READ getByte CONSTANT)
47 Q_PROPERTY(int getBit READ getBit CONSTANT)
48 Q_PROPERTY(int getMapsSize READ getMapsSize CONSTANT)
49 Q_PROPERTY(int getToMapsSize READ getToMapsSize CONSTANT)
50
51public:
52 const QString getName() const;
53 int getInd() const;
54 int getByte() const;
55 int getBit() const;
56
57 const QVector<QString> getMaps() const;
58 int getMapsSize() const;
59 Q_INVOKABLE const QString getMapAt(int ind) const;
60
61 const QVector<MapDBEntry*> getToMaps() const;
62 int getToMapsSize() const;
63 Q_INVOKABLE const MapDBEntry* getToMapAt(int ind) const;
64
65public slots:
66 void qmlProtect(const QQmlEngine* const engine) const;
67
68protected:
69 EventDBEntry();
70 EventDBEntry(QJsonValue& data);
71
72 void deepLink();
73 void qmlRegister() const;
74
75 QString name = ""; // Event name
76 int ind = 0; // Internal index
77 int byte = 0; // Byte in SAV file
78 int bit = 0; // Bit in byte
79 QVector<QString> maps; // Associated Maps
80 QVector<MapDBEntry*> toMaps; // To Associated Maps
81
82 friend class EventsDB;
83};
The story-events database – metadata for the 508 event flags, keyed by name.
Definition eventsdb.h:41
Import/export macro for the db library, plus the central list of DB entry pointer types declared opaq...
#define DB_AUTOPORT
Expands to the correct dllexport/dllimport decoration for this library.
Definition db_autoport.h:37
EventDBEntry()
Empty entry (built by EventsDB).
friend class EventsDB
Owning DB constructs/populates entries.
const QString getName() const
< Event name.
const QString getMapAt(int ind) const
Associated map name ind (for QML).
int getBit() const
int getToMapsSize() const
void qmlProtect(const QQmlEngine *const engine) const
Pin to C++ ownership.
void qmlRegister() const
Register with QML.
int getMapsSize() const
const QVector< QString > getMaps() const
Associated map names.
QVector< MapDBEntry * > toMaps
QVector< QString > maps
void deepLink()
Resolve the associated maps.
int getInd() const
const QVector< MapDBEntry * > getToMaps() const
Resolved associated maps.
int getByte() const
const MapDBEntry * getToMapAt(int ind) const
Resolved map ind (for QML).
One map's complete static definition – the root of the MapDBEntry family.
Definition mapdbentry.h:56