Using std::vector<> and const fields for emoji.

This commit is contained in:
John Preston 2017-02-25 23:35:55 +03:00
parent c48ed2e62b
commit f82989c9c3
3 changed files with 10 additions and 12 deletions
Telegram/SourceFiles

View File

@ -267,7 +267,7 @@ bool Generator::writeSource() {
constexpr auto kCount = " << data_.list.size() << ";\n\
auto WorkingIndex = -1;\n\
\n\
QVector<One> Items;\n\
std::vector<One> Items;\n\
\n";
source_->popNamespace().newline().pushNamespace("internal");
source_->stream() << "\

View File

@ -31,7 +31,7 @@ namespace {
constexpr auto kCount = 2167;
auto WorkingIndex = -1;
QVector<One> Items;
std::vector<One> Items;
} // namespace

View File

@ -54,6 +54,8 @@ constexpr auto kPostfix = static_cast<ushort>(0xFE0F);
class One {
public:
One(One &&other) = default;
QString id() const {
return _id;
}
@ -95,9 +97,6 @@ public:
}
private:
One() = default; // For QVector<> to compile.
One(const One &other) = default;
One(const QString &id, uint16 x, uint16 y, bool hasPostfix, bool colorizable, EmojiPtr original)
: _id(id)
, _x(x)
@ -108,15 +107,14 @@ private:
t_assert(!_colorizable || !colored());
}
QString _id;
uint16 _x = 0;
uint16 _y = 0;
bool _hasPostfix = false;
bool _colorizable = false;
EmojiPtr _original = nullptr;
const QString _id;
const uint16 _x = 0;
const uint16 _y = 0;
const bool _hasPostfix = false;
const bool _colorizable = false;
const EmojiPtr _original = nullptr;
friend void Init();
friend class QVector<One>;
};