Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
examples.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
22
23#include <QQmlEngine>
24#include <pse-common/utility.h>
25#include "examples.h"
26
30
31Examples* Examples::inst()
32{
33 static Examples* _inst = new Examples;
34 return _inst;
35}
36
41
46
51
52void Examples::qmlProtect(const QQmlEngine* const engine) const
53{
54 Utility::qmlProtectUtil(this, engine);
55
59}
60
61void Examples::qmlRegister() const
62{
63 static bool once = false;
64 if(once)
65 return;
66
67 qmlRegisterUncreatableType<Examples>("PSE.DB.Examples", 1, 0, "Examples", "Can't instantiate in QML");
68 once = true;
69}
70
71Examples::Examples()
72{
73 qmlRegister();
74
78}
void qmlProtect(const QQmlEngine *const engine) const
Pin to C++ ownership.
Example player-value source (an AbstractRandomString of presets).
static ExamplesPlayer * inst()
The process-wide ExamplesPlayer singleton.
Example Pokemon-value source (an AbstractRandomString of presets).
static ExamplesPokemon * inst()
The process-wide ExamplesPokemon singleton.
Example rival-value source (an AbstractRandomString of presets).
static ExamplesRival * inst()
The process-wide ExamplesRival singleton.
ExamplesRival * rival() const
The example-rival source (backs rival).
Definition examples.cpp:42
ExamplesPokemon * pokemon() const
The example-Pokemon source (backs pokemon).
Definition examples.cpp:47
void qmlProtect(const QQmlEngine *const engine) const
Pin to C++ ownership.
Definition examples.cpp:52
ExamplesPlayer * player() const
The example-player source (backs player).
Definition examples.cpp:37
static Examples * inst()
< Example player source.
Definition examples.cpp:31
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