chromium/third_party/inspector_protocol/crdtp/json.cc

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "json.h"

#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstring>
#include <limits>
#include <stack>

#include "cbor.h"
#include "json_platform.h"

namespace crdtp {
namespace json {
// =============================================================================
// json::NewJSONEncoder - for encoding streaming parser events as JSON
// =============================================================================

namespace {
// Prints |value| to |out| with 4 hex digits, most significant chunk first.
template <typename C>
void PrintHex(uint16_t value, C* out) {}

// In the writer below, we maintain a stack of State instances.
// It is just enough to emit the appropriate delimiters and brackets
// in JSON.
enum class Container {};

class State {};

constexpr char kBase64Table[] =;

template <typename C>
void Base64Encode(const span<uint8_t>& in, C* out) {}

// Implements a handler for JSON parser events to emit a JSON string.
template <typename C>
class JSONEncoder : public ParserHandler {};
}  // namespace

std::unique_ptr<ParserHandler> NewJSONEncoder(std::vector<uint8_t>* out,
                                              Status* status) {}

std::unique_ptr<ParserHandler> NewJSONEncoder(std::string* out,
                                              Status* status) {}

// =============================================================================
// json::ParseJSON - for receiving streaming parser events for JSON.
// =============================================================================

namespace {
const int kStackLimit =;

enum Token {};

const char* const kNullString =;
const char* const kTrueString =;
const char* const kFalseString =;

template <typename Char>
class JsonParser {};
}  // namespace

void ParseJSON(span<uint8_t> chars, ParserHandler* handler) {}

void ParseJSON(span<uint16_t> chars, ParserHandler* handler) {}

// =============================================================================
// json::ConvertCBORToJSON, json::ConvertJSONToCBOR - for transcoding
// =============================================================================
template <typename C>
Status ConvertCBORToJSONTmpl(span<uint8_t> cbor, C* json) {}

Status ConvertCBORToJSON(span<uint8_t> cbor, std::vector<uint8_t>* json) {}

Status ConvertCBORToJSON(span<uint8_t> cbor, std::string* json) {}

template <typename T>
Status ConvertJSONToCBORTmpl(span<T> json, std::vector<uint8_t>* cbor) {}

Status ConvertJSONToCBOR(span<uint8_t> json, std::vector<uint8_t>* cbor) {}

Status ConvertJSONToCBOR(span<uint16_t> json, std::vector<uint8_t>* cbor) {}
}  // namespace json
}  // namespace crdtp