Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
63 lines
1.5 KiB
C++
63 lines
1.5 KiB
C++
// This file is part of Desktop App Toolkit,
|
|
// a set of libraries for developing nice desktop applications.
|
|
//
|
|
// For license and copyright information please follow this link:
|
|
// https://github.com/desktop-app/legal/blob/master/LEGAL
|
|
//
|
|
#pragma once
|
|
|
|
#include "base/variant.h"
|
|
#include "ui/emoji_config.h"
|
|
|
|
namespace Ui::Text {
|
|
|
|
inline constexpr auto kIsolatedEmojiLimit = 3;
|
|
|
|
struct IsolatedEmoji {
|
|
using Item = std::variant<v::null_t, EmojiPtr, QString>;
|
|
using Items = std::array<Item, kIsolatedEmojiLimit>;
|
|
Items items = {};
|
|
|
|
[[nodiscard]] bool empty() const {
|
|
return v::is_null(items[0]);
|
|
}
|
|
[[nodiscard]] explicit operator bool() const {
|
|
return !empty();
|
|
}
|
|
[[nodiscard]] bool operator<(const IsolatedEmoji &other) const {
|
|
return items < other.items;
|
|
}
|
|
[[nodiscard]] bool operator==(const IsolatedEmoji &other) const {
|
|
return items == other.items;
|
|
}
|
|
[[nodiscard]] bool operator>(const IsolatedEmoji &other) const {
|
|
return other < *this;
|
|
}
|
|
[[nodiscard]] bool operator<=(const IsolatedEmoji &other) const {
|
|
return !(other < *this);
|
|
}
|
|
[[nodiscard]] bool operator>=(const IsolatedEmoji &other) const {
|
|
return !(*this < other);
|
|
}
|
|
[[nodiscard]] bool operator!=(const IsolatedEmoji &other) const {
|
|
return !(*this == other);
|
|
}
|
|
};
|
|
|
|
struct OnlyCustomEmoji {
|
|
struct Item {
|
|
QString entityData;
|
|
int spacesBefore = 0;
|
|
};
|
|
std::vector<std::vector<Item>> lines;
|
|
|
|
[[nodiscard]] bool empty() const {
|
|
return lines.empty();
|
|
}
|
|
[[nodiscard]] explicit operator bool() const {
|
|
return !empty();
|
|
}
|
|
};
|
|
|
|
} // namespace Ui::Text
|