OS  v7.3.3
Documentation
Loading...
Searching...
No Matches
qioutils.h
1
8#ifndef QIOUTILS_H
9 #define QIOUTILS_H
10
11 #include "qtypes.h"
12 #include "qedgecheck.h"
13
14 #include <string.h>
15 #include <ctype.h>
16
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20
21
22 #ifndef Q_MAX_FTOA_PRECISION
23 #define Q_MAX_FTOA_PRECISION ( 10U )
24 #endif
25
26 #ifndef Q_ATOF_FULL
27 #define Q_ATOF_FULL ( 0 )
28 #endif
29
30 #define Q_IO_UTIL_MAX_STRLEN ( (size_t)512U )
31
52 typedef void (*qPutChar_t)( void* arg1,
53 const char arg2 );
54
55
79 typedef char (*qIOFcn_t)( void *arg1,
80 const char arg2 );
81
82
96 char* qIOUtil_StrChr( const char *s,
97 int c,
98 size_t maxlen );
99
113 size_t qIOUtil_StrLen( const char* s,
114 size_t maxlen);
115
125 size_t qIOUtil_StrlCpy( char * dst,
126 const char * src,
127 size_t maxlen );
128
145 size_t qIOUtil_StrlCat( char *dst,
146 const char *src,
147 size_t maxlen );
148
155 qBool_t qIOUtil_SwapBytes( void *pData,
156 const size_t n );
157
163
173 void* pStorage,
174 const char *s,
175 qBool_t AIP );
176
186 void* pStorage,
187 void *pData,
188 size_t n );
189
200 void* pStorage,
201 void *pData,
202 const size_t n,
203 qBool_t aip );
204
215 void* pStorage,
216 void *pData,
217 const size_t n,
218 qBool_t aip );
219
227 #define qIOUtil_PrintString( fcn, pStorage, s ) \
228 qIOUtil_OutputString( (fcn), \
229 (void*)(pStorage), \
230 (const char *)(s), \
231 qFalse ) \
232
241 #define qIOUtil_PrintRaw( fcn, pStorage, Data, n ) \
242 qIOUtil_OutputRaw( (fcn), \
243 (void*)(pStorage), \
244 (void*)(Data), \
245 (n), \
246 qFalse ) \
247
259 char* qIOUtil_U32toX( qUINT32_t value,
260 char *str,
261 qINT8_t n );
262
272 qUINT32_t qIOUtil_XtoU32( const char *s );
273
292 qFloat64_t qIOUtil_AtoF( const char *s );
293
304 char* qIOUtil_FtoA( qFloat32_t num,
305 char *str,
306 qUINT8_t precision );
307
328 int qIOUtil_AtoI( const char *s );
329
345 char* qIOUtil_UtoA( qUINT32_t num,
346 char* str,
347 qUINT8_t base );
348
368 char* qIOUtil_ItoA( qINT32_t num,
369 char* str,
370 qUINT8_t base );
371
382 char* qIOUtil_BtoA( const qBool_t num,
383 char *str );
384
395 char* qIOUtil_QBtoA( const qBool_t num,
396 char *str );
397
400 #ifdef __cplusplus
401 }
402 #endif
403
404#endif
char(* qIOFcn_t)(void *arg1, const char arg2)
Pointer to function that perform a single character I/O operation.
Definition qioutils.h:79
char * qIOUtil_StrChr(const char *s, int c, size_t maxlen)
Returns a pointer to the first occurrence of character in the C string s. The terminating null-charac...
Definition qioutils.c:60
size_t qIOUtil_StrLen(const char *s, size_t maxlen)
Returns the length of the given null-terminated byte string, that is, the number of characters in a c...
Definition qioutils.c:81
int qIOUtil_AtoI(const char *s)
Parses the C-string s interpreting its content as an integral number, which is returned as a value of...
Definition qioutils.c:500
qBool_t qIOUtil_PrintXData(qPutChar_t fcn, void *pStorage, void *pData, size_t n)
API interface to write data in HEX notation through fcn.
Definition qioutils.c:247
char * qIOUtil_BtoA(const qBool_t num, char *str)
Converts a boolean value to a null-terminated string. Input is considered true with any value differe...
Definition qioutils.c:562
qBool_t qIOUtil_OutputString(qPutChar_t fcn, void *pStorage, const char *s, qBool_t AIP)
API interface to write a string through fcn.
Definition qioutils.c:215
qBool_t qIOUtil_InputRaw(const qIOFcn_t iFcn, void *pStorage, void *pData, const size_t n, qBool_t aip)
API interface to get n RAW data through fcn.
Definition qioutils.c:323
qBool_t qIOUtil_CheckEndianness(void)
Check the system endianess.
Definition qioutils.c:208
char * qIOUtil_ItoA(qINT32_t num, char *str, qUINT8_t base)
Converts an integer value to a null-terminated string using the specified base and stores the result ...
Definition qioutils.c:539
size_t qIOUtil_StrlCpy(char *dst, const char *src, size_t maxlen)
Copies up to (maxlen - 1) characters from the null-terminated string src to dst, null-terminating the...
Definition qioutils.c:101
void(* qPutChar_t)(void *arg1, const char arg2)
Pointer to function that write-out a single character.
Definition qioutils.h:52
size_t qIOUtil_StrlCat(char *dst, const char *src, size_t maxlen)
appends no more than maxlen−len(dst)−1 characters pointed to by src into the array pointed to by dst ...
Definition qioutils.c:121
char * qIOUtil_QBtoA(const qBool_t num, char *str)
Converts a qBool_t value to a null-terminated string. Input is considered true with any value differe...
Definition qioutils.c:570
qBool_t qIOUtil_SwapBytes(void *pData, const size_t n)
Invert the endianess for n bytes of the specified memory location.
Definition qioutils.c:182
char * qIOUtil_U32toX(qUINT32_t value, char *str, qINT8_t n)
Converts an unsigned integer value to a null-terminated string using the 16 base and stores the resul...
Definition qioutils.c:333
qFloat64_t qIOUtil_AtoF(const char *s)
Parses the C string s, interpreting its content as a floating point number and returns its value as a...
Definition qioutils.c:384
qUINT32_t qIOUtil_XtoU32(const char *s)
Converts the input string consisting of hexadecimal digits into an unsigned integer value....
Definition qioutils.c:354
qBool_t qIOUtil_OutputRaw(const qIOFcn_t oFcn, void *pStorage, void *pData, const size_t n, qBool_t aip)
API interface to write n RAW data through fcn.
Definition qioutils.c:314
char * qIOUtil_FtoA(qFloat32_t num, char *str, qUINT8_t precision)
Converts a float value to a formatted string.
Definition qioutils.c:448
char * qIOUtil_UtoA(qUINT32_t num, char *str, qUINT8_t base)
Converts an unsigned value to a null-terminated string using the specified base and stores the result...
Definition qioutils.c:524
double qFloat64_t
A type to instantiate a double-precision variable of 64-bits IEEE 754.
Definition qtypes.h:117
qUINT8_t qBool_t
A type to instantiate an OS boolean variable.
Definition qtypes.h:139
uint8_t qUINT8_t
Unsigned integer type with width of exactly 8 bits respectively.
Definition qtypes.h:44
uint32_t qUINT32_t
Unsigned integer type with width of exactly 32 bits respectively.
Definition qtypes.h:48
int32_t qINT32_t
Signed integer type with width of exactly 32 bits respectively.
Definition qtypes.h:55
int8_t qINT8_t
Signed integer type with width of exactly 8 bits respectively.
Definition qtypes.h:51
float qFloat32_t
A type to instantiate a single-precision variable of 32-bits IEEE 754.
Definition qtypes.h:111