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..9f9ecbb6e2e6d778c417165acb88b6b08f7671d2 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); |
brettw
2013/04/11 18:18:15
Indent 2 more spaces.
felipeg
2013/04/12 11:41:35
Done.
|
+} |
+ |
bool HexStringToBytes(const std::string& input, std::vector<uint8>* output) { |
return HexStringToBytesT(input, output); |
} |