|
Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
|
Shared base for a simple "list of strings, pick a random one" source. More...
#include <abstractrandomstring.h>
Public Member Functions | |
| const QVector< QString > | getStore () const |
| All strings. | |
| int | getStoreSize () const |
| String count. | |
| const QString | getStoreAt (const int ind) const |
String at ind (for QML). | |
| QString | randomExample () |
| A random string from the list. | |
| void | load () |
| Load the strings from fileName. | |
| 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. | |
| AbstractRandomString (const QString fileName) | |
Protected Attributes | |
| : void listChanged() | |
| < Number of strings. | |
| QVector< QString > | store |
| The loaded strings. | |
| const QString | fileName |
| Asset path (set by the subclass). | |
Shared base for a simple "list of strings, pick a random one" source.
The base for NamesPlayer and NamesPokemon: a store of strings loaded from a fileName, with a randomExample() helper. Subclasses just supply the file (via the protected ctor), an inst(), and qmlRegister().
Definition at line 35 of file abstractrandomstring.h.
|
protected |
| fileName | the JSON/text asset the subclass loads from. |
Definition at line 54 of file abstractrandomstring.cpp.
References fileName, and load().
Referenced by ExamplesPlayer::ExamplesPlayer(), ExamplesPokemon::ExamplesPokemon(), ExamplesRival::ExamplesRival(), NamesPlayer::NamesPlayer(), NamesPokemon::NamesPokemon(), and qmlRegister().
| const QVector< QString > AbstractRandomString::getStore | ( | ) | const |
| const QString AbstractRandomString::getStoreAt | ( | const int | ind | ) | const |
| int AbstractRandomString::getStoreSize | ( | ) | const |
| void AbstractRandomString::load | ( | ) |
Load the strings from fileName.
Definition at line 32 of file abstractrandomstring.cpp.
References fileName, GameData::inst(), GameData::json(), and store.
Referenced by AbstractRandomString(), and randomExample().
| void AbstractRandomString::qmlProtect | ( | const QQmlEngine *const | engine | ) | const |
Pin to C++ ownership.
Definition at line 49 of file abstractrandomstring.cpp.
References Utility::qmlProtectUtil().
Referenced by Examples::qmlProtect(), and Names::qmlProtect().
|
protectedpure virtual |
Subclass registers its concrete type with QML.
Implemented in ExamplesPlayer, ExamplesPokemon, ExamplesRival, NamesPlayer, and NamesPokemon.
References AbstractRandomString(), and fileName.
| QString AbstractRandomString::randomExample | ( | ) |
A random string from the list.
Definition at line 80 of file abstractrandomstring.cpp.
References Random::inst(), load(), Random::rangeExclusive(), and store.
Referenced by PokemonBox::changeName(), PokemonBox::changeOtData(), HoFPokemon::randomize(), PlayerBasics::randomize(), and Rival::randomize().
|
protected |
< Number of strings.
Emitted when the string list changes (rare; see note).
Definition at line 35 of file abstractrandomstring.h.
|
protected |
Asset path (set by the subclass).
Definition at line 64 of file abstractrandomstring.h.
Referenced by AbstractRandomString(), load(), and qmlRegister().
|
protected |
The loaded strings.
Definition at line 63 of file abstractrandomstring.h.
Referenced by getStore(), getStoreAt(), getStoreSize(), load(), and randomExample().