F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StringUtils.hpp
Go to the documentation of this file.
1 #ifndef FW_STRINGUTILS_HPP
2 #define FW_STRINGUTILS_HPP
3 #include <FpConfig.hpp>
4 
5 namespace Fw {
6 namespace StringUtils {
22 char* string_copy(char* destination, const char* source, FwSizeType num);
23 
34 FwSizeType string_length(const CHAR* source, FwSizeType buffer_size);
35 
45 FwSignedSizeType substring_find(const CHAR* source_string, FwSizeType source_size, const CHAR* sub_string, FwSizeType sub_size);
46 
54 };
55 
56 #if FW_HAS_64_BIT
82 StringToNumberStatus string_to_number(const CHAR* input, FwSizeType buffer_size, U64& output, char** next, U8 base=0);
83 
96 StringToNumberStatus string_to_number(const CHAR* input, FwSizeType buffer_size, I64& output, char** next, U8 base=0);
97 #endif
98 #if FW_HAS_32_BIT
111 StringToNumberStatus string_to_number(const CHAR* input, FwSizeType buffer_size, U32& output, char** next, U8 base=0);
112 
125 StringToNumberStatus string_to_number(const CHAR* input, FwSizeType buffer_size, I32& output, char** next, U8 base=0);
126 #endif
127 #if FW_HAS_16_BIT
140 StringToNumberStatus string_to_number(const CHAR* input, FwSizeType buffer_size, U16& output, char** next, U8 base=0);
141 
154 StringToNumberStatus string_to_number(const CHAR* input, FwSizeType buffer_size, I16& output, char** next, U8 base=0);
155 #endif
156 
169 StringToNumberStatus string_to_number(const CHAR* input, FwSizeType buffer_size, U8& output, char** next, U8 base=0);
170 
183 StringToNumberStatus string_to_number(const CHAR* input, FwSizeType buffer_size, I8& output, char** next, U8 base=0);
184 
197 StringToNumberStatus string_to_number(const CHAR* input, FwSizeType buffer_size, F32& output, char** next);
198 #if FW_HAS_F64
211 StringToNumberStatus string_to_number(const CHAR* input, FwSizeType buffer_size, F64& output, char** next);
212 #endif
213 
214 
215 
216 } // namespace StringUtils
217 } // namespace Fw
218 #endif // FW_STRINGUTILS_HPP
int8_t I8
8-bit signed integer
Definition: BasicTypes.h:29
float F32
32-bit floating point
Definition: BasicTypes.h:49
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:30
char CHAR
Definition: BasicTypes.h:32
PlatformSignedSizeType FwSignedSizeType
Definition: FpConfig.h:30
PlatformSizeType FwSizeType
Definition: FpConfig.h:35
C++-compatible configuration header for fprime configuration.
FwSizeType string_length(const CHAR *source, FwSizeType buffer_size)
get the length of the source string
Definition: StringUtils.cpp:23
@ INVALID_BASE
Base was not supplied as 0, or 2-36.
Definition: StringUtils.hpp:51
@ SUCCESSFUL_CONVERSION
Output should be valid.
Definition: StringUtils.hpp:48
@ NULL_INPUT
A null string was supplied.
Definition: StringUtils.hpp:49
@ INVALID_NUMBER
String did not contain a valid number matching supplied base.
Definition: StringUtils.hpp:52
@ INVALID_STRING
No \0 detected within the supplied length.
Definition: StringUtils.hpp:50
StringToNumberStatus string_to_number(const CHAR *input, FwSizeType buffer_size, U8 &output, char **next, U8 base=0)
converts a string to a U8
char * string_copy(char *destination, const char *source, FwSizeType num)
copy string with null-termination guaranteed
Definition: StringUtils.cpp:6
FwSignedSizeType substring_find(const CHAR *source_string, FwSizeType source_size, const CHAR *sub_string, FwSizeType sub_size)
find the first occurrence of a substring
Definition: StringUtils.cpp:34
#define U64(C)
Definition: sha.h:176