abseil_string_number_conversions.h 1002 B

12345678910111213141516171819202122232425
  1. // Copyright 2022 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef BASE_STRINGS_ABSEIL_STRING_NUMBER_CONVERSIONS_H_
  5. #define BASE_STRINGS_ABSEIL_STRING_NUMBER_CONVERSIONS_H_
  6. #include "base/base_export.h"
  7. #include "base/strings/string_piece_forward.h"
  8. #include "third_party/abseil-cpp/absl/numeric/int128.h"
  9. namespace base {
  10. // Best effort conversion, see `base::StringToInt()` for restrictions.
  11. // Will only successfully parse values that will fit into `output`.
  12. BASE_EXPORT bool StringToUint128(StringPiece input, absl::uint128* output);
  13. // Best effort conversion, see `base::StringToInt()` for restrictions.
  14. // Will only successfully parse hex values that will fit into `output`.
  15. // The string is not required to start with 0x.
  16. BASE_EXPORT bool HexStringToUInt128(StringPiece input, absl::uint128* output);
  17. } // namespace base
  18. #endif // BASE_STRINGS_ABSEIL_STRING_NUMBER_CONVERSIONS_H_