chromium/third_party/blink/renderer/platform/json/json_values.cc

/*
 * Copyright (C) 2010 Google Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *
 *     * Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above
 * copyright notice, this list of conditions and the following disclaimer
 * in the documentation and/or other materials provided with the
 * distribution.
 *     * Neither the name of Google Inc. nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "third_party/blink/renderer/platform/json/json_values.h"

#include <algorithm>
#include <cmath>

#include "base/notreached.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/wtf/decimal.h"
#include "third_party/blink/renderer/platform/wtf/math_extras.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"

namespace blink {

namespace {

inline bool EscapeChar(UChar c, StringBuilder* dst) {}

const LChar kHexDigits[17] =;

void AppendUnsignedAsHex(UChar number, StringBuilder* dst) {}

void WriteIndent(int depth, StringBuilder* output) {}

}  // anonymous namespace

const char kJSONNullString[] =;
const char kJSONTrueString[] =;
const char kJSONFalseString[] =;

void EscapeStringForJSON(const String& str, StringBuilder* dst) {}

void DoubleQuoteStringForJSON(const String& str, StringBuilder* dst) {}

String JSONValue::QuoteString(const String& input) {}

bool JSONValue::AsBoolean(bool*) const {}

bool JSONValue::AsDouble(double*) const {}

bool JSONValue::AsInteger(int*) const {}

bool JSONValue::AsString(String*) const {}

String JSONValue::ToJSONString() const {}

String JSONValue::ToPrettyJSONString() const {}

void JSONValue::WriteJSON(StringBuilder* output) const {}

void JSONValue::PrettyWriteJSON(StringBuilder* output) const {}

void JSONValue::PrettyWriteJSONInternal(StringBuilder* output,
                                        int depth) const {}

std::unique_ptr<JSONValue> JSONValue::Clone() const {}

bool JSONBasicValue::AsBoolean(bool* output) const {}

bool JSONBasicValue::AsDouble(double* output) const {}

bool JSONBasicValue::AsInteger(int* output) const {}

void JSONBasicValue::WriteJSON(StringBuilder* output) const {}

std::unique_ptr<JSONValue> JSONBasicValue::Clone() const {}

bool JSONString::AsString(String* output) const {}

void JSONString::WriteJSON(StringBuilder* output) const {}

std::unique_ptr<JSONValue> JSONString::Clone() const {}

JSONObject::~JSONObject() = default;

bool JSONObject::SetBoolean(const String& name, bool value) {}

bool JSONObject::SetInteger(const String& name, int value) {}

bool JSONObject::SetDouble(const String& name, double value) {}

bool JSONObject::SetString(const String& name, const String& value) {}

bool JSONObject::SetValue(const String& name,
                          std::unique_ptr<JSONValue> value) {}

bool JSONObject::SetObject(const String& name,
                           std::unique_ptr<JSONObject> value) {}

bool JSONObject::SetArray(const String& name,
                          std::unique_ptr<JSONArray> value) {}

bool JSONObject::GetBoolean(const String& name, bool* output) const {}

bool JSONObject::GetInteger(const String& name, int* output) const {}

bool JSONObject::GetDouble(const String& name, double* output) const {}

bool JSONObject::GetString(const String& name, String* output) const {}

JSONObject* JSONObject::GetJSONObject(const String& name) const {}

JSONArray* JSONObject::GetArray(const String& name) const {}

JSONValue* JSONObject::Get(const String& name) const {}

JSONObject::Entry JSONObject::at(wtf_size_t index) const {}

bool JSONObject::BooleanProperty(const String& name, bool default_value) const {}

int JSONObject::IntegerProperty(const String& name, int default_value) const {}

double JSONObject::DoubleProperty(const String& name,
                                  double default_value) const {}

void JSONObject::Remove(const String& name) {}

void JSONObject::WriteJSON(StringBuilder* output) const {}

void JSONObject::PrettyWriteJSONInternal(StringBuilder* output,
                                         int depth) const {}

std::unique_ptr<JSONValue> JSONObject::Clone() const {}

JSONObject::JSONObject() :{}

JSONArray::~JSONArray() = default;

void JSONArray::WriteJSON(StringBuilder* output) const {}

void JSONArray::PrettyWriteJSONInternal(StringBuilder* output,
                                        int depth) const {}

std::unique_ptr<JSONValue> JSONArray::Clone() const {}

JSONArray::JSONArray() :{}

void JSONArray::PushBoolean(bool value) {}

void JSONArray::PushInteger(int value) {}

void JSONArray::PushDouble(double value) {}

void JSONArray::PushString(const String& value) {}

void JSONArray::PushValue(std::unique_ptr<JSONValue> value) {}

void JSONArray::PushObject(std::unique_ptr<JSONObject> value) {}

void JSONArray::PushArray(std::unique_ptr<JSONArray> value) {}

JSONValue* JSONArray::at(wtf_size_t index) const {}

}  // namespace blink