Changeset View
Changeset View
Standalone View
Standalone View
src/kconfig_compiler/kconfig_compiler.cpp
Show First 20 Lines • Show All 610 Lines • ▼ Show 20 Line(s) | 607 | { | |||
---|---|---|---|---|---|
611 | r.remove(QLatin1Char('\r')); | 611 | r.remove(QLatin1Char('\r')); | ||
612 | r.replace(QLatin1Char('\n'), QLatin1String("\\n\"\n\"")); | 612 | r.replace(QLatin1Char('\n'), QLatin1String("\\n\"\n\"")); | ||
613 | return QLatin1Char('\"') + r + QLatin1Char('\"'); | 613 | return QLatin1Char('\"') + r + QLatin1Char('\"'); | ||
614 | } | 614 | } | ||
615 | 615 | | |||
616 | static QString literalString(const QString &s) | 616 | static QString literalString(const QString &s) | ||
617 | { | 617 | { | ||
618 | bool isAscii = true; | 618 | bool isAscii = true; | ||
619 | for (int i = s.length(); i--;) | 619 | for (int i = s.length(); i--;) { | ||
patrickelectric: std::any_of ? | |||||
ervin: Indeed, could be replaced by any_of since we're at it. | |||||
620 | if (s[i].unicode() > 127) { | 620 | if (s[i].unicode() > 127) { | ||
621 | isAscii = false; | 621 | isAscii = false; | ||
622 | break; | ||||
623 | } | ||||
622 | } | 624 | } | ||
623 | 625 | | |||
Nitpick: there shouldn't be a space after ! Also: use std::cbegin and std::cend (I think they're allowed nowadays) ervin: Nitpick: there shouldn't be a space after !
Also: use std::cbegin and std::cend (I think… | |||||
624 | if (isAscii) { | 626 | if (isAscii) { | ||
625 | return QLatin1String("QStringLiteral( ") + quoteString(s) + QLatin1String(" )"); | 627 | return QLatin1String("QStringLiteral( ") + quoteString(s) + QLatin1String(" )"); | ||
626 | } else { | 628 | } else { | ||
627 | return QLatin1String("QString::fromUtf8( ") + quoteString(s) + QLatin1String(" )"); | 629 | return QLatin1String("QString::fromUtf8( ") + quoteString(s) + QLatin1String(" )"); | ||
628 | } | 630 | } | ||
629 | } | 631 | } | ||
630 | 632 | | |||
631 | static QString dumpNode(const QDomNode &node) | 633 | static QString dumpNode(const QDomNode &node) | ||
▲ Show 20 Lines • Show All 2100 Lines • Show Last 20 Lines |
std::any_of ?