chromium/base/strings/string_number_conversions_internal.h

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif

#ifndef BASE_STRINGS_STRING_NUMBER_CONVERSIONS_INTERNAL_H_
#define BASE_STRINGS_STRING_NUMBER_CONVERSIONS_INTERNAL_H_

#include <errno.h>
#include <stdlib.h>

#include <limits>
#include <optional>
#include <string_view>

#include "base/check.h"
#include "base/logging.h"
#include "base/numerics/safe_math.h"
#include "base/strings/string_util.h"
#include "base/third_party/double_conversion/double-conversion/double-conversion.h"

namespace base {

namespace internal {

template <typename STR, typename INT>
static STR IntToStringT(INT value) {}

// Utility to convert a character to a digit in a given base
template <int BASE, typename CHAR>
std::optional<uint8_t> CharToDigit(CHAR c) {}

template <typename Number, int kBase>
class StringToNumberParser {};

template <typename Number, int kBase, typename CharT>
auto StringToNumber(std::basic_string_view<CharT> input) {}

template <typename T, typename VALUE, typename CharT = typename T::value_type>
bool StringToIntImpl(T input, VALUE& output) {}

template <typename T, typename VALUE, typename CharT = typename T::value_type>
bool HexStringToIntImpl(T input, VALUE& output) {}

static const double_conversion::DoubleToStringConverter*
GetDoubleToStringConverter() {}

// Converts a given (data, size) pair to a desired string type. For
// performance reasons, this dispatches to a different constructor if the
// passed-in data matches the string's value_type.
template <typename StringT>
StringT ToString(const typename StringT::value_type* data, size_t size) {}

template <typename StringT, typename CharT>
StringT ToString(const CharT* data, size_t size) {}

template <typename StringT>
StringT DoubleToStringT(double value) {}

template <typename STRING, typename CHAR>
bool StringToDoubleImpl(STRING input, const CHAR* data, double& output) {}

template <typename Char, typename OutIter>
static bool HexStringToByteContainer(std::string_view input, OutIter output) {}

}  // namespace internal

}  // namespace base

#endif  // BASE_STRINGS_STRING_NUMBER_CONVERSIONS_INTERNAL_H_