chromium/third_party/crashpad/crashpad/util/stdlib/string_number_conversion.cc

// Copyright 2014 The Crashpad Authors
//
// 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 "util/stdlib/string_number_conversion.h"

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

#include <limits>

#include "base/strings/string_util.h"

namespace {

template <typename TIntType, typename TLongType>
struct StringToIntegerTraits {};

template <typename TIntType, typename TLongType>
struct StringToSignedIntegerTraits
    : public StringToIntegerTraits<TIntType, TLongType> {};

template <typename TIntType, typename TLongType>
struct StringToUnsignedIntegerTraits
    : public StringToIntegerTraits<TIntType, TLongType> {};

struct StringToIntTraits : public StringToSignedIntegerTraits<int, long> {};

struct StringToUnsignedIntTraits
    : public StringToUnsignedIntegerTraits<unsigned int, unsigned long> {};

struct StringToLongTraits
    : public StringToSignedIntegerTraits<long, long long> {};

struct StringToUnsignedLongTraits
    : public StringToUnsignedIntegerTraits<unsigned long, unsigned long long> {};

struct StringToLongLongTraits
    : public StringToSignedIntegerTraits<long long, long long> {};

struct StringToUnsignedLongLongTraits
    : public StringToUnsignedIntegerTraits<unsigned long long,
                                           unsigned long long> {};

template <typename Traits>
bool StringToIntegerInternal(const std::string& string,
                             typename Traits::IntType* number) {}

}  // namespace

namespace crashpad {

bool StringToNumber(const std::string& string, int* number) {}

bool StringToNumber(const std::string& string, unsigned int* number) {}

bool StringToNumber(const std::string& string, long* number) {}

bool StringToNumber(const std::string& string, unsigned long* number) {}

bool StringToNumber(const std::string& string, long long* number) {}

bool StringToNumber(const std::string& string, unsigned long long* number) {}

}  // namespace crashpad