chromium/third_party/blink/renderer/platform/wtf/text/string_to_number.cc

// Copyright 2016 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/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "third_party/blink/renderer/platform/wtf/text/string_to_number.h"

#include <type_traits>

#include "third_party/blink/renderer/platform/wtf/dtoa.h"
#include "third_party/blink/renderer/platform/wtf/text/ascii_ctype.h"
#include "third_party/blink/renderer/platform/wtf/text/character_visitor.h"
#include "third_party/blink/renderer/platform/wtf/text/string_impl.h"
#include "third_party/blink/renderer/platform/wtf/text/string_view.h"
#include "third_party/blink/renderer/platform/wtf/text/unicode.h"

namespace WTF {

template <int base>
bool IsCharacterAllowedInBase(UChar);

template <>
bool IsCharacterAllowedInBase<10>(UChar c) {}

template <>
bool IsCharacterAllowedInBase<16>(UChar c) {}

template <typename IntegralType, typename CharType, int base>
static inline IntegralType ToIntegralType(const CharType* data,
                                          size_t length,
                                          NumberParsingOptions options,
                                          NumberParsingResult* parsing_result) {}

template <typename IntegralType, typename CharType, int base>
static inline IntegralType ToIntegralType(const CharType* data,
                                          size_t length,
                                          NumberParsingOptions options,
                                          bool* ok) {}

unsigned CharactersToUInt(const LChar* data,
                          size_t length,
                          NumberParsingOptions options,
                          NumberParsingResult* result) {}

unsigned CharactersToUInt(const UChar* data,
                          size_t length,
                          NumberParsingOptions options,
                          NumberParsingResult* result) {}

unsigned HexCharactersToUInt(const LChar* data,
                             size_t length,
                             NumberParsingOptions options,
                             bool* ok) {}

unsigned HexCharactersToUInt(const UChar* data,
                             size_t length,
                             NumberParsingOptions options,
                             bool* ok) {}

uint64_t HexCharactersToUInt64(const LChar* data,
                               size_t length,
                               NumberParsingOptions options,
                               bool* ok) {}

uint64_t HexCharactersToUInt64(const UChar* data,
                               size_t length,
                               NumberParsingOptions options,
                               bool* ok) {}

int CharactersToInt(const LChar* data,
                    size_t length,
                    NumberParsingOptions options,
                    bool* ok) {}

int CharactersToInt(const UChar* data,
                    size_t length,
                    NumberParsingOptions options,
                    bool* ok) {}

int CharactersToInt(const StringView& string,
                    NumberParsingOptions options,
                    bool* ok) {}

unsigned CharactersToUInt(const LChar* data,
                          size_t length,
                          NumberParsingOptions options,
                          bool* ok) {}

unsigned CharactersToUInt(const UChar* data,
                          size_t length,
                          NumberParsingOptions options,
                          bool* ok) {}

int64_t CharactersToInt64(const LChar* data,
                          size_t length,
                          NumberParsingOptions options,
                          bool* ok) {}

int64_t CharactersToInt64(const UChar* data,
                          size_t length,
                          NumberParsingOptions options,
                          bool* ok) {}

uint64_t CharactersToUInt64(const LChar* data,
                            size_t length,
                            NumberParsingOptions options,
                            bool* ok) {}

uint64_t CharactersToUInt64(const UChar* data,
                            size_t length,
                            NumberParsingOptions options,
                            bool* ok) {}

enum TrailingJunkPolicy {};

template <typename CharType, TrailingJunkPolicy policy>
static inline double ToDoubleType(const CharType* data,
                                  size_t length,
                                  bool* ok,
                                  size_t& parsed_length) {}

double CharactersToDouble(const LChar* data, size_t length, bool* ok) {}

double CharactersToDouble(const UChar* data, size_t length, bool* ok) {}

double CharactersToDouble(const LChar* data,
                          size_t length,
                          size_t& parsed_length) {}

double CharactersToDouble(const UChar* data,
                          size_t length,
                          size_t& parsed_length) {}

float CharactersToFloat(const LChar* data, size_t length, bool* ok) {}

float CharactersToFloat(const UChar* data, size_t length, bool* ok) {}

float CharactersToFloat(const LChar* data,
                        size_t length,
                        size_t& parsed_length) {}

float CharactersToFloat(const UChar* data,
                        size_t length,
                        size_t& parsed_length) {}

}  // namespace WTF