Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Toggle main menu visibility
Loading...
Searching...
No Matches
names.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2020 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
21
22
#include <QQmlEngine>
23
#include <
pse-common/utility.h
>
24
#include "
names.h
"
25
26
#include "
./entries/namesplayer.h
"
27
#include "
./entries/namespokemon.h
"
28
29
Names*
Names::inst
()
30
{
31
static
Names* _inst =
new
Names;
32
return
_inst;
33
}
34
35
NamesPlayer
*
Names::player
()
const
36
{
37
return
NamesPlayer::inst
();
38
}
39
40
NamesPokemon
*
Names::pokemon
()
const
41
{
42
return
NamesPokemon::inst
();
43
}
44
45
void
Names::qmlProtect
(
const
QQmlEngine*
const
engine)
const
46
{
47
Utility::qmlProtectUtil
(
this
, engine);
48
49
NamesPlayer::inst
()->
qmlProtect
(engine);
50
NamesPokemon::inst
()->
qmlProtect
(engine);
51
}
52
53
void
Names::qmlRegister()
const
54
{
55
static
bool
once =
false
;
56
if
(once)
57
return
;
58
59
qmlRegisterUncreatableType<Names>(
"PSE.DB.Names"
, 1, 0,
"Names"
,
"Can't instantiate in QML"
);
60
once =
true
;
61
}
62
63
Names::Names()
64
{
65
qmlRegister();
66
67
NamesPlayer::inst
();
68
NamesPokemon::inst
();
69
}
AbstractRandomString::qmlProtect
void qmlProtect(const QQmlEngine *const engine) const
Pin to C++ ownership.
Definition
abstractrandomstring.cpp:49
NamesPlayer
Random player-name source (an AbstractRandomString of player names).
Definition
namesplayer.h:34
NamesPlayer::inst
static NamesPlayer * inst()
The process-wide NamesPlayer singleton.
Definition
namesplayer.cpp:48
NamesPokemon
Random Pokemon-nickname source (an AbstractRandomString of names).
Definition
namespokemon.h:34
NamesPokemon::inst
static NamesPokemon * inst()
The process-wide NamesPokemon singleton.
Definition
namespokemon.cpp:48
Names::player
NamesPlayer * player() const
The player-name source (backs player).
Definition
names.cpp:35
Names::pokemon
NamesPokemon * pokemon() const
The Pokemon-name source (backs pokemon).
Definition
names.cpp:40
Names::inst
static Names * inst()
< Random player-name source.
Definition
names.cpp:29
Names::qmlProtect
void qmlProtect(const QQmlEngine *const engine) const
Pin to C++ ownership.
Definition
names.cpp:45
Utility::qmlProtectUtil
static void qmlProtectUtil(const QObject *const obj, const QQmlEngine *const engine)
Pin obj to C++ ownership so the QML engine never garbage-collects it.
Definition
utility.cpp:63
names.h
namesplayer.h
namespokemon.h
utility.h
projects
db
src
pse-db
names.cpp
Generated by
1.17.0