#include "basicparse.h"
#include <ctype.h>
Include dependency graph for basicparse.cc:
Go to the source code of this file.
Classes | |
struct | ParsedFloatValue |
struct | ParsedIntegerValue |
Store parsed integer value. More... | |
Functions | |
template<typename T, typename UT> char * | _ParseInt (T *rv, const char *str, SError &error, bool may_continue) |
char * | ParseInt (int8 *val, const char *str, SError &error, bool may_continue) |
Read in a signed 8bit integer value. | |
char * | ParseInt (int16 *val, const char *str, SError &error, bool may_continue) |
Read in a signed 16bit integer value. | |
char * | ParseInt (int32 *val, const char *str, SError &error, bool may_continue) |
Read in a signed 32bit integer value. | |
char * | ParseInt (int64 *val, const char *str, SError &error, bool may_continue) |
Read in a signed 64bit integer value. | |
template<typename UT> char * | _ParseUInt (UT *rv, const char *str, SError &error, bool may_continue) |
char * | ParseInt (uint8 *val, const char *str, SError &error, bool may_continue) |
Read in an unsigned 8bit integer value. | |
char * | ParseInt (uint16 *val, const char *str, SError &error, bool may_continue) |
Read in an unsigned 16bit integer value. | |
char * | ParseInt (uint32 *val, const char *str, SError &error, bool may_continue) |
Read in an unsigned 32bit integer value. | |
char * | ParseInt (uint64 *val, const char *str, SError &error, bool may_continue) |
Read in an unsigned 64bit integer value. | |
int | _Str2FP (dbl *rv, const char *str, char **end) |
int | _Str2FP (flt *rv, const char *str, char **end) |
template<typename F> char * | _ParseFloat (F *val, const char *str, SError &error, bool may_continue) |
char * | ParseFloat (flt *val, const char *str, SError &error, bool may_continue) |
Read in an flt (float) floating point value. | |
char * | ParseFloat (dbl *val, const char *str, SError &error, bool may_continue) |
Read in a dbl (double) floating point value. | |
int | ParseIntegerSpec (const char *str, ParsedIntegerValue *si, SError &error) |
Read in C-like integer specification. | |
char | ParseCharacterSpec (const char *str, SError &error) |
Read in the C-like character specification. | |
int | ParseFloatSpec (const char *str, ParsedFloatValue *sf, SError &error) |
Read in floating point value. |
|
Definition at line 306 of file basicparse.cc. References _Str2FP(), and TLString::sprintf(). |
|
Definition at line 32 of file basicparse.cc. References Assert, SError::clear(), SError::msg(), TLString::prepend(), and TLString::sprintf(). |
|
Definition at line 174 of file basicparse.cc. References Assert, SError::clear(), SError::msg(), TLString::prepend(), and TLString::sprintf(). |
|
Definition at line 299 of file basicparse.cc. References flt. Referenced by _ParseFloat(). |
|
Definition at line 297 of file basicparse.cc. References dbl. |
|
Read in the C-like character specification. The input is a NUL-terminated string of the form 'CHAR' where CHAR is what a character can usually be, i.e.
Definition at line 412 of file basicparse.cc. |
|
Read in a dbl (double) floating point value.
The input is a NUL-terminated string in str. The parsed float is stored in *val (overloaded allowing the compiler to select the correct version itself). Errors: Out of range or (in case may_continue is not set) if not the whole input was a valid floating point value.
Definition at line 327 of file basicparse.cc. |
|
Read in an flt (float) floating point value.
Definition at line 325 of file basicparse.cc. |
|
Read in floating point value. The passed NUL-terminated string is a floating point value of the usual form (i.e. with or without decimal point, optional exponent separated by "e" or "E", optional sign for either). The floating point value can have the prefix "f" or "F" signalling 4-byte flt instead of standard 8-byte dbl. The parsed value is stored in the passed *sf structure.
Errors (e.g. overflow) are stored in the passed SError object. FIXME
Definition at line 441 of file basicparse.cc. References SError::AppendMsg(), dbl, ParsedFloatValue::dval, flt, ParsedFloatValue::fval, ParseFloat(), and ParsedFloatValue::size. |
|
Read in an unsigned 64bit integer value.
Definition at line 290 of file basicparse.cc. References uint64. |
|
Read in an unsigned 32bit integer value.
For more information, see ParseInt() for signed 32bit integers. Definition at line 287 of file basicparse.cc. |
|
Read in an unsigned 16bit integer value.
Definition at line 284 of file basicparse.cc. |
|
Read in an unsigned 8bit integer value.
Definition at line 281 of file basicparse.cc. |
|
Read in a signed 64bit integer value.
Definition at line 165 of file basicparse.cc. |
|
Read in a signed 32bit integer value.
The passed string is a standard NUL-terminated string. The parsing is done as follows:
In case an over/underflow occurs, the largest/smallest value representable by the type is returned and the overflow error is set in the passed SError. Definition at line 162 of file basicparse.cc. |
|
Read in a signed 16bit integer value.
Definition at line 159 of file basicparse.cc. |
|
Read in a signed 8bit integer value.
Definition at line 156 of file basicparse.cc. |
|
Read in C-like integer specification. The passed string is a NUL-teminated string containing an integer spec consisting of an optional sign ("+" or "-"), the actual integer value and (any number of) the following optional postfixes:
The actual integer can be specified either decimal, or octal with "0" prefix, or hexadecimal with "0x" prefix. Hex digits a-f are case insensitive. [allow binary "0b" as well?] In case a size postfix is specified (b,s,i or l), over- and underflow is handeled "correctly" for that size, i.e. -1US yields 65535 and 0x12345S is 0x2345. In case a value without "u" postfix is larger than the domain but will fit into the unsigned domain of the same size, (e.g. 0x8000S), it is parsed like an unsigned value and then si->unsig is set to 1. For explicitly "u" specified unsigned values, si->unsig is set to 2; all other values are considered signed and have si->unsig=0. In case a value is specified without size specification, the smallest size which fits the type is assumed:
Return value is 0 on success, != on error. The error details are stored in the passed SError object.
Definition at line 393 of file basicparse.cc. |