diff options
Diffstat (limited to 'src/mongo/base/parse_number.h')
-rw-r--r-- | src/mongo/base/parse_number.h | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/src/mongo/base/parse_number.h b/src/mongo/base/parse_number.h index f5729eac840..8d156c177b9 100644 --- a/src/mongo/base/parse_number.h +++ b/src/mongo/base/parse_number.h @@ -37,29 +37,30 @@ namespace mongo { - /** - * Parses a number out of a StringData. - * - * Parses "stringValue", interpreting it as a number of the given "base". On success, stores - * the parsed value into "*result" and returns Status::OK(). - * - * Valid values for "base" are 2-36, with 0 meaning "choose the base by inspecting the prefix - * on the number", as in strtol. Returns Status::BadValue if an illegal value is supplied for - * "base". - * - * The entirety of the std::string must consist of digits in the given base, except optionally the - * first character may be "+" or "-", and hexadecimal numbers may begin "0x". Same as strtol, - * without the property of stripping whitespace at the beginning, and fails to parse if there - * are non-digit characters at the end of the string. - * - * See parse_number.cpp for the available instantiations, and add any new instantiations there. - */ - template <typename NumberType> - MONGO_CLIENT_API Status parseNumberFromStringWithBase(const StringData& stringValue, int base, NumberType* result); +/** + * Parses a number out of a StringData. + * + * Parses "stringValue", interpreting it as a number of the given "base". On success, stores + * the parsed value into "*result" and returns Status::OK(). + * + * Valid values for "base" are 2-36, with 0 meaning "choose the base by inspecting the prefix + * on the number", as in strtol. Returns Status::BadValue if an illegal value is supplied for + * "base". + * + * The entirety of the std::string must consist of digits in the given base, except optionally the + * first character may be "+" or "-", and hexadecimal numbers may begin "0x". Same as strtol, + * without the property of stripping whitespace at the beginning, and fails to parse if there + * are non-digit characters at the end of the string. + * + * See parse_number.cpp for the available instantiations, and add any new instantiations there. + */ +template <typename NumberType> +MONGO_CLIENT_API Status +parseNumberFromStringWithBase(const StringData& stringValue, int base, NumberType* result); - template <typename NumberType> - static Status parseNumberFromString(const StringData& stringValue, NumberType* result) { - return parseNumberFromStringWithBase(stringValue, 0, result); - } +template <typename NumberType> +static Status parseNumberFromString(const StringData& stringValue, NumberType* result) { + return parseNumberFromStringWithBase(stringValue, 0, result); +} } // namespace mongo |