chromium/third_party/fuzztest/src/fuzztest/internal/serialization.cc

// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include "./fuzztest/internal/serialization.h"

#include <cctype>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <limits>
#include <optional>
#include <string>
#include <variant>
#include <vector>

#include "absl/strings/numbers.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
#include "absl/strings/string_view.h"

namespace fuzztest::internal {

namespace {

struct OutputVisitor {};

constexpr absl::string_view kHeader =;

absl::string_view ReadToken(absl::string_view& in) {}

bool ReadScalar(uint64_t& out, absl::string_view value) {}

bool ReadScalar(double& out, absl::string_view value) {}

bool ReadScalar(std::string& out, absl::string_view value) {}

constexpr int kMaxParseRecursionDepth =;

bool ParseImpl(IRObject& obj, absl::string_view& str, int recursion_depth) {}

// NOTE: Binary format assumes the same endianness between producers and
// consumers - we assume little-endianness for now.

enum class BinaryFormatHeader : char {};

struct BinaryOutputVisitor {};

constexpr absl::string_view kBinaryHeader =;

struct BinaryParseBuf {};

bool BinaryParse(IRObject& obj, BinaryParseBuf& buf, int recursion_depth) {}

bool IsInBinaryFormat(absl::string_view str) {}

}  // namespace

std::string IRObject::ToString(bool binary_format) const {}

// TODO(lszekeres): Return StatusOr<IRObject>.
std::optional<IRObject> IRObject::FromString(absl::string_view str) {}

}  // namespace fuzztest::internal