HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SYS_ParseNumber.h File Reference
#include "SYS_API.h"
#include "SYS_Types.h"
+ Include dependency graph for SYS_ParseNumber.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  SYS_ParseStatus { SYS_ParseStatus::Success, SYS_ParseStatus::NoNumberFound, SYS_ParseStatus::InvalidArgs, SYS_ParseStatus::Overflow }
 List of possible states the parsing ended in. More...
 
enum  SYS_ParseFlags { SYS_ParseFlags::None = 0x00, SYS_ParseFlags::DigitSeparator = 0x01 }
 

Functions

SYS_API SYS_ParseStatus SYSparseInteger (const char *begin, const char *&end, int8 &number, int base=0, SYS_ParseFlags flags=SYS_ParseFlags::None)
 
SYS_API SYS_ParseStatus SYSparseInteger (const char *begin, const char *&end, uint8 &number, int base=0, SYS_ParseFlags flags=SYS_ParseFlags::None)
 
SYS_API SYS_ParseStatus SYSparseInteger (const char *begin, const char *&end, int16 &number, int base=0, SYS_ParseFlags flags=SYS_ParseFlags::None)
 
SYS_API SYS_ParseStatus SYSparseInteger (const char *begin, const char *&end, uint16 &number, int base=0, SYS_ParseFlags flags=SYS_ParseFlags::None)
 
SYS_API SYS_ParseStatus SYSparseInteger (const char *begin, const char *&end, int32 &number, int base=0, SYS_ParseFlags flags=SYS_ParseFlags::None)
 
SYS_API SYS_ParseStatus SYSparseInteger (const char *begin, const char *&end, uint32 &number, int base=0, SYS_ParseFlags flags=SYS_ParseFlags::None)
 
SYS_API SYS_ParseStatus SYSparseInteger (const char *begin, const char *&end, int64 &number, int base=0, SYS_ParseFlags flags=SYS_ParseFlags::None)
 
SYS_API SYS_ParseStatus SYSparseInteger (const char *begin, const char *&end, uint64 &number, int base=0, SYS_ParseFlags flags=SYS_ParseFlags::None)
 
SYS_API SYS_ParseStatus SYSparseFloat (const char *begin, const char *&end, fpreal16 &number, SYS_ParseFlags flags=SYS_ParseFlags::None)
 
SYS_API SYS_ParseStatus SYSparseFloat (const char *begin, const char *&end, fpreal32 &number, SYS_ParseFlags flags=SYS_ParseFlags::None)
 
SYS_API SYS_ParseStatus SYSparseFloat (const char *begin, const char *&end, fpreal64 &number, SYS_ParseFlags flags=SYS_ParseFlags::None)
 

Enumeration Type Documentation

enum SYS_ParseFlags
strong
Enumerator
None 

Default use.

DigitSeparator 

Allow underscore ('_') to be used as a digit separator.

Definition at line 30 of file SYS_ParseNumber.h.

enum SYS_ParseStatus
strong

List of possible states the parsing ended in.

Enumerator
Success 

A number was successfully parsed.

NoNumberFound 

No numeric characters were found. A value of zero is returned and end will be set to the value of begin.

InvalidArgs 

Invalid arguments were passed in (e.g. bad number base, invalid range).

Overflow 

Definition at line 20 of file SYS_ParseNumber.h.

Function Documentation

SYS_API SYS_ParseStatus SYSparseFloat ( const char *  begin,
const char *&  end,
fpreal16 number,
SYS_ParseFlags  flags = SYS_ParseFlags::None 
)

Parse a delimited string into a float of a certain bit size. If end is nullptr, then the string will be parsed until end. Upon return, end will point to the character after the last one parsed.

SYS_API SYS_ParseStatus SYSparseFloat ( const char *  begin,
const char *&  end,
fpreal32 number,
SYS_ParseFlags  flags = SYS_ParseFlags::None 
)

Parse a delimited string into a float of a certain bit size. If end is nullptr, then the string will be parsed until end. Upon return, end will point to the character after the last one parsed.

SYS_API SYS_ParseStatus SYSparseFloat ( const char *  begin,
const char *&  end,
fpreal64 number,
SYS_ParseFlags  flags = SYS_ParseFlags::None 
)

Parse a delimited string into a float of a certain bit size. If end is nullptr, then the string will be parsed until end. Upon return, end will point to the character after the last one parsed.

SYS_API SYS_ParseStatus SYSparseInteger ( const char *  begin,
const char *&  end,
int8 number,
int  base = 0,
SYS_ParseFlags  flags = SYS_ParseFlags::None 
)

Parse a string, delimited by begin and end , into an integer of a certain bit size. Unlike strtod and family, end should always be a valid pointer to the character one past the last character to be parsed, or nullptr. If end is nullptr, then the string will be parsed until the end of the string, which, in that case, should be zero-terminated. Upon return, end will point to the next character after the last one parsed. By default the number base is automatically determined by the number prefix (if any), although a specific base can be given to override this automatic choice. The range of supported bases is from 2 to 36, inclusive. A value of zero can be given for the function to automatically determine the base, from the prefix. In the absence of prefix the number is assumed to be decimal. Invalid base values will cause the function to return immediately with SYS_ParseStatus::InvalidArgs.

SYS_API SYS_ParseStatus SYSparseInteger ( const char *  begin,
const char *&  end,
uint8 number,
int  base = 0,
SYS_ParseFlags  flags = SYS_ParseFlags::None 
)

