Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
abstracthiddenitemdb.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 "./db_autoport.h"
19
21class QQmlEngine;
22
35class DB_AUTOPORT AbstractHiddenItemDB : public QObject
36{
37 Q_OBJECT
38 Q_PROPERTY(int getStoreSize READ getStoreSize CONSTANT)
39
40public:
41 // Get Properties, includes QML array helpers
42 const QVector<HiddenItemDBEntry*> getStore() const;
43 int getStoreSize() const;
44
45 Q_INVOKABLE HiddenItemDBEntry* getStoreAt(const int ind) const;
46
47public slots:
48 void load();
49 void deepLink();
50 void qmlProtect(const QQmlEngine* const engine) const;
51
52protected slots:
53 virtual void qmlRegister() const = 0;
54
55protected:
57 AbstractHiddenItemDB(const QString loadFile);
58
59 QVector<HiddenItemDBEntry*> store;
60 const QString loadFile;
61};
AbstractHiddenItemDB(const QString loadFile)
void qmlProtect(const QQmlEngine *const engine) const
Pin to C++ ownership.
int getStoreSize() const
Entry count.
const QString loadFile
JSON asset path (set by the subclass).
HiddenItemDBEntry * getStoreAt(const int ind) const
Entry by store index (for QML).
QVector< HiddenItemDBEntry * > store
The loaded entries.
void load()
Load entries from loadFile.
virtual void qmlRegister() const =0
Subclass registers its concrete type with QML.
const QVector< HiddenItemDBEntry * > getStore() const
< Number of hidden pickups.
void deepLink()
Resolve each entry's cross-DB links.
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 hidden pickup's location: its map and tile coordinates.