Ejemplo n.º 1
0
Archivo: Values.cpp Proyecto: CWYQ/node
void DictionaryValue::writeJSON(String16Builder* output) const
{
    output->append('{');
    for (size_t i = 0; i < m_order.size(); ++i) {
        Dictionary::const_iterator it = m_data.find(m_order[i]);
        CHECK(it != m_data.end());
        if (i)
            output->append(',');
        doubleQuoteStringForJSON(it->first, output);
        output->append(':');
        it->second->writeJSON(output);
    }
    output->append('}');
}
Ejemplo n.º 2
0
void JSONObjectBase::writeJSON(StringBuilder* output) const
{
    output->append('{');
    for (size_t i = 0; i < m_order.size(); ++i) {
        Dictionary::const_iterator it = m_data.find(m_order[i]);
        ASSERT_WITH_SECURITY_IMPLICATION(it != m_data.end());
        if (i)
            output->append(',');
        doubleQuoteStringForJSON(it->key, output);
        output->append(':');
        it->value->writeJSON(output);
    }
    output->append('}');
}
Ejemplo n.º 3
0
void JSONObjectBase::prettyWriteJSONInternal(StringBuilder* output, int depth) const
{
    output->appendLiteral("{\n");
    for (size_t i = 0; i < m_order.size(); ++i) {
        Dictionary::const_iterator it = m_data.find(m_order[i]);
        ASSERT_WITH_SECURITY_IMPLICATION(it != m_data.end());
        if (i)
            output->appendLiteral(",\n");
        writeIndent(depth + 1, output);
        doubleQuoteStringForJSON(it->key, output);
        output->appendLiteral(": ");
        it->value->prettyWriteJSONInternal(output, depth + 1);
    }
    output->append('\n');
    writeIndent(depth, output);
    output->append('}');
}
Ejemplo n.º 4
0
Archivo: Values.cpp Proyecto: CWYQ/node
void StringValue::writeJSON(String16Builder* output) const
{
    DCHECK(type() == TypeString);
    doubleQuoteStringForJSON(m_stringValue, output);
}
Ejemplo n.º 5
0
void JSONString::writeJSON(StringBuilder* output) const
{
    ASSERT(type() == TypeString);
    doubleQuoteStringForJSON(m_stringValue, output);
}
Ejemplo n.º 6
0
String JSONValue::quoteString(const String& input)
{
    StringBuilder builder;
    doubleQuoteStringForJSON(input, &builder);
    return builder.toString();
}