Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Toggle main menu visibility
Loading...
Searching...
No Matches
flydb.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 <QString>
19
#include <QHash>
20
#include <QJsonValue>
21
#include <QVector>
22
23
#include "
./db_autoport.h
"
24
25
class
FlyDBEntry
;
26
class
QQmlEngine;
27
37
class
DB_AUTOPORT
FlyDB
:
public
QObject
38
{
39
Q_OBJECT
40
Q_PROPERTY(
int
getStoreSize
READ
getStoreSize
CONSTANT)
41
42
public
:
43
// Get Instance
44
static
FlyDB
*
inst
();
45
46
// Get Properties, includes QML array helpers
47
const
QVector<FlyDBEntry*>
getStore
()
const
;
48
const
QHash<QString, FlyDBEntry*>
getInd
()
const
;
49
int
getStoreSize
()
const
;
50
51
// QML Methods that can't be a property or slot because they take an argument
52
Q_INVOKABLE
FlyDBEntry
*
getStoreAt
(
const
int
ind
)
const
;
53
Q_INVOKABLE
FlyDBEntry
*
getIndAt
(
const
QString val)
const
;
54
55
public
slots:
56
void
load
();
57
void
index
();
58
void
deepLink
();
59
void
qmlProtect
(
const
QQmlEngine*
const
engine)
const
;
60
61
private
slots:
62
void
qmlRegister()
const
;
63
64
public
:
65
FlyDB
();
66
67
QVector<FlyDBEntry*>
store
;
68
QHash<QString, FlyDBEntry*>
ind
;
69
};
FlyDB::getIndAt
FlyDBEntry * getIndAt(const QString val) const
Destination by name key (for QML).
Definition
flydb.cpp:65
FlyDB::deepLink
void deepLink()
Resolve each destination's map link.
Definition
flydb.cpp:108
FlyDB::index
void index()
Build the name->entry index.
Definition
flydb.cpp:92
FlyDB::inst
static FlyDB * inst()
< Number of fly destinations.
Definition
flydb.cpp:36
FlyDB::FlyDB
FlyDB()
(Public here, but obtain the singleton via inst().)
Definition
flydb.cpp:139
FlyDB::getStoreSize
int getStoreSize() const
Destination count.
Definition
flydb.cpp:52
FlyDB::store
QVector< FlyDBEntry * > store
The loaded destinations.
Definition
flydb.h:67
FlyDB::getStoreAt
FlyDBEntry * getStoreAt(const int ind) const
Destination by store index (for QML).
Definition
flydb.cpp:57
FlyDB::load
void load()
Load destinations from JSON.
Definition
flydb.cpp:70
FlyDB::ind
QHash< QString, FlyDBEntry * > ind
Name->entry lookup.
Definition
flydb.h:68
FlyDB::qmlProtect
void qmlProtect(const QQmlEngine *const engine) const
Pin to C++ ownership.
Definition
flydb.cpp:122
FlyDB::getInd
const QHash< QString, FlyDBEntry * > getInd() const
Name->entry index.
Definition
flydb.cpp:47
FlyDB::getStore
const QVector< FlyDBEntry * > getStore() const
All fly destinations.
Definition
flydb.cpp:42
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
FlyDBEntry
One fly destination: its name/index and the map it flies to.
Definition
flydbentry.h:37
projects
db
src
pse-db
flydb.h
Generated by
1.17.0