Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
missablesdb.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
23class MissableDBEntry;
24class QQmlEngine;
25
35class DB_AUTOPORT MissablesDB : public QObject
36{
37 Q_OBJECT
38 Q_PROPERTY(int getStoreSize READ getStoreSize CONSTANT)
39
40public:
41 // Get Instance
42 static MissablesDB* inst();
43
44 // Get Properties, includes QML array helpers
45 const QVector<MissableDBEntry*> getStore() const;
46 const QHash<QString, MissableDBEntry*> 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 MissableDBEntry* getStoreAt(const int ind) const;
51 Q_INVOKABLE MissableDBEntry* getIndAt(const QString val) const;
52
53public slots:
54 void load();
55 void index();
56 void deepLink();
57 void qmlProtect(const QQmlEngine* const engine) const;
58
59private slots:
60 void qmlRegister() const;
61
62private:
63 // Singleton Constructor
64 MissablesDB();
65
66 QVector<MissableDBEntry*> store;
67 QHash<QString, MissableDBEntry*> ind;
68};
int getStoreSize() const
Missable count.
void qmlProtect(const QQmlEngine *const engine) const
Pin to C++ ownership.
void index()
Build the name->entry index.
void deepLink()
Resolve each missable's cross-DB links.
const QHash< QString, MissableDBEntry * > getInd() const
Name->entry index.
MissableDBEntry * getIndAt(const QString val) const
Missable by name key (for QML).
const QVector< MissableDBEntry * > getStore() const
All missable definitions.
MissableDBEntry * getStoreAt(const int ind) const
Missable by store index (for QML).
static MissablesDB * inst()
< Number of missable definitions.
void load()
Load missables from JSON.
Import/export macro for the db library, plus the central list of DB entry pointer types declared opaq...
#define DB_AUTOPORT
Expands to the correct dllexport/dllimport decoration for this library.
Definition db_autoport.h:37
One missable definition: a script/sprite that can be hidden or shown.