Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Toggle main menu visibility
Loading...
Searching...
No Matches
eventsdb.h
Go to the documentation of this file.
1
/*
2
* Copyright 2019 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 <QVector>
19
#include <QString>
20
#include <QHash>
21
#include <QJsonValue>
22
23
#include "
./db_autoport.h
"
24
25
// With amazing help of Quicktype!!!
26
// https://app.quicktype.io
27
28
class
EventDBEntry
;
29
class
QQmlEngine;
30
40
class
DB_AUTOPORT
EventsDB :
public
QObject
41
{
42
Q_OBJECT
43
Q_PROPERTY(
int
getStoreSize
READ
getStoreSize
CONSTANT)
44
45
public
:
46
// Get Instance
47
static
EventsDB*
inst
();
48
49
// Get Properties, includes QML array helpers
50
const
QVector<EventDBEntry*>
getStore
()
const
;
51
const
QHash<QString, EventDBEntry*>
getInd
()
const
;
52
int
getStoreSize
()
const
;
53
54
// QML Methods that can't be a property or slot because they take an argument
55
Q_INVOKABLE
EventDBEntry
*
getStoreAt
(
const
int
ind)
const
;
56
Q_INVOKABLE
EventDBEntry
*
getIndAt
(
const
QString val)
const
;
57
58
public
slots:
59
void
load
();
60
void
index
();
61
void
deepLink
();
62
void
qmlProtect
(
const
QQmlEngine*
const
engine)
const
;
63
64
private
slots:
65
void
qmlRegister()
const
;
66
67
private
:
68
// Singleton Constructor
69
EventsDB();
70
71
QVector<EventDBEntry*> store;
72
QHash<QString, EventDBEntry*> ind;
73
};
EventsDB::deepLink
void deepLink()
Resolve each event's cross-DB links.
Definition
eventsdb.cpp:107
EventsDB::qmlProtect
void qmlProtect(const QQmlEngine *const engine) const
Pin to C++ ownership.
Definition
eventsdb.cpp:121
EventsDB::getStoreSize
int getStoreSize() const
Event count.
Definition
eventsdb.cpp:51
EventsDB::getInd
const QHash< QString, EventDBEntry * > getInd() const
Name->entry index.
Definition
eventsdb.cpp:46
EventsDB::getIndAt
EventDBEntry * getIndAt(const QString val) const
Event by name key (for QML).
Definition
eventsdb.cpp:64
EventsDB::load
void load()
Load events from JSON.
Definition
eventsdb.cpp:69
EventsDB::getStoreAt
EventDBEntry * getStoreAt(const int ind) const
Event by store index (for QML).
Definition
eventsdb.cpp:56
EventsDB::index
void index()
Build the name->entry index.
Definition
eventsdb.cpp:91
EventsDB::getStore
const QVector< EventDBEntry * > getStore() const
All event definitions.
Definition
eventsdb.cpp:41
EventsDB::inst
static EventsDB * inst()
< Number of event definitions.
Definition
eventsdb.cpp:35
db_autoport.h
Import/export macro for the db library, plus the central list of DB entry pointer types declared opaq...
DB_AUTOPORT
#define DB_AUTOPORT
Expands to the correct dllexport/dllimport decoration for this library.
Definition
db_autoport.h:37
EventDBEntry
One story-event definition: its name and where its flag lives in the save.
Definition
eventdbentry.h:42
projects
db
src
pse-db
eventsdb.h
Generated by
1.17.0