Index: base/strings/string_number_conversions.cc |
diff --git a/base/strings/string_number_conversions.cc b/base/strings/string_number_conversions.cc |
index bad7c2b0e5f97dc24f3430901c0b3fb06b72773d..fadc81a186f6631a5e5226e49a1e11b969ec2f70 100644 |
--- a/base/strings/string_number_conversions.cc |
+++ b/base/strings/string_number_conversions.cc |
@@ -302,12 +302,20 @@ class BaseHexIteratorRangeToInt64Traits |
: public BaseIteratorRangeToNumberTraits<ITERATOR, int64, 16> { |
}; |
+template<typename ITERATOR> |
+class BaseHexIteratorRangeToUInt64Traits |
+ : public BaseIteratorRangeToNumberTraits<ITERATOR, uint64, 16> { |
+}; |
+ |
typedef BaseHexIteratorRangeToIntTraits<StringPiece::const_iterator> |
HexIteratorRangeToIntTraits; |
typedef BaseHexIteratorRangeToInt64Traits<StringPiece::const_iterator> |
HexIteratorRangeToInt64Traits; |
+typedef BaseHexIteratorRangeToUInt64Traits<StringPiece::const_iterator> |
+ HexIteratorRangeToUInt64Traits; |
+ |
template<typename STR> |
bool HexStringToBytesT(const STR& input, std::vector<uint8>* output) { |
DCHECK_EQ(output->size(), 0u); |
@@ -491,6 +499,11 @@ bool HexStringToInt64(const StringPiece& input, int64* output) { |
input.begin(), input.end(), output); |
} |
+bool HexStringToUInt64(const StringPiece& input, uint64* output) { |
+ return IteratorRangeToNumber<HexIteratorRangeToUInt64Traits>::Invoke( |
+ input.begin(), input.end(), output); |
+} |
+ |
bool HexStringToBytes(const std::string& input, std::vector<uint8>* output) { |
return HexStringToBytesT(input, output); |
} |