Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Toggle main menu visibility
Loading...
Searching...
No Matches
types.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
18
#include <QObject>
19
#include <QJsonValue>
20
#include <QString>
21
#include <QHash>
22
#include <QVector>
23
24
#include <
pse-common/types.h
>
25
#include "
./db_autoport.h
"
26
27
struct
MoveDBEntry
;
28
struct
PokemonDBEntry
;
29
class
QQmlEngine;
30
39
struct
DB_AUTOPORT
TypeDBEntry
{
40
TypeDBEntry
();
41
TypeDBEntry
(QJsonValue& data);
42
43
QString
name
;
44
var8
ind
= 0;
45
QString
readable
;
46
47
QVector<MoveDBEntry*>
toMoves
;
48
QVector<PokemonDBEntry*>
toPokemon
;
49
};
50
58
class
DB_AUTOPORT
TypesDB :
public
QObject
59
{
60
Q_OBJECT
61
Q_PROPERTY(
int
getStoreSize
READ
getStoreSize
CONSTANT)
62
63
public
:
64
static
TypesDB*
inst
();
65
66
[[nodiscard]]
const
QVector<TypeDBEntry*>
getStore
()
const
;
67
[[nodiscard]]
const
QHash<QString, TypeDBEntry*>
getInd
()
const
;
68
[[nodiscard]]
int
getStoreSize
()
const
;
69
70
Q_INVOKABLE
TypeDBEntry
*
getStoreAt
(
int
idx)
const
;
71
Q_INVOKABLE
TypeDBEntry
*
getIndAt
(
const
QString& key)
const
;
72
73
public
slots:
74
void
load
();
75
void
index
();
76
void
qmlProtect
(
const
QQmlEngine*
const
engine)
const
;
77
78
private
slots:
79
void
qmlRegister()
const
;
80
81
private
:
82
TypesDB();
83
84
QVector<TypeDBEntry*> store;
85
QHash<QString, TypeDBEntry*> ind;
86
};
TypesDB::load
void load()
Load types from JSON.
Definition
types.cpp:58
TypesDB::getIndAt
TypeDBEntry * getIndAt(const QString &key) const
Type by name key (for QML).
Definition
types.cpp:53
TypesDB::getStoreSize
int getStoreSize() const
Type count.
Definition
types.cpp:45
TypesDB::inst
static TypesDB * inst()
< Number of types.
Definition
types.cpp:37
TypesDB::getStore
const QVector< TypeDBEntry * > getStore() const
All types.
Definition
types.cpp:43
TypesDB::getInd
const QHash< QString, TypeDBEntry * > getInd() const
Name->entry index.
Definition
types.cpp:44
TypesDB::index
void index()
Build the name->entry index.
Definition
types.cpp:68
TypesDB::qmlProtect
void qmlProtect(const QQmlEngine *const engine) const
Pin to C++ ownership.
Definition
types.cpp:80
TypesDB::getStoreAt
TypeDBEntry * getStoreAt(int idx) const
Type by store index (for QML).
Definition
types.cpp:47
types.h
Project-wide fixed-width integer aliases (var8, var16, ...).
var8
var8e var8
Everyday 8-bit alias. Exact (not "fastest") to dodge the pointer-width bug noted above.
Definition
types.h:124
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
MoveDBEntry
One move's static data (type, power, accuracy, PP, TM/HM), with links.
Definition
moves.h:46
PokemonDBEntry
One species' complete static data – the richest entry in the db layer.
Definition
pokemon.h:98
TypeDBEntry
One elemental type: its name plus the moves and Pokemon of that type.
Definition
types.h:39
TypeDBEntry::toPokemon
QVector< PokemonDBEntry * > toPokemon
Pokemon of this type (back-ref).
Definition
types.h:48
TypeDBEntry::toMoves
QVector< MoveDBEntry * > toMoves
Moves of this type (back-ref).
Definition
types.h:47
TypeDBEntry::readable
QString readable
Human-readable type name.
Definition
types.h:45
TypeDBEntry::ind
var8 ind
Type index/id.
Definition
types.h:44
TypeDBEntry::TypeDBEntry
TypeDBEntry()
Empty entry.
Definition
types.cpp:29
TypeDBEntry::name
QString name
Internal type name (key).
Definition
types.h:43
projects
db
src
pse-db
types.h
Generated by
1.17.0