Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Toggle main menu visibility
Loading...
Searching...
No Matches
mapsdb.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 <QHash>
20
#include "
./db_autoport.h
"
21
22
class
MapDBEntry
;
23
class
QQmlEngine;
24
class
MapSearch
;
25
26
// With amazing help of Quicktype!!!
27
// https://app.quicktype.io
28
40
class
DB_AUTOPORT
MapsDB :
public
QObject
41
{
42
Q_OBJECT
43
Q_PROPERTY(
int
getStoreSize
READ
getStoreSize
CONSTANT)
44
Q_PROPERTY(
MapSearch
*
search
READ
searchRaw
STORED
false
)
45
46
public
:
47
// Get Instance
48
static
MapsDB*
inst
();
49
50
// Get Properties, includes QML array helpers
51
const
QVector<MapDBEntry*>
getStore
()
const
;
52
const
QHash<QString, MapDBEntry*>
getInd
()
const
;
53
int
getStoreSize
()
const
;
54
55
MapSearch
*
searchRaw
()
const
;
56
QScopedPointer<MapSearch, QScopedPointerDeleteLater>
search
()
const
;
57
58
// QML Methods that can't be a property or slot because they take an argument
59
Q_INVOKABLE
MapDBEntry
*
getStoreAt
(
const
int
ind)
const
;
60
Q_INVOKABLE
MapDBEntry
*
getIndAt
(
const
QString val)
const
;
61
62
public
slots:
63
void
load
();
64
void
index
();
65
void
deepLink
();
66
void
qmlProtect
(
const
QQmlEngine*
const
engine)
const
;
67
68
private
slots:
69
void
qmlRegister()
const
;
70
71
private
:
72
MapsDB();
73
74
QVector<MapDBEntry*> store;
75
QHash<QString, MapDBEntry*> ind;
76
};
MapSearch
A chainable filter ("finder") over the maps – the heart of map randomization.
Definition
mapsearch.h:42
MapsDB::deepLink
void deepLink()
Resolve every map's warps/sprites/connections/etc.
Definition
mapsdb.cpp:98
MapsDB::inst
static MapsDB * inst()
< Number of maps.
Definition
mapsdb.cpp:35
MapsDB::search
QScopedPointer< MapSearch, QScopedPointerDeleteLater > search() const
C++-owned finder (smart pointer).
Definition
mapsdb.cpp:141
MapsDB::getIndAt
MapDBEntry * getIndAt(const QString val) const
Map by name key (for QML).
Definition
mapsdb.cpp:155
MapsDB::getStoreSize
int getStoreSize() const
Map count.
Definition
mapsdb.cpp:51
MapsDB::qmlProtect
void qmlProtect(const QQmlEngine *const engine) const
Pin to C++ ownership.
Definition
mapsdb.cpp:112
MapsDB::index
void index()
Build the name->map index.
Definition
mapsdb.cpp:78
MapsDB::getStore
const QVector< MapDBEntry * > getStore() const
All maps.
Definition
mapsdb.cpp:41
MapsDB::getStoreAt
MapDBEntry * getStoreAt(const int ind) const
Map by store index (for QML).
Definition
mapsdb.cpp:147
MapsDB::getInd
const QHash< QString, MapDBEntry * > getInd() const
Name->map index.
Definition
mapsdb.cpp:46
MapsDB::searchRaw
MapSearch * searchRaw() const
Raw finder for QML (QML-managed ownership).
Definition
mapsdb.cpp:136
MapsDB::load
void load()
Load maps from JSON.
Definition
mapsdb.cpp:56
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
MapDBEntry
One map's complete static definition – the root of the MapDBEntry family.
Definition
mapdbentry.h:56
projects
db
src
pse-db
mapsdb.h
Generated by
1.17.0