chromium/third_party/fuzztest/src/fuzztest/internal/type_support.h

// 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.

#ifndef FUZZTEST_FUZZTEST_INTERNAL_TYPE_SUPPORT_H_
#define FUZZTEST_FUZZTEST_INTERNAL_TYPE_SUPPORT_H_

#include <cctype>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <string>
#include <string_view>
#include <tuple>
#include <type_traits>
#include <vector>

#include "absl/debugging/symbolize.h"
#include "absl/functional/function_ref.h"
#include "absl/numeric/int128.h"
#include "absl/strings/escaping.h"
#include "absl/strings/has_absl_stringify.h"
#include "absl/strings/match.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
#include "absl/strings/string_view.h"
#include "absl/strings/strip.h"
#include "absl/time/time.h"
#include "./fuzztest/internal/domains/absl_helpers.h"
#include "./fuzztest/internal/meta.h"
#include "./fuzztest/internal/printer.h"
#include "google/protobuf/text_format.h"

namespace fuzztest::internal {

// Return a best effort printer for type `T`.
// This is useful for cases where the domain can't figure out how to print the
// value.
// It implements a good printer for common known types and fallbacks to an
// "unknown" printer to prevent compile time errors.
template <typename T>
decltype(auto) AutodetectTypePrinter();

// Returns true iff type `T` has a known printer that isn't UnknownPrinter.
template <typename T>
constexpr bool HasKnownPrinter();

// If `needle` is present in `haystack`, consume everything until `needle` and
// return true. Otherwise, return false.
inline bool ConsumePrefixUntil(absl::string_view& haystack,
                               absl::string_view needle) {}

inline void SkipAnonymous(absl::string_view& in) {}

template <typename T>
absl::string_view GetTypeName() {}

has_absl_stringify_v;

struct IntegralPrinter {};

struct FloatingPrinter {};

struct StringPrinter {};

template <typename... Inner>
struct AggregatePrinter {};

template <typename... Inner>
struct VariantPrinter {};

template <typename... Inner>
struct OneOfPrinter {};

struct ProtobufPrinter {};

template <typename D>
struct ProtobufEnumPrinter {};

struct MonostatePrinter {};

template <typename Domain, typename Inner>
struct ContainerPrinter {};

template <typename F>
constexpr bool HasFunctionName() {}

template <typename F>
std::string GetFunctionName(const F& f, absl::string_view default_name) {}

template <typename Mapper, typename... Inner>
struct MappedPrinter {};

template <typename FlatMapper, typename... Inner>
struct FlatMappedPrinter {};

struct AutodetectAggregatePrinter {};

struct DurationPrinter {};

struct TimePrinter {};

struct UnknownPrinter {};

template <typename T>
decltype(auto) AutodetectTypePrinter() {}

template <typename T>
constexpr bool HasKnownPrinter() {}

}  // namespace fuzztest::internal

#endif  // FUZZTEST_FUZZTEST_INTERNAL_TYPE_SUPPORT_H_