Parse a string, delimited by begin and end , into an integer of a certain bit size. Unlike strtod and family, end should always be a valid pointer to the character one past the last character to be parsed, or nullptr. If end is nullptr, then the string will be parsed until the end of the string, which, in that case, should be zero-terminated. Upon return, end will point to the next character after the last one parsed. By default the number base is automatically determined by the number prefix (if any), although a specific base can be given to override this automatic choice. The range of supported bases is from 2 to 36, inclusive. A value of zero can be given for the function to automatically determine the base, from the prefix. In the absence of prefix the number is assumed to be decimal. Invalid base values will cause the function to return immediately with SYS_ParseStatus::InvalidArgs.

SYS_API SYS_ParseStatus SYSparseInteger ( const char *  begin,
const char *&  end,
int16 number,
int  base = 0,
SYS_ParseFlags  flags = SYS_ParseFlags::None 
)

Parse a string, delimited by begin and end , into an integer of a certain bit size. Unlike strtod and family, end should always be a valid pointer to the character one past the last character to be parsed, or nullptr. If end is nullptr, then the string will be parsed until the end of the string, which, in that case, should be zero-terminated. Upon return, end will point to the next character after the last one parsed. By default the number base is automatically determined by the number prefix (if any), although a specific base can be given to override this automatic choice. The range of supported bases is from 2 to 36, inclusive. A value of zero can be given for the function to automatically determine the base, from the prefix. In the absence of prefix the number is assumed to be decimal. Invalid base values will cause the function to return immediately with SYS_ParseStatus::InvalidArgs.

SYS_API SYS_ParseStatus SYSparseInteger ( const char *  begin,
const char *&  end,
uint16 number,
int  base = 0,
SYS_ParseFlags  flags = SYS_ParseFlags::None 
)

Parse a string, delimited by begin and end , into an integer of a certain bit size. Unlike strtod and family, end should always be a valid pointer to the character one past the last character to be parsed, or nullptr. If end is nullptr, then the string will be parsed until the end of the string, which, in that case, should be zero-terminated. Upon return, end will point to the next character after the last one parsed. By default the number base is automatically determined by the number prefix (if any), although a specific base can be given to override this automatic choice. The range of supported bases is from 2 to 36, inclusive. A value of zero can be given for the function to automatically determine the base, from the prefix. In the absence of prefix the number is assumed to be decimal. Invalid base values will cause the function to return immediately with SYS_ParseStatus::InvalidArgs.

SYS_API SYS_ParseStatus SYSparseInteger ( const char *  begin,
const char *&  end,
int32 number,
int  base = 0,
SYS_ParseFlags  flags = SYS_ParseFlags::None 
)

Parse a string, delimited by begin and end , into an integer of a certain bit size. Unlike strtod and family, end should always be a valid pointer to the character one past the last character to be parsed, or nullptr. If end is nullptr, then the string will be parsed until the end of the string, which, in that case, should be zero-terminated. Upon return, end will point to the next character after the last one parsed. By default the number base is automatically determined by the number prefix (if any), although a specific base can be given to override this automatic choice. The range of supported bases is from 2 to 36, inclusive. A value of zero can be given for the function to automatically determine the base, from the prefix. In the absence of prefix the number is assumed to be decimal. Invalid base values will cause the function to return immediately with SYS_ParseStatus::InvalidArgs.

SYS_API SYS_ParseStatus SYSparseInteger ( const char *  begin,
const char *&  end,
uint32 number,
int  base = 0,
SYS_ParseFlags  flags = SYS_ParseFlags::None 
)

Parse a string, delimited by begin and end , into an integer of a certain bit size. Unlike strtod and family, end should always be a valid pointer to the character one past the last character to be parsed, or nullptr. If end is nullptr, then the string will be parsed until the end of the string, which, in that case, should be zero-terminated. Upon return, end will point to the next character after the last one parsed. By default the number base is automatically determined by the number prefix (if any), although a specific base can be given to override this automatic choice. The range of supported bases is from 2 to 36, inclusive. A value of zero can be given for the function to automatically determine the base, from the prefix. In the absence of prefix the number is assumed to be decimal. Invalid base values will cause the function to return immediately with SYS_ParseStatus::InvalidArgs.

SYS_API SYS_ParseStatus SYSparseInteger ( const char *  begin,
const char *&  end,
int64 number,
int  base = 0,
SYS_ParseFlags  flags = SYS_ParseFlags::None 
)

Parse a string, delimited by begin and end , into an integer of a certain bit size. Unlike strtod and family, end should always be a valid pointer to the character one past the last character to be parsed, or nullptr. If end is nullptr, then the string will be parsed until the end of the string, which, in that case, should be zero-terminated. Upon return, end will point to the next character after the last one parsed. By default the number base is automatically determined by the number prefix (if any), although a specific base can be given to override this automatic choice. The range of supported bases is from 2 to 36, inclusive. A value of zero can be given for the function to automatically determine the base, from the prefix. In the absence of prefix the number is assumed to be decimal. Invalid base values will cause the function to return immediately with SYS_ParseStatus::InvalidArgs.

SYS_API SYS_ParseStatus SYSparseInteger ( const char *  begin,
const char *&  end,
uint64 number,
int  base = 0,
SYS_ParseFlags  flags = SYS_ParseFlags::None 
)

Parse a string, delimited by begin and end , into an integer of a certain bit size. Unlike strtod and family, end should always be a valid pointer to the character one past the last character to be parsed, or nullptr. If end is nullptr, then the string will be parsed until the end of the string, which, in that case, should be zero-terminated. Upon return, end will point to the next character after the last one parsed. By default the number base is automatically determined by the number prefix (if any), although a specific base can be given to override this automatic choice. The range of supported bases is from 2 to 36, inclusive. A value of zero can be given for the function to automatically determine the base, from the prefix. In the absence of prefix the number is assumed to be decimal. Invalid base values will cause the function to return immediately with SYS_ParseStatus::InvalidArgs.