aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-04-30 22:15:39 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-04-30 22:15:39 +0900
commit228d379967ca0627564e1db5669029792f72bf06 (patch)
tree07f999a1bcf1d91b495ec53ce9d46babbdd77689
parent7c9037bdf4c2f6fee5d800d87e7f9dd9b4070990 (diff)
downloadlibquotient-228d379967ca0627564e1db5669029792f72bf06.tar.gz
libquotient-228d379967ca0627564e1db5669029792f72bf06.zip
Mustache templates: cleanup C++
-rw-r--r--lib/jobs/{{base}}.cpp.mustache10
-rw-r--r--lib/jobs/{{base}}.h.mustache2
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