Functions
string_utilities Namespace Reference

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...
 
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...
 
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...
 
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 trimDecimalPlaces (double num)
 Trims decimal places to two. 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...
 

Detailed Description

This namespace is for the functions that encapsulate basic string manipulation and conversion techniques.

Function Documentation

◆ toDouble()

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.

Parameters
[in]stringThe string whose content should be interpreted as a floating point number
[out]valueThe double variable that should be overwritten by the floating point number found in "string"
Returns
True if all went fine, false if not

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.

Definition at line 53 of file string_utilities.cpp.

◆ toFloat()

bool string_utilities::toFloat ( const std::string &  string,
float &  value 
)

Interprets the contents of "string" as a floating point number of type float.

It stores the "string"'s value in "value" and returns whether or not all went well.

Parameters
[in]stringThe string whose content should be interpreted as a floating point number
[out]valueThe float variable that should be overwritten by the floating point number found in "string"
Returns
True if all went fine, false if not

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.

Definition at line 79 of file string_utilities.cpp.

◆ toInt32()

bool string_utilities::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.

It stores the "string"'s value in "value" and returns whether or not all went well.

Parameters
[in]stringThe string whose content should be interpreted as a floating point number
[out]valueThe int32_t variable that should be overwritten by the floating point number found in "string"
[in]baseThe conversion assumes this base, here: decimal
Returns
True if all went fine, false if not

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.

Definition at line 104 of file string_utilities.cpp.

◆ toInt8()

int8_t string_utilities::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.

It stores the "string"'s value in "value".

Parameters
[in]stringThe string whose content should be interpreted as a floating point number
[out]valueThe int8_t variable that should be overwritten by the floating point number found in "string"
[in]baseThe conversion assumes this base, here: decimal
Returns
The value found in "string"

Not used as of now..

Definition at line 163 of file string_utilities.cpp.

◆ toUInt32()

bool string_utilities::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.

It stores the "string"'s value in "value" and returns whether or not all went well.

Parameters
[in]stringThe string whose content should be interpreted as a floating point number
[out]valueThe uint32_t variable that should be overwritten by the floating point number found in "string"
[in]baseThe conversion assumes this base, here: decimal
Returns
True if all went fine, false if not

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.

Definition at line 135 of file string_utilities.cpp.

◆ toUInt8()

uint8_t string_utilities::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.

It stores the "string"'s value in "value".

Parameters
[in]stringThe string whose content should be interpreted as a floating point number
[out]valueThe uint8_t variable that should be overwritten by the floating point number found in "string"
[in]baseThe conversion assumes this base, here: decimal
Returns
The value found in "string"

Not used as of now..

Definition at line 176 of file string_utilities.cpp.

◆ trimDecimalPlaces()

std::string string_utilities::trimDecimalPlaces ( double  num)

Trims decimal places to two.

Parameters
[in]numThe double who shall be trimmed
Returns
The string

Definition at line 200 of file string_utilities.cpp.

◆ trimString()

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.

Parameters
[in]strThe string whose trailing zeros shall be removed
Returns
The trimmed string

Definition at line 186 of file string_utilities.cpp.



septentrio_gnss_driver
Author(s): Tibor Dome
autogenerated on Thu Jun 23 2022 02:11:38