mirror of https://github.com/procxx/kepka.git
Fix GCC warning on Release build in Emoji::Init.
Also use initializer_list instead of recursion in Emoji::ComputeId.
This commit is contained in:
parent
731e53bc99
commit
47044ab25e
|
@ -275,20 +275,14 @@ EmojiPtr ByIndex(int index) {\n\
|
||||||
return (index >= 0 && index < Items.size()) ? &Items[index] : nullptr;\n\
|
return (index >= 0 && index < Items.size()) ? &Items[index] : nullptr;\n\
|
||||||
}\n\
|
}\n\
|
||||||
\n\
|
\n\
|
||||||
inline void AppendChars(QString &result) {\n\
|
|
||||||
}\n\
|
|
||||||
\n\
|
|
||||||
template <typename ...Args>\n\
|
|
||||||
inline void AppendChars(QString &result, ushort unicode, Args... args) {\n\
|
|
||||||
result.append(QChar(unicode));\n\
|
|
||||||
AppendChars(result, args...);\n\
|
|
||||||
}\n\
|
|
||||||
\n\
|
|
||||||
template <typename ...Args>\n\
|
template <typename ...Args>\n\
|
||||||
inline QString ComputeId(Args... args) {\n\
|
inline QString ComputeId(Args... args) {\n\
|
||||||
|
auto utf16 = { args... };\n\
|
||||||
auto result = QString();\n\
|
auto result = QString();\n\
|
||||||
result.reserve(sizeof...(args));\n\
|
result.reserve(utf16.size());\n\
|
||||||
AppendChars(result, args...);\n\
|
for (auto ch : utf16) {\n\
|
||||||
|
result.append(QChar(ch));\n\
|
||||||
|
}\n\
|
||||||
return result;\n\
|
return result;\n\
|
||||||
}\n";
|
}\n";
|
||||||
if (!writeFindReplace()) {
|
if (!writeFindReplace()) {
|
||||||
|
@ -342,6 +336,7 @@ bool Generator::writeInitCode() {
|
||||||
source_->stream() << "\
|
source_->stream() << "\
|
||||||
\n\
|
\n\
|
||||||
void Init() {\n\
|
void Init() {\n\
|
||||||
|
auto tag = One::CreationTag();\n\
|
||||||
auto scaleForEmoji = cRetina() ? dbisTwo : cScale();\n\
|
auto scaleForEmoji = cRetina() ? dbisTwo : cScale();\n\
|
||||||
\n\
|
\n\
|
||||||
switch (scaleForEmoji) {\n";
|
switch (scaleForEmoji) {\n";
|
||||||
|
@ -363,7 +358,7 @@ void Init() {\n\
|
||||||
auto coloredCount = 0;
|
auto coloredCount = 0;
|
||||||
for (auto &item : data_.list) {
|
for (auto &item : data_.list) {
|
||||||
source_->stream() << "\
|
source_->stream() << "\
|
||||||
Items.emplace_back(" << computeId(item.id) << ", " << column << ", " << row << ", " << (item.postfixed ? "true" : "false") << ", " << (item.variated ? "true" : "false") << ", " << (item.colored ? "&Items[" + QString::number(variated) + "]" : "nullptr") << ", One::CreationTag());\n";
|
Items.emplace_back(" << computeId(item.id) << ", " << column << ", " << row << ", " << (item.postfixed ? "true" : "false") << ", " << (item.variated ? "true" : "false") << ", " << (item.colored ? "&Items[" + QString::number(variated) + "]" : "nullptr") << ", tag);\n";
|
||||||
if (coloredCount > 0 && (item.variated || !item.colored)) {
|
if (coloredCount > 0 && (item.variated || !item.colored)) {
|
||||||
if (!colorsCount_) {
|
if (!colorsCount_) {
|
||||||
colorsCount_ = coloredCount;
|
colorsCount_ = coloredCount;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -58,7 +58,7 @@ class One {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
One(One &&other) = default;
|
One(One &&other) = default;
|
||||||
One(const QString &id, uint16 x, uint16 y, bool hasPostfix, bool colorizable, EmojiPtr original, CreationTag)
|
One(const QString &id, uint16 x, uint16 y, bool hasPostfix, bool colorizable, EmojiPtr original, const CreationTag &)
|
||||||
: _id(id)
|
: _id(id)
|
||||||
, _x(x)
|
, _x(x)
|
||||||
, _y(y)
|
, _y(y)
|
||||||
|
|
Loading…
Reference in New Issue