| Index: net/base/parse_number.h
|
| diff --git a/net/base/parse_number.h b/net/base/parse_number.h
|
| index 0b88cf0435b3af69d1330c33d07acdbc11c60e52..2be434c73cf7e7047d759c7b2887085cacafe765 100644
|
| --- a/net/base/parse_number.h
|
| +++ b/net/base/parse_number.h
|
| @@ -34,34 +34,80 @@ class GURL;
|
|
|
| namespace net {
|
|
|
| -// Parses a string representing a decimal number to an |int|. Returns true on
|
| -// success, and fills |*output| with the result. Note that |*output| is not
|
| -// modified on failure.
|
| +// ParseNonNegativeInteger() parses a string representing a decimal number.
|
| +// Returns true on success, and fills |*output| with the result:
|
| //
|
| -// Recognized inputs take the form:
|
| +// ParseNonNegativeInteger() recognizes inputs of the form:
|
| // 1*DIGIT
|
| //
|
| -// Where DIGIT is an ASCII number in the range '0' - '9'
|
| +// Where DIGIT is an ASCII number in the range '0' - '9'
|
| //
|
| -// Note that:
|
| +// Note that:
|
| // * Parsing is locale independent
|
| +// * |*output| is not modified on failure
|
| // * Leading zeros are allowed (numbers needn't be in minimal encoding)
|
| -// * Inputs that would overflow the output are rejected.
|
| -// * Only accepts integers
|
| +// * Inputs that would overflow the output type are rejected
|
| +// * ParseNonNegativeInteger() has overloads for a variety of output
|
| +// types. Regardless of the output type's signedness, the output is NEVER
|
| +// negative on success.
|
| //
|
| -// Examples of recognized inputs are:
|
| +// Examples of accepted inputs are:
|
| // "13"
|
| // "0"
|
| // "00013"
|
| //
|
| -// Examples of rejected inputs are:
|
| +// Examples of rejected inputs are:
|
| // " 13"
|
| // "-13"
|
| // "+13"
|
| // "0x15"
|
| // "13.3"
|
| -NET_EXPORT bool ParseNonNegativeDecimalInt(const base::StringPiece& input,
|
| - int* output) WARN_UNUSED_RESULT;
|
| +// "999999999999999999999999999999999999999999999"
|
| +NET_EXPORT bool ParseNonNegativeInteger(const base::StringPiece& input,
|
| + int32_t* output) WARN_UNUSED_RESULT;
|
| +
|
| +NET_EXPORT bool ParseNonNegativeInteger(const base::StringPiece& input,
|
| + uint32_t* output) WARN_UNUSED_RESULT;
|
| +
|
| +NET_EXPORT bool ParseNonNegativeInteger(const base::StringPiece& input,
|
| + int64_t* output) WARN_UNUSED_RESULT;
|
| +
|
| +NET_EXPORT bool ParseNonNegativeInteger(const base::StringPiece& input,
|
| + uint64_t* output) WARN_UNUSED_RESULT;
|
| +
|
| +// ParseSignedInteger() parses a string representing a decimal number.
|
| +// Returns true on success, and fills |*output| with the result:
|
| +//
|
| +// ParseSignedInteger() recognizes inputs of the form:
|
| +// ("" | "-") 1*DIGIT
|
| +//
|
| +// Where DIGIT is an ASCII number in the range '0' - '9'
|
| +//
|
| +// Note that:
|
| +// * Parsing is locale independent
|
| +// * |*output| is not modified on failure
|
| +// * Leading zeros are allowed (numbers needn't be in minimal encoding)
|
| +// * Zero can be expressed as a negative or positive quantity.
|
| +// * Inputs that would overflow/underflow the output type are rejected
|
| +//
|
| +// Examples of accepted inputs are:
|
| +// "13"
|
| +// "-13"
|
| +// "0"
|
| +// "-0"
|
| +// "00013"
|
| +//
|
| +// Examples of rejected inputs are:
|
| +// " 13"
|
| +// "+13"
|
| +// "0x15"
|
| +// "13.3"
|
| +// "999999999999999999999999999999999999999999999"
|
| +NET_EXPORT bool ParseSignedInteger(const base::StringPiece& input,
|
| + int64_t* output) WARN_UNUSED_RESULT;
|
| +
|
| +NET_EXPORT bool ParseSignedInteger(const base::StringPiece& input,
|
| + int32_t* output) WARN_UNUSED_RESULT;
|
|
|
| } // namespace net
|
|
|
|
|