diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-03 14:39:42 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-03 14:39:42 +0000 |
commit | c9c07779224d9dd320323943a569dbf2e416a411 (patch) | |
tree | a040e1ca03410c7cb37547b16b5a0fb8bea67dde /base/string_util.h | |
parent | be1ce6a7b2fa7e9622e5b249abd5fab478b6ca05 (diff) | |
download | chromium_src-c9c07779224d9dd320323943a569dbf2e416a411.zip chromium_src-c9c07779224d9dd320323943a569dbf2e416a411.tar.gz chromium_src-c9c07779224d9dd320323943a569dbf2e416a411.tar.bz2 |
Remove number conversion functions from string_util. These moved to string_number_conversions.
TEST=it compiles
BUG=none
Review URL: http://codereview.chromium.org/3054036
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54747 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/string_util.h')
-rw-r--r-- | base/string_util.h | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/base/string_util.h b/base/string_util.h index 97b5100..9edf85f 100644 --- a/base/string_util.h +++ b/base/string_util.h @@ -449,67 +449,6 @@ void ReplaceSubstringsAfterOffset(std::string* str, const std::string& find_this, const std::string& replace_with); -// Specialized string-conversion functions. -std::string IntToString(int value); -std::wstring IntToWString(int value); -string16 IntToString16(int value); -std::string UintToString(unsigned int value); -std::wstring UintToWString(unsigned int value); -string16 UintToString16(unsigned int value); -std::string Int64ToString(int64 value); -std::wstring Int64ToWString(int64 value); -std::string Uint64ToString(uint64 value); -std::wstring Uint64ToWString(uint64 value); -// The DoubleToString methods convert the double to a string format that -// ignores the locale. If you want to use locale specific formatting, use ICU. -std::string DoubleToString(double value); -std::wstring DoubleToWString(double value); - -// Perform a best-effort conversion of the input string to a numeric type, -// setting |*output| to the result of the conversion. Returns true for -// "perfect" conversions; returns false in the following cases: -// - Overflow/underflow. |*output| will be set to the maximum value supported -// by the data type. -// - Trailing characters in the string after parsing the number. |*output| -// will be set to the value of the number that was parsed. -// - 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. -bool StringToInt(const std::string& input, int* output); -bool StringToInt(const string16& input, int* output); -bool StringToInt64(const std::string& input, int64* output); -bool StringToInt64(const string16& input, int64* output); -bool HexStringToInt(const std::string& input, int* output); -bool HexStringToInt(const string16& input, 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 -// error. There is no overflow, but input.size() must be evenly divisible by 2. -// Leading 0x or +/- are not allowed. -bool HexStringToBytes(const std::string& input, std::vector<uint8>* output); -bool HexStringToBytes(const string16& input, std::vector<uint8>* 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 -// NaN and inf) is undefined. Otherwise, these behave the same as the integral -// variants. This expects the input string to NOT be specific to the locale. -// If your input is locale specific, use ICU to read the number. -bool StringToDouble(const std::string& input, double* output); -bool StringToDouble(const string16& input, double* output); - -// Convenience forms of the above, when the caller is uninterested in the -// boolean return value. These return only the |*output| value from the -// above conversions: a best-effort conversion when possible, otherwise, 0. -int StringToInt(const std::string& value); -int StringToInt(const string16& value); -int64 StringToInt64(const std::string& value); -int64 StringToInt64(const string16& value); -int HexStringToInt(const std::string& value); -int HexStringToInt(const string16& value); -double StringToDouble(const std::string& value); -double StringToDouble(const string16& value); - // Return a C++ string given printf-like input. std::string StringPrintf(const char* format, ...) PRINTF_FORMAT(1, 2); std::wstring StringPrintf(const wchar_t* format, ...) WPRINTF_FORMAT(1, 2); @@ -685,15 +624,6 @@ bool ElideString(const std::wstring& input, int max_len, std::wstring* output); bool MatchPatternWide(const std::wstring& string, const std::wstring& pattern); bool MatchPatternASCII(const std::string& string, const std::string& pattern); -// Returns a hex string representation of a binary buffer. -// The returned hex string will be in upper case. -// This function does not check if |size| is within reasonable limits since -// it's written with trusted data in mind. -// If you suspect that the data you want to format might be large, -// the absolute max size for |size| should be is -// std::numeric_limits<size_t>::max() / 2 -std::string HexEncode(const void* bytes, size_t size); - // Hack to convert any char-like type to its unsigned counterpart. // For example, it will convert char, signed char and unsigned char to unsigned // char. |