CTRE Phoenix 6 C++ 25.0.0-beta-4
|
Functions | |
CTREXPORT std::vector< std::string > | string_split (std::string const &input, char delimiter) |
Splits a string by the given delimiter. | |
CTREXPORT std::string | toLower (std::string_view input) |
Creates a new, lowercase version of the given string. | |
CTREXPORT void | makeLower (std::string &input) |
Converts the given string to lowercase in-place. | |
CTREXPORT std::string | toUpper (std::string_view input) |
Creates a new, uppercase version of the given string. | |
CTREXPORT void | makeUpper (std::string &input) |
Converts the given string to uppercase in-place. | |
CTREXPORT int | strcmp_nocase (char const *a, char const *b) |
Case-insensitive strcmp. | |
CTREXPORT uint32_t | safe_copyDoubles (double *dest, double const *src, int32_t numDoubles, int32_t capacityDoubles) |
CTREXPORT uint32_t | safe_copyDoubles (double *dest, std::vector< double > const &src, int32_t capacityDoubles) |
CTREXPORT size_t | safe_memcpy (void *dest, void const *src, size_t numBytesToCopy, size_t capacity) |
Safely copies data from the source to the destination. | |
CTREXPORT char * | safe_strcpy (char *dest, char const *src, size_t capacity) |
Safely copies a string to the destination. | |
CTREXPORT char * | safe_strcpy (char *dest, char const *src, size_t capacityDest, size_t capacitySrc) |
Safely copies a string to the destination. | |
CTREXPORT char * | safe_strcat (char *dest, char const *src, size_t capacity) |
Safely concatenates a string to the destination. | |
CTREXPORT char * | safe_strcat (char *dest, char const *src, size_t capacityDest, size_t capacitySrc) |
Safely concatenates a string to the destination. | |
CTREXPORT char * | safe_strtok (char **str_ptr, char const *delimiters) |
Safer strtok that finds and returns a pointer to the next token in *str_ptr, separated using one of the delimiters passed in. | |
CTREXPORT constexpr size_t | safe_strlen (char const *s, size_t capacity) |
Safely determines the length of a string with the given capacity. | |
template<typename T > | |
bool | toNumber (std::string const &str, T &value) |
Converts string to number while informing caller if operation was successful. | |
CTREXPORT void ctre::phoenix::string_util::makeLower | ( | std::string & | input | ) |
Converts the given string to lowercase in-place.
CTREXPORT void ctre::phoenix::string_util::makeUpper | ( | std::string & | input | ) |
Converts the given string to uppercase in-place.
CTREXPORT uint32_t ctre::phoenix::string_util::safe_copyDoubles | ( | double * | dest, |
double const * | src, | ||
int32_t | numDoubles, | ||
int32_t | capacityDoubles ) |
CTREXPORT uint32_t ctre::phoenix::string_util::safe_copyDoubles | ( | double * | dest, |
std::vector< double > const & | src, | ||
int32_t | capacityDoubles ) |
CTREXPORT size_t ctre::phoenix::string_util::safe_memcpy | ( | void * | dest, |
void const * | src, | ||
size_t | numBytesToCopy, | ||
size_t | capacity ) |
Safely copies data from the source to the destination.
At most capacity bytes will be copied.
CTREXPORT char * ctre::phoenix::string_util::safe_strcat | ( | char * | dest, |
char const * | src, | ||
size_t | capacity ) |
Safely concatenates a string to the destination.
The source will be concatenated until the destination is full, and the destination will be null-terminated.
CTREXPORT char * ctre::phoenix::string_util::safe_strcat | ( | char * | dest, |
char const * | src, | ||
size_t | capacityDest, | ||
size_t | capacitySrc ) |
Safely concatenates a string to the destination.
The source will be concatenated until the destination is full or the source capacity has been reached, and the destination will be null-terminated.
CTREXPORT char * ctre::phoenix::string_util::safe_strcpy | ( | char * | dest, |
char const * | src, | ||
size_t | capacity ) |
Safely copies a string to the destination.
The source will be copied until the destination is full, and the destination will be null-terminated.
CTREXPORT char * ctre::phoenix::string_util::safe_strcpy | ( | char * | dest, |
char const * | src, | ||
size_t | capacityDest, | ||
size_t | capacitySrc ) |
Safely copies a string to the destination.
The source will be copied until the destination is full or the source capacity has been reached, and the destination will be null-terminated.
|
constexpr |
Safely determines the length of a string with the given capacity.
CTREXPORT char * ctre::phoenix::string_util::safe_strtok | ( | char ** | str_ptr, |
char const * | delimiters ) |
Safer strtok that finds and returns a pointer to the next token in *str_ptr, separated using one of the delimiters passed in.
This also function modifies the input str_ptr to point to the remaining string after the delimiter, or NULL if none is found.
This function is similar to the POSIX strsep()
Unlike strtok, you should always pass in str_ptr. The caller must make sure both inputs are null terminated.
CTREXPORT int ctre::phoenix::string_util::strcmp_nocase | ( | char const * | a, |
char const * | b ) |
Case-insensitive strcmp.
CTREXPORT std::vector< std::string > ctre::phoenix::string_util::string_split | ( | std::string const & | input, |
char | delimiter ) |
Splits a string by the given delimiter.
CTREXPORT std::string ctre::phoenix::string_util::toLower | ( | std::string_view | input | ) |
Creates a new, lowercase version of the given string.
bool ctre::phoenix::string_util::toNumber | ( | std::string const & | str, |
T & | value ) |
Converts string to number while informing caller if operation was successful.
T | Type of number to convert to |
str | String to convert from |
value | Value of Type T to capture numeric value |
CTREXPORT std::string ctre::phoenix::string_util::toUpper | ( | std::string_view | input | ) |
Creates a new, uppercase version of the given string.