mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 23:45:35 +08:00
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:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user