Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2204)

Unified Diff: base/strings/string_number_conversions.cc

Issue 14103008: Add support for unsigned int64 in string_number_conversions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/strings/string_number_conversions.h ('k') | base/strings/string_number_conversions_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « base/strings/string_number_conversions.h ('k') | base/strings/string_number_conversions_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698