Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
AbstractHiddenItemDB Class Referenceabstract

Shared base for the two hidden-pickup databases (items and coins). More...

#include <abstracthiddenitemdb.h>

Inheritance diagram for AbstractHiddenItemDB:
Collaboration diagram for AbstractHiddenItemDB:

Public Member Functions

const QVector< HiddenItemDBEntry * > getStore () const
 < Number of hidden pickups.
int getStoreSize () const
 Entry count.
HiddenItemDBEntrygetStoreAt (const int ind) const
 Entry by store index (for QML).
void load ()
 Load entries from loadFile.
void deepLink ()
 Resolve each entry's cross-DB links.
void qmlProtect (const QQmlEngine *const engine) const
 Pin to C++ ownership.

Protected Member Functions

virtual void qmlRegister () const =0
 Subclass registers its concrete type with QML.
 AbstractHiddenItemDB (const QString loadFile)

Protected Attributes

QVector< HiddenItemDBEntry * > store
 The loaded entries.
const QString loadFile
 JSON asset path (set by the subclass).

Detailed Description

Shared base for the two hidden-pickup databases (items and coins).

Hidden items and hidden coins are the same shape – a store of HiddenItemDBEntry loaded from a JSON file – so the common machinery (store, load, deepLink, QML accessors) lives here once. Subclasses (HiddenItemsDB, HiddenCoinsDB) just supply their loadFile (via the protected constructor), an inst(), and the concrete qmlRegister(). This is the one DB family using inheritance rather than the copy-the-pattern approach. See db.md.

See also
HiddenItemsDB, HiddenCoinsDB, HiddenItemDBEntry.

Definition at line 35 of file abstracthiddenitemdb.h.

Constructor & Destructor Documentation

◆ AbstractHiddenItemDB()

AbstractHiddenItemDB::AbstractHiddenItemDB ( const QString loadFile)
protected
Parameters
loadFilethe JSON asset the concrete subclass loads from.

Definition at line 98 of file abstracthiddenitemdb.cpp.

References load(), and loadFile.

Referenced by HiddenCoinsDB::HiddenCoinsDB(), HiddenItemsDB::HiddenItemsDB(), and qmlRegister().

Member Function Documentation

◆ deepLink()

void AbstractHiddenItemDB::deepLink ( )

Resolve each entry's cross-DB links.

Definition at line 76 of file abstracthiddenitemdb.cpp.

References store.

◆ getStore()

const QVector< HiddenItemDBEntry * > AbstractHiddenItemDB::getStore ( ) const

< Number of hidden pickups.

All hidden-pickup entries.

Definition at line 36 of file abstracthiddenitemdb.cpp.

References store.

◆ getStoreAt()

HiddenItemDBEntry * AbstractHiddenItemDB::getStoreAt ( const int ind) const

Entry by store index (for QML).

Definition at line 46 of file abstracthiddenitemdb.cpp.

References store.

◆ getStoreSize()

int AbstractHiddenItemDB::getStoreSize ( ) const

Entry count.

Definition at line 41 of file abstracthiddenitemdb.cpp.

References store.

◆ load()

void AbstractHiddenItemDB::load ( )

Load entries from loadFile.

Definition at line 54 of file abstracthiddenitemdb.cpp.

References GameData::inst(), GameData::json(), loadFile, and store.

Referenced by AbstractHiddenItemDB().

◆ qmlProtect()

void AbstractHiddenItemDB::qmlProtect ( const QQmlEngine *const engine) const

Pin to C++ ownership.

Definition at line 90 of file abstracthiddenitemdb.cpp.

References Utility::qmlProtectUtil(), and store.

Referenced by DB::qmlProtect().

◆ qmlRegister()

virtual void AbstractHiddenItemDB::qmlRegister ( ) const
protectedpure virtual

Subclass registers its concrete type with QML.

Implemented in HiddenCoinsDB, and HiddenItemsDB.

References AbstractHiddenItemDB(), and loadFile.

Member Data Documentation

◆ loadFile

const QString AbstractHiddenItemDB::loadFile
protected

JSON asset path (set by the subclass).

Definition at line 60 of file abstracthiddenitemdb.h.

Referenced by AbstractHiddenItemDB(), load(), and qmlRegister().

◆ store

QVector<HiddenItemDBEntry*> AbstractHiddenItemDB::store
protected

The loaded entries.

Definition at line 59 of file abstracthiddenitemdb.h.

Referenced by deepLink(), getStore(), getStoreAt(), getStoreSize(), load(), and qmlProtect().


The documentation for this class was generated from the following files: