diff options
author | TheDrawingCoding-Gamer <bulbyvr@gmail.com> | 2024-05-01 13:38:29 -0400 |
---|---|---|
committer | TheDrawingCoding-Gamer <bulbyvr@gmail.com> | 2024-05-08 18:32:09 -0400 |
commit | a6090f4a1ca25100c6d570779d00c2950501498d (patch) | |
tree | a3437398937d137db3b95d90e8c9564a26c57845 /src/emoji/Provider.h | |
parent | Merge pull request #1717 from Integral-Tech/optimize-qstring (diff) | |
download | nheko-a6090f4a1ca25100c6d570779d00c2950501498d.tar.xz |
fix naming issues with emoji, edit how codegen works
Diffstat (limited to '')
-rw-r--r-- | src/emoji/Provider.h | 86 |
1 files changed, 4 insertions, 82 deletions
diff --git a/src/emoji/Provider.h b/src/emoji/Provider.h index d0441ad3..3cb89821 100644 --- a/src/emoji/Provider.h +++ b/src/emoji/Provider.h @@ -2,95 +2,17 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -#pragma once +// DO NOT EDIT Provider.h DIRECTLY! EDIT IT IN scripts/emoji_codegen.py AND RUN scripts/codegen.sh! -#include <QObject> +#pragma once +#include "Emoji.h" #include <array> namespace emoji { -Q_NAMESPACE - -struct Emoji -{ - Q_GADGET -public: - enum class Category - { - People, - Nature, - Food, - Activity, - Travel, - Objects, - Symbols, - Flags, - Search - }; - Q_ENUM(Category) - - Q_PROPERTY(QString unicode READ unicode CONSTANT) - Q_PROPERTY(QString shortName READ shortName CONSTANT) - Q_PROPERTY(QString unicodeName READ unicodeName CONSTANT) - Q_PROPERTY(emoji::Emoji::Category category MEMBER category) - -public: - constexpr Emoji(std::u16string_view unicode, - std::u16string_view shortName, - std::u16string_view unicodeName, - Category cat) - : unicode_(unicode) - , shortName_(shortName) - , unicodeName_(unicodeName) - , category(cat) - { - } - - constexpr Emoji() - : unicode_(u"", 0) - , shortName_(u"", 0) - , unicodeName_(u"", 0) - , category(Category::Search) - { - } - - constexpr Emoji(const Emoji &) = default; - constexpr Emoji(Emoji &&) = default; - - constexpr Emoji &operator=(const Emoji &) = default; - constexpr Emoji &operator=(Emoji &&) = default; - - QString unicode() const - { - return QString::fromRawData(reinterpret_cast<const QChar *>(unicode_.data()), - unicode_.size()); - } - QString shortName() const - { - return QString::fromRawData(reinterpret_cast<const QChar *>(shortName_.data()), - shortName_.size()); - } - QString unicodeName() const - { - return QString::fromRawData(reinterpret_cast<const QChar *>(unicodeName_.data()), - unicodeName_.size()); - } - -private: - std::u16string_view unicode_; - std::u16string_view shortName_; - std::u16string_view unicodeName_; - -public: - Category category; -}; - class Provider { public: // all emoji for QML purposes - static const std::array<Emoji, 3681> emoji; + static const std::array<Emoji, 3799> emoji; }; - -QString -categoryToName(emoji::Emoji::Category cat); } // namespace emoji |