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

// Copyright 2023 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/configuration.h"

#include <cstddef>
#include <cstring>
#include <optional>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>

#include "absl/log/check.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "absl/time/time.h"

namespace fuzztest::internal {
namespace {

template <typename T>
size_t SpaceFor(const T&) {}

template <>
size_t SpaceFor(const absl::string_view& str) {}

template <>
size_t SpaceFor(const std::string& str) {}

template <>
size_t SpaceFor(const std::optional<std::string>& obj) {}

template <>
size_t SpaceFor(const std::vector<std::string>& vec) {}

template <int&... ExplicitArgumentBarrier, typename IntT,
          typename = std::enable_if_t<std::is_integral_v<IntT>>>
size_t WriteIntegral(std::string& out, size_t offset, IntT val) {}

size_t WriteString(std::string& out, size_t offset, absl::string_view str) {}

size_t WriteOptionalString(std::string& out, size_t offset,
                           const std::optional<std::string>& str) {}

size_t WriteVectorOfStrings(std::string& out, size_t offset,
                            const std::vector<std::string>& vec) {}

#define ASSIGN_OR_RETURN

template <typename IntT, int&... ExplicitArgumentBarrier,
          typename = std::enable_if_t<std::is_integral_v<IntT>>>
absl::StatusOr<IntT> Consume(absl::string_view& buffer) {}

absl::StatusOr<std::string> ConsumeString(absl::string_view& buffer) {}

absl::StatusOr<std::optional<std::string>> ConsumeOptionalString(
    absl::string_view& buffer) {}

absl::StatusOr<std::vector<std::string>> ConsumeVectorOfStrings(
    absl::string_view& buffer) {}

absl::StatusOr<absl::Duration> ParseDuration(absl::string_view duration) {}

}  // namespace

std::string Configuration::Serialize() const {}

absl::StatusOr<Configuration> Configuration::Deserialize(
    absl::string_view serialized) {}

#undef ASSIGN_OR_RETURN

}  // namespace fuzztest::internal