refs #624, #492 Refactor parts of CLogMessage into base class and use inheriting constructors to unify the construction idiom of CLogMessage and CStatusMessage.

This commit is contained in:
Mathew Sutcliffe
2016-03-19 23:33:37 +00:00
parent 2ce1f3da0a
commit caa01f846b
8 changed files with 230 additions and 187 deletions

View File

@@ -48,6 +48,12 @@ const QJsonValue &operator >>(const QJsonValue &json, QString &value)
return json;
}
const QJsonValue &operator >>(const QJsonValue &json, QStringList &value)
{
for (auto &&element : json.toArray()) { value << element.toString(); }
return json;
}
const QJsonValue &operator >>(const QJsonValue &json, double &value)
{
value = json.toDouble();
@@ -116,6 +122,12 @@ const QJsonValueRef &operator >>(const QJsonValueRef &json, QString &value)
return json;
}
const QJsonValueRef &operator >>(const QJsonValueRef &json, QStringList &value)
{
for (auto &&element : json.toArray()) { value << element.toString(); }
return json;
}
const QJsonValueRef &operator >>(const QJsonValueRef &json, double &value)
{
value = json.toDouble();
@@ -252,6 +264,12 @@ QJsonObject &operator<<(QJsonObject &json, const std::pair<QString, const QStrin
return json;
}
QJsonObject &operator<<(QJsonObject &json, const std::pair<QString, const QStringList &> &value)
{
json.insert(value.first, QJsonValue(QJsonArray::fromStringList(value.second)));
return json;
}
QJsonObject &operator<<(QJsonObject &json, const std::pair<QString, const double &> &value)
{
json.insert(value.first, QJsonValue(value.second));