From 228d379967ca0627564e1db5669029792f72bf06 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Mon, 30 Apr 2018 22:15:39 +0900 Subject: Mustache templates: cleanup C++ --- lib/jobs/{{base}}.cpp.mustache | 10 +++++----- lib/jobs/{{base}}.h.mustache | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/jobs/{{base}}.cpp.mustache b/lib/jobs/{{base}}.cpp.mustache index e44e6a2a..87205caa 100644 --- a/lib/jobs/{{base}}.cpp.mustache +++ b/lib/jobs/{{base}}.cpp.mustache @@ -19,9 +19,9 @@ namespace QMatrixClient } } -{{qualifiedName}} FromJson<{{qualifiedName}}>::operator()(QJsonValue jv) +{{qualifiedName}} FromJson<{{qualifiedName}}>::operator()(const QJsonValue& jv) { - QJsonObject o = jv.toObject(); + const auto& o = jv.toObject(); {{qualifiedName}} result; {{#vars}}result.{{nameCamelCase}} = fromJson<{{dataType.name}}>(o.value("{{baseName}}")); @@ -43,12 +43,12 @@ namespace QMatrixClient template <> struct FromJson<{{qualifiedName}}> { - {{qualifiedName}} operator()(QJsonValue jv) + {{qualifiedName}} operator()(const QJsonValue& jv) { - QJsonObject o = jv.toObject(); + const auto& o = jv.toObject(); {{qualifiedName}} result; {{#vars}}result.{{nameCamelCase}} = - fromJson<{{dataType.qualifiedName}}>(o.value("{{baseName}}")); + fromJson<{{dataType.qualifiedName}}>(o.value("{{baseName}}")); {{/vars}} return result; } diff --git a/lib/jobs/{{base}}.h.mustache b/lib/jobs/{{base}}.h.mustache index 8606e251..941662de 100644 --- a/lib/jobs/{{base}}.h.mustache +++ b/lib/jobs/{{base}}.h.mustache @@ -23,7 +23,7 @@ namespace QMatrixClient template <> struct FromJson<{{name}}> { - {{name}} operator()(QJsonValue jv); + {{name}} operator()(const QJsonValue& jv); }; {{/ trivial?}}{{/model}} {{/models}}{{#operations}} // Operations -- cgit v1.2.3