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

Side by Side Diff: base/string_number_conversions.h

Issue 9296002: Add StringToSizeT to base/string_number_conversions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: re-land Created 8 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/string_number_conversions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_STRING_NUMBER_CONVERSIONS_H_ 5 #ifndef BASE_STRING_NUMBER_CONVERSIONS_H_
6 #define BASE_STRING_NUMBER_CONVERSIONS_H_ 6 #define BASE_STRING_NUMBER_CONVERSIONS_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 BASE_EXPORT bool StringToUint(const StringPiece& input, unsigned* output); 65 BASE_EXPORT bool StringToUint(const StringPiece& input, unsigned* output);
66 BASE_EXPORT bool StringToUint(const StringPiece16& input, unsigned* output); 66 BASE_EXPORT bool StringToUint(const StringPiece16& input, unsigned* output);
67 67
68 BASE_EXPORT bool StringToInt64(const StringPiece& input, int64* output); 68 BASE_EXPORT bool StringToInt64(const StringPiece& input, int64* output);
69 BASE_EXPORT bool StringToInt64(const StringPiece16& input, int64* output); 69 BASE_EXPORT bool StringToInt64(const StringPiece16& input, int64* output);
70 70
71 BASE_EXPORT bool StringToUint64(const StringPiece& input, uint64* output); 71 BASE_EXPORT bool StringToUint64(const StringPiece& input, uint64* output);
72 BASE_EXPORT bool StringToUint64(const StringPiece16& input, uint64* output); 72 BASE_EXPORT bool StringToUint64(const StringPiece16& input, uint64* output);
73 73
74 BASE_EXPORT bool StringToSizeT(const StringPiece& input, size_t* output);
75 BASE_EXPORT bool StringToSizeT(const StringPiece16& input, size_t* output);
76
74 // For floating-point conversions, only conversions of input strings in decimal 77 // For floating-point conversions, only conversions of input strings in decimal
75 // form are defined to work. Behavior with strings representing floating-point 78 // form are defined to work. Behavior with strings representing floating-point
76 // numbers in hexadecimal, and strings representing non-fininte values (such as 79 // numbers in hexadecimal, and strings representing non-fininte values (such as
77 // NaN and inf) is undefined. Otherwise, these behave the same as the integral 80 // NaN and inf) is undefined. Otherwise, these behave the same as the integral
78 // variants. This expects the input string to NOT be specific to the locale. 81 // variants. This expects the input string to NOT be specific to the locale.
79 // If your input is locale specific, use ICU to read the number. 82 // If your input is locale specific, use ICU to read the number.
80 BASE_EXPORT bool StringToDouble(const std::string& input, double* output); 83 BASE_EXPORT bool StringToDouble(const std::string& input, double* output);
81 84
82 // Hex encoding ---------------------------------------------------------------- 85 // Hex encoding ----------------------------------------------------------------
83 86
(...skipping 12 matching lines...) Expand all
96 // |*output| will contain as many bytes as were successfully parsed prior to the 99 // |*output| will contain as many bytes as were successfully parsed prior to the
97 // error. There is no overflow, but input.size() must be evenly divisible by 2. 100 // error. There is no overflow, but input.size() must be evenly divisible by 2.
98 // Leading 0x or +/- are not allowed. 101 // Leading 0x or +/- are not allowed.
99 BASE_EXPORT bool HexStringToBytes(const std::string& input, 102 BASE_EXPORT bool HexStringToBytes(const std::string& input,
100 std::vector<uint8>* output); 103 std::vector<uint8>* output);
101 104
102 } // namespace base 105 } // namespace base
103 106
104 #endif // BASE_STRING_NUMBER_CONVERSIONS_H_ 107 #endif // BASE_STRING_NUMBER_CONVERSIONS_H_
105 108
OLDNEW
« no previous file with comments | « no previous file | base/string_number_conversions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698