• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2022 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef BASE_STRINGS_ABSEIL_STRING_NUMBER_CONVERSIONS_H_
6 #define BASE_STRINGS_ABSEIL_STRING_NUMBER_CONVERSIONS_H_
7 
8 #include <string_view>
9 
10 #include "base/base_export.h"
11 #include "third_party/abseil-cpp/absl/numeric/int128.h"
12 
13 namespace base {
14 
15 // Best effort conversion, see `base::StringToInt()` for restrictions.
16 // Will only successfully parse values that will fit into `output`.
17 BASE_EXPORT bool StringToUint128(std::string_view input, absl::uint128* output);
18 
19 // Best effort conversion, see `base::StringToInt()` for restrictions.
20 // Will only successfully parse hex values that will fit into `output`.
21 // The string is not required to start with 0x.
22 BASE_EXPORT bool HexStringToUInt128(std::string_view input,
23                                     absl::uint128* output);
24 
25 }  // namespace base
26 
27 #endif  // BASE_STRINGS_ABSEIL_STRING_NUMBER_CONVERSIONS_H_
28