Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
fontsearch.h
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#pragma once
17#include <QObject>
18#include <QVector>
19#include <QString>
20
21#include "../db_autoport.h"
22
23class FontsDB;
24class FontDBEntry;
25class QQmlEngine;
26
39class DB_AUTOPORT FontSearch : public QObject
40{
41 Q_OBJECT
42 Q_PROPERTY(int fontCount READ getFontCount NOTIFY fontCountChanged STORED false)
43
44signals:
45 void fontCountChanged();
46
47public:
48 FontSearch();
49
50 Q_INVOKABLE FontSearch* startOver();
51 Q_INVOKABLE FontSearch* clear();
52
53 // Sets results to the UNION of the selected categories — an entry is kept if
54 // it matches ANY enabled trait (OR, not AND). Nothing enabled → empty.
55 Q_INVOKABLE FontSearch* keepAnyOf(bool normal, bool control, bool picture,
56 bool singleChar, bool multiChar, bool variable);
57 Q_INVOKABLE FontSearch* andShorthand();
58 Q_INVOKABLE FontSearch* notShorthand();
59 Q_INVOKABLE FontSearch* andNormal();
60 Q_INVOKABLE FontSearch* notNormal();
61 Q_INVOKABLE FontSearch* andControl();
62 Q_INVOKABLE FontSearch* notControl();
63 Q_INVOKABLE FontSearch* andPicture();
64 Q_INVOKABLE FontSearch* notPicture();
65 Q_INVOKABLE FontSearch* andSingleChar();
66 Q_INVOKABLE FontSearch* notSingleChar();
67 Q_INVOKABLE FontSearch* andMultiChar();
68 Q_INVOKABLE FontSearch* notMultiChar();
69 Q_INVOKABLE FontSearch* andVariable();
70 Q_INVOKABLE FontSearch* notVariable();
71
72 // QML Interface
73 const QVector<FontDBEntry*> getFonts() const;
74 int getFontCount() const;
75 Q_INVOKABLE const FontDBEntry* fontAt(const int ind) const;
76
77public slots:
78 void qmlProtect(const QQmlEngine* const engine) const;
79
80private slots:
81 void qmlRegister() const;
82
83private:
84 QVector<FontDBEntry*> results;
85};
FontSearch * andVariable()
Keep only variable glyphs.
FontSearch * notNormal()
Drop normal glyphs.
FontSearch * notSingleChar()
Drop single-char glyphs.
FontSearch * andPicture()
Keep only picture glyphs.
FontSearch * notShorthand()
Drop shorthand glyphs. Returns this.
FontSearch * andControl()
Keep only control glyphs.
int getFontCount() const
Result count (backs fontCount).
FontSearch * startOver()
Reset to all glyphs. Returns this.
FontSearch * keepAnyOf(bool normal, bool control, bool picture, bool singleChar, bool multiChar, bool variable)
OR-union filter (see note). Returns this.
FontSearch * andNormal()
Keep only normal glyphs.
FontSearch * andMultiChar()
Keep only multi-char glyphs.
const FontDBEntry * fontAt(const int ind) const
Result ind (for QML).
const QVector< FontDBEntry * > getFonts() const
The current result set.
FontSearch * notMultiChar()
Drop multi-char glyphs.
FontSearch * notPicture()
Drop picture glyphs.
FontSearch()
Start with all glyphs in the result set.
FontSearch * clear()
Empty the result set. Returns this.
FontSearch * andShorthand()
Keep only shorthand glyphs. Returns this.
FontSearch * andSingleChar()
Keep only single-char glyphs.
FontSearch * notVariable()
Drop variable glyphs.
FontSearch * notControl()
Drop control glyphs.
void qmlProtect(const QQmlEngine *const engine) const
Pin to C++ ownership.
The font database – the in-game character set and the text codec.
Definition fontsdb.h:50
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 in-game font character: its code, output text, and classification flags.
Definition fontdbentry.h:43