Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Toggle main menu visibility
Loading...
Searching...
No Matches
itemsdb.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
21
#include "
./db_autoport.h
"
22
23
class
ItemDBEntry
;
24
class
QQmlEngine;
25
35
class
DB_AUTOPORT
ItemsDB :
public
QObject
36
{
37
Q_OBJECT
38
Q_PROPERTY(
int
getStoreSize
READ
getStoreSize
CONSTANT)
39
40
public
:
41
// Get Instance
42
static
ItemsDB*
inst
();
43
44
// Get Properties, includes QML array helpers
45
const
QVector<ItemDBEntry*>
getStore
()
const
;
46
const
QHash<QString, ItemDBEntry*>
getInd
()
const
;
47
int
getStoreSize
()
const
;
48
49
// QML Methods that can't be a property or slot because they take an argument
50
Q_INVOKABLE
ItemDBEntry
*
getStoreAt
(
const
int
ind)
const
;
51
Q_INVOKABLE
ItemDBEntry
*
getIndAt
(
const
QString val)
const
;
52
53
public
slots:
54
void
load
();
55
void
index
();
56
void
deepLink
();
57
void
qmlProtect
(
const
QQmlEngine*
const
engine)
const
;
58
59
private
slots:
60
void
qmlRegister()
const
;
61
62
private
:
63
ItemsDB();
64
65
QVector<ItemDBEntry*> store;
66
QHash<QString, ItemDBEntry*> ind;
67
};
ItemsDB::load
void load()
Load items from JSON.
Definition
itemsdb.cpp:71
ItemsDB::getIndAt
ItemDBEntry * getIndAt(const QString val) const
Item by name key (for QML).
Definition
itemsdb.cpp:66
ItemsDB::getInd
const QHash< QString, ItemDBEntry * > getInd() const
Name->entry index.
Definition
itemsdb.cpp:48
ItemsDB::deepLink
void deepLink()
Resolve each item's cross-DB links.
Definition
itemsdb.cpp:115
ItemsDB::getStore
const QVector< ItemDBEntry * > getStore() const
All items.
Definition
itemsdb.cpp:43
ItemsDB::inst
static ItemsDB * inst()
< Number of items.
Definition
itemsdb.cpp:37
ItemsDB::index
void index()
Build the name->entry index.
Definition
itemsdb.cpp:93
ItemsDB::getStoreSize
int getStoreSize() const
Item count.
Definition
itemsdb.cpp:53
ItemsDB::getStoreAt
ItemDBEntry * getStoreAt(const int ind) const
Item by store index (for QML).
Definition
itemsdb.cpp:58
ItemsDB::qmlProtect
void qmlProtect(const QQmlEngine *const engine) const
Pin to C++ ownership.
Definition
itemsdb.cpp:129
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
ItemDBEntry
One item's static data: name/flags, pricing, and where it's used.
Definition
itemdbentry.h:46
projects
db
src
pse-db
itemsdb.h
Generated by
1.17.0