[skip ci] fix indent spelling
This commit is contained in:
parent
23245a3324
commit
a882738735
2 changed files with 14 additions and 14 deletions
|
@ -199,7 +199,7 @@ QString QJsonDocument::escapeString(const QString &s) const {
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Name: toJson
|
// Name: toJson
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
QString QJsonDocument::toJson(const QJsonValue &v, JsonFormat format, int intend) const {
|
QString QJsonDocument::toJson(const QJsonValue &v, JsonFormat format, int indent) const {
|
||||||
|
|
||||||
QString b;
|
QString b;
|
||||||
QTextStream ss(&b, QIODevice::WriteOnly | QIODevice::Text);
|
QTextStream ss(&b, QIODevice::WriteOnly | QIODevice::Text);
|
||||||
|
@ -234,17 +234,17 @@ QString QJsonDocument::toJson(const QJsonValue &v, JsonFormat format, int intend
|
||||||
QJsonArray::const_iterator it = a.begin();
|
QJsonArray::const_iterator it = a.begin();
|
||||||
QJsonArray::const_iterator e = a.end();
|
QJsonArray::const_iterator e = a.end();
|
||||||
|
|
||||||
if (!compact) ss << QByteArray(4*intend, ' ');
|
if (!compact) ss << QByteArray(4*indent, ' ');
|
||||||
ss << toJson(*it++, format, intend+1);
|
ss << toJson(*it++, format, indent+1);
|
||||||
|
|
||||||
for(;it != e; ++it) {
|
for(;it != e; ++it) {
|
||||||
ss << (compact ? "," : ",\n");
|
ss << (compact ? "," : ",\n");
|
||||||
if (!compact) ss << QByteArray(4*intend, ' ');
|
if (!compact) ss << QByteArray(4*indent, ' ');
|
||||||
ss << toJson(*it, format, intend+1);
|
ss << toJson(*it, format, indent+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
intend--;
|
indent--;
|
||||||
ss << (compact ? "]" : QString("\n%1]").arg(QString(4*intend, ' ')));
|
ss << (compact ? "]" : QString("\n%1]").arg(QString(4*indent, ' ')));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case QJsonValue::Object:
|
case QJsonValue::Object:
|
||||||
|
@ -255,17 +255,17 @@ QString QJsonDocument::toJson(const QJsonValue &v, JsonFormat format, int intend
|
||||||
QJsonObject::const_iterator it = o.begin();
|
QJsonObject::const_iterator it = o.begin();
|
||||||
QJsonObject::const_iterator e = o.end();
|
QJsonObject::const_iterator e = o.end();
|
||||||
|
|
||||||
if (!compact) ss << QByteArray(4*intend, ' ');
|
if (!compact) ss << QByteArray(4*indent, ' ');
|
||||||
ss << '"' << escapeString(it.key()) << (compact ? "\":" : "\": ") << toJson(it.value(), format, intend+1);
|
ss << '"' << escapeString(it.key()) << (compact ? "\":" : "\": ") << toJson(it.value(), format, indent+1);
|
||||||
++it;
|
++it;
|
||||||
for(;it != e; ++it) {
|
for(;it != e; ++it) {
|
||||||
ss << (compact ? "," : ",\n");
|
ss << (compact ? "," : ",\n");
|
||||||
if (!compact) ss << QByteArray(4*intend, ' ');
|
if (!compact) ss << QByteArray(4*indent, ' ');
|
||||||
ss << '"' << escapeString(it.key()) << (compact ? "\":" : "\": ") << toJson(it.value(), format, intend+1);
|
ss << '"' << escapeString(it.key()) << (compact ? "\":" : "\": ") << toJson(it.value(), format, indent+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
intend--;
|
indent--;
|
||||||
ss << (compact ? "}" : QString("\n%1}").arg(QString(4*intend, ' ')));
|
ss << (compact ? "}" : QString("\n%1}").arg(QString(4*indent, ' ')));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case QJsonValue::Undefined:
|
case QJsonValue::Undefined:
|
||||||
|
|
|
@ -88,7 +88,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setRoot(const QJsonRoot &root);
|
void setRoot(const QJsonRoot &root);
|
||||||
QString toJson(const QJsonValue &v, JsonFormat format, int intend = 1) const;
|
QString toJson(const QJsonValue &v, JsonFormat format, int indent = 1) const;
|
||||||
QString escapeString(const QString &s) const;
|
QString escapeString(const QString &s) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in a new issue