Skip to content
Permalink
Browse files

Format with contemporary clang-format

Some defaults have changed, but accept the result anyway.

This also wraps string literals. Previous versions of MSVC would fail to
compile fragments in a QStringLiteral, but that is no longer a problem.

https://bugs.llvm.org/show_bug.cgi?id=26980
  • Loading branch information...
steveire committed Nov 24, 2018
1 parent 1226e31 commit 68280cf452393a81b10aa62d2fca85ea529071c5
@@ -111,6 +111,7 @@ class UnorderedListFilter : public Filter
bool autoescape = false) const override;

bool isSafe() const override { return true; }

protected:
SafeString processList(const QVariantList &list, int tabs,
bool autoescape) const;
@@ -53,7 +53,7 @@ QVariant CapFirstFilter::doFilter(const QVariant &input,

return QVariant(safeString.get().at(0).toUpper()
+ static_cast<QString>(
safeString.get().right(safeString.get().size() - 1)));
safeString.get().right(safeString.get().size() - 1)));
}

EscapeJsFilter::EscapeJsFilter() {}
@@ -57,16 +57,16 @@ QVariant CustomTypeRegistry::lookup(const QVariant &object,

{
if (!types.contains(id)) {
qCWarning(GRANTLEE_CUSTOMTYPE) << "Don't know how to handle metatype"
<< QMetaType::typeName(id);
qCWarning(GRANTLEE_CUSTOMTYPE)
<< "Don't know how to handle metatype" << QMetaType::typeName(id);
// :TODO: Print out error message
return QVariant();
}

const CustomTypeInfo &info = types[id];
if (!info.lookupFunction) {
qCWarning(GRANTLEE_CUSTOMTYPE) << "No lookup function for metatype"
<< QMetaType::typeName(id);
qCWarning(GRANTLEE_CUSTOMTYPE)
<< "No lookup function for metatype" << QMetaType::typeName(id);
lf = 0;
// :TODO: Print out error message
return QVariant();
@@ -46,23 +46,23 @@ typedef CharacterTransition<'\n', MarkNewline> NewlineHandler;
typedef CharacterTransition<'}', MarkEndSyntax> EndTemplateSyntaxHandler;
typedef NegateCharacterTransition<'}'> NotEndTemplateSyntaxHandler;

typedef LexerObject<TextProcessingTransition,
Negate<OrTest<CharacterTest<'{'>,
OrTest<CharacterTest<'#'>,
CharacterTest<'%'>>>>>
typedef LexerObject<
TextProcessingTransition,
Negate<OrTest<CharacterTest<'{'>,
OrTest<CharacterTest<'#'>, CharacterTest<'%'>>>>>
NotBeginTemplateSyntaxHandler;

typedef LexerObject<TextProcessingTransition,
Negate<OrTest<CharacterTest<'{'>,
OrTest<CharacterTest<'#'>,
OrTest<CharacterTest<'%'>,
CharacterTest<'\n'>>>>>>
typedef LexerObject<
TextProcessingTransition,
Negate<OrTest<CharacterTest<'{'>,
OrTest<CharacterTest<'#'>,
OrTest<CharacterTest<'%'>, CharacterTest<'\n'>>>>>>
NotBeginTemplateSyntaxOrNewlineHandler;

typedef LexerObject<TextProcessingTransition,
Negate<OrTest<CharacterTest<'#'>,
OrTest<CharacterTest<'%'>,
CharacterTest<'\n'>>>>>
typedef LexerObject<
TextProcessingTransition,
Negate<OrTest<CharacterTest<'#'>,
OrTest<CharacterTest<'%'>, CharacterTest<'\n'>>>>>
NotTagCommentOrNewlineHandler;

typedef LexerObject<TextProcessingTransition,
@@ -86,6 +86,7 @@ class LexerObject : public TType
void onEntry() { return Action1::doAction(m_lexer); }

void onExit() { return Action2::doAction(m_lexer); }

private:
Lexer *const m_lexer;
};
@@ -310,7 +310,8 @@ void Parser::invalidBlockTag(const Token &token, const QString &command,
} else {
throw Grantlee::Exception(
InvalidBlockTagError,
QStringLiteral("Invalid block tag on line %1: '%2\''. Did you forget to register or load this tag?")
QStringLiteral("Invalid block tag on line %1: '%2\''. Did you forget "
"to register or load this tag?")
.arg(token.linenumber)
.arg(command));
}
@@ -39,8 +39,9 @@ class FileSystemTemplateLoaderPrivate
FileSystemTemplateLoaderPrivate(FileSystemTemplateLoader *loader,
QSharedPointer<AbstractLocalizer> localizer)
: q_ptr(loader),
m_localizer(localizer ? localizer : QSharedPointer<AbstractLocalizer>(
new NullLocalizer))
m_localizer(localizer
? localizer
: QSharedPointer<AbstractLocalizer>(new NullLocalizer))
{
}
Q_DECLARE_PUBLIC(FileSystemTemplateLoader)
@@ -143,7 +144,7 @@ Template FileSystemTemplateLoader::loadByName(const QString &fileName,

if (file.exists()
&& !fi.canonicalFilePath().contains(
QDir(d->m_templateDirs.at(i)).canonicalPath()))
QDir(d->m_templateDirs.at(i)).canonicalPath()))
return Template();
++i;
}
@@ -75,7 +75,12 @@ void Benchmarking::initTestCase()

m_engine->setPluginPaths(QStringList(QStringLiteral(GRANTLEE_PLUGIN_PATH)));

m_templateGeneratorString = QStringLiteral("Lorem {% for i in items %} Ipsum {% templatetag openblock %} if boo {% templatetag closeblock %} bar {% templatetag openvariable %} bat|upper {% templatetag closevariable %} baz {{ i }} dolor {% templatetag openblock %} endif {% templatetag closeblock %} sit.{% endfor %} amet.\n");
m_templateGeneratorString = QStringLiteral(
"Lorem {% for i in items %} Ipsum {% templatetag openblock %} if boo {% "
"templatetag closeblock %} bar {% templatetag openvariable %} bat|upper "
"{% templatetag closevariable %} baz {{ i }} dolor {% templatetag "
"openblock %} endif {% templatetag closeblock %} sit.{% endfor %} "
"amet.\n");

m_templateGenerator = m_engine->newTemplate(m_templateGeneratorString,
QStringLiteral("generator"));

0 comments on commit 68280cf

Please sign in to comment.
You can’t perform that action at this time.