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

Unified Diff: base/string_number_conversions.h

Issue 8984007: Revert 114929 - Standardize StringToInt{,64} interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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/mac/mac_util.mm ('k') | base/string_number_conversions.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/string_number_conversions.h
===================================================================
--- base/string_number_conversions.h (revision 114929)
+++ base/string_number_conversions.h (working copy)
@@ -10,7 +10,6 @@
#include "base/base_export.h"
#include "base/basictypes.h"
-#include "base/string_piece.h"
#include "base/string16.h"
// ----------------------------------------------------------------------------
@@ -59,11 +58,33 @@
// - No characters parseable as a number at the beginning of the string.
// |*output| will be set to 0.
// - Empty string. |*output| will be set to 0.
-BASE_EXPORT bool StringToInt(const StringPiece& input, int* output);
-BASE_EXPORT bool StringToInt(const StringPiece16& input, int* output);
-BASE_EXPORT bool StringToInt64(const StringPiece& input, int64* output);
-BASE_EXPORT bool StringToInt64(const StringPiece16& input, int64* output);
+BASE_EXPORT bool StringToInt(const std::string& input, int* output);
+BASE_EXPORT bool StringToInt(std::string::const_iterator begin,
+ std::string::const_iterator end,
+ int* output);
+BASE_EXPORT bool StringToInt(const char* begin, const char* end, int* output);
+BASE_EXPORT bool StringToInt(const string16& input, int* output);
+BASE_EXPORT bool StringToInt(string16::const_iterator begin,
+ string16::const_iterator end,
+ int* output);
+BASE_EXPORT bool StringToInt(const char16* begin, const char16* end,
+ int* output);
+
+BASE_EXPORT bool StringToInt64(const std::string& input, int64* output);
+BASE_EXPORT bool StringToInt64(std::string::const_iterator begin,
+ std::string::const_iterator end,
+ int64* output);
+BASE_EXPORT bool StringToInt64(const char* begin, const char* end,
+ int64* output);
+
+BASE_EXPORT bool StringToInt64(const string16& input, int64* output);
+BASE_EXPORT bool StringToInt64(string16::const_iterator begin,
+ string16::const_iterator end,
+ int64* output);
+BASE_EXPORT bool StringToInt64(const char16* begin, const char16* end,
+ int64* output);
+
// For floating-point conversions, only conversions of input strings in decimal
// form are defined to work. Behavior with strings representing floating-point
// numbers in hexadecimal, and strings representing non-fininte values (such as
@@ -83,7 +104,12 @@
BASE_EXPORT std::string HexEncode(const void* bytes, size_t size);
// Best effort conversion, see StringToInt above for restrictions.
-BASE_EXPORT bool HexStringToInt(const StringPiece& input, int* output);
+BASE_EXPORT bool HexStringToInt(const std::string& input, int* output);
+BASE_EXPORT bool HexStringToInt(std::string::const_iterator begin,
+ std::string::const_iterator end,
+ int* output);
+BASE_EXPORT bool HexStringToInt(const char* begin, const char* end,
+ int* output);
// Similar to the previous functions, except that output is a vector of bytes.
// |*output| will contain as many bytes as were successfully parsed prior to the
« no previous file with comments | « base/mac/mac_util.mm ('k') | base/string_number_conversions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698