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

View File

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

View File

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

View File

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