ROSaic
|
Functions | |
bool | toDouble (const std::string &string, double &value) |
Interprets the contents of "string" as a floating point number of type double It stores the "string"'s value in "value" and returns whether or not all went well. More... | |
bool | toFloat (const std::string &string, float &value) |
Interprets the contents of "string" as a floating point number of type float. More... | |
bool | toInt32 (const std::string &string, int32_t &value, int32_t base=10) |
Interprets the contents of "string" as a floating point number of whatever integer type your system has that is exactly 32 bits. More... | |
bool | toUInt32 (const std::string &string, uint32_t &value, int32_t base=10) |
Interprets the contents of "string" as a floating point number of whatever unsigned integer type your system has that is exactly 32 bits. More... | |
int8_t | toInt8 (const std::string &string, int8_t &value, int32_t base=10) |
Interprets the contents of "string" as a floating point number of whatever integer type your system has that is exactly 8 bits. More... | |
uint8_t | toUInt8 (const std::string &string, uint8_t &value, int32_t base=10) |
Interprets the contents of "string" as a floating point number of whatever unsigned integer type your system has that is exactly 8 bits. More... | |
std::string | trimString (std::string str) |
Removes trailing zeros from a string representing a float or double except for the first zero after the decimal point. More... | |
This namespace is for the functions that encapsulate basic string manipulation and conversion techniques.
bool string_utilities::toDouble | ( | const std::string & | string, |
double & | value | ||
) |
Interprets the contents of "string" as a floating point number of type double It stores the "string"'s value in "value" and returns whether or not all went well.
It checks whether an error occurred (via errno) and whether junk characters exist within "string", and returns true if the latter two tests are negative and the string is non-empty, false otherwise.
[in] | string | The string whose content should be interpreted as a floating point number |
[out] | value | The double variable that should be overwritten by the floating point number found in "string" |
Definition at line 51 of file string_utilities.cpp.
Referenced by GpggaParser::parseASCII(), GprmcParser::parseASCII(), parsing_utilities::parseDouble(), and io_comm_rx::timestampSBF().
bool string_utilities::toFloat | ( | const std::string & | string, |
float & | value | ||
) |
Interprets the contents of "string" as a floating point number of type float.
It checks whether an error occurred (via errno) and whether junk characters exist within "string", and returns true if the latter two tests are negative and the string is non-empty, false otherwise.
It stores the "string"'s value in "value" and returns whether or not all went well.
[in] | string | The string whose content should be interpreted as a floating point number |
[out] | value | The float variable that should be overwritten by the floating point number found in "string" |
Definition at line 77 of file string_utilities.cpp.
Referenced by parsing_utilities::parseFloat().
bool string_utilities::toInt32 | ( | const std::string & | string, |
int32_t & | value, | ||
int32_t | base | ||
) |
Interprets the contents of "string" as a floating point number of whatever integer type your system has that is exactly 32 bits.
It checks whether an error occurred (via errno) and whether junk characters exist within "string", and returns true if the latter two tests are negative and the string is non-empty, false otherwise.
It stores the "string"'s value in "value" and returns whether or not all went well.
[in] | string | The string whose content should be interpreted as a floating point number |
[out] | value | The int32_t variable that should be overwritten by the floating point number found in "string" |
Definition at line 102 of file string_utilities.cpp.
Referenced by parsing_utilities::parseInt16(), and parsing_utilities::parseInt32().
int8_t string_utilities::toInt8 | ( | const std::string & | string, |
int8_t & | value, | ||
int32_t | base | ||
) |
Interprets the contents of "string" as a floating point number of whatever integer type your system has that is exactly 8 bits.
Not used as of now..
It stores the "string"'s value in "value".
[in] | string | The string whose content should be interpreted as a floating point number |
[out] | value | The int8_t variable that should be overwritten by the floating point number found in "string" |
Definition at line 161 of file string_utilities.cpp.
bool string_utilities::toUInt32 | ( | const std::string & | string, |
uint32_t & | value, | ||
int32_t | base | ||
) |
Interprets the contents of "string" as a floating point number of whatever unsigned integer type your system has that is exactly 32 bits.
It checks whether an error occurred (via errno) and whether junk characters exist within "string", and returns true if the latter two tests are negative and the string is non-empty, false otherwise.
It stores the "string"'s value in "value" and returns whether or not all went well.
[in] | string | The string whose content should be interpreted as a floating point number |
[out] | value | The uint32_t variable that should be overwritten by the floating point number found in "string" |
Definition at line 133 of file string_utilities.cpp.
Referenced by parsing_utilities::parseUInt16(), parsing_utilities::parseUInt32(), and parsing_utilities::parseUInt8().
uint8_t string_utilities::toUInt8 | ( | const std::string & | string, |
uint8_t & | value, | ||
int32_t | base | ||
) |
Interprets the contents of "string" as a floating point number of whatever unsigned integer type your system has that is exactly 8 bits.
Not used as of now..
It stores the "string"'s value in "value".
[in] | string | The string whose content should be interpreted as a floating point number |
[out] | value | The uint8_t variable that should be overwritten by the floating point number found in "string" |
Definition at line 174 of file string_utilities.cpp.
std::string string_utilities::trimString | ( | std::string | str | ) |
Removes trailing zeros from a string representing a float or double except for the first zero after the decimal point.
[in] | str | The string whose trailing zeros shall be removed |
Definition at line 184 of file string_utilities.cpp.
Referenced by rosaic_node::ROSaicNode::configureRx().