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 "base/base_export.h" 9 #include "base/strings/string_piece.h" 10 #include "third_party/abseil-cpp/absl/numeric/int128.h" 11 12 namespace base { 13 14 // Best effort conversion, see `base::StringToInt()` for restrictions. 15 // Will only successfully parse values that will fit into `output`. 16 BASE_EXPORT bool StringToUint128(StringPiece input, absl::uint128* output); 17 18 // Best effort conversion, see `base::StringToInt()` for restrictions. 19 // Will only successfully parse hex values that will fit into `output`. 20 // The string is not required to start with 0x. 21 BASE_EXPORT bool HexStringToUInt128(StringPiece input, absl::uint128* output); 22 23 } // namespace base 24 25 #endif // BASE_STRINGS_ABSEIL_STRING_NUMBER_CONVERSIONS_H_ 26