AceCommon
1.6.1
Arduino library for low-level common functions and features with no external dependencies
|
Provides 2 functions to perform backslash-x encoding and decoding. More...
#include <stddef.h>
#include <stdint.h>
Go to the source code of this file.
Functions | |
uint8_t | ace_common::backslashXEncode (char *t, size_t tcap, const char *s, size_t *written) |
Encode the source 's' to target string 't' with capacity 'tcap'. More... | |
uint8_t | ace_common::backslashXDecode (char *t, size_t tcap, const char *s, size_t *written) |
Decode the source 's' to target string 't' with capacity 'tcap'. More... | |
bool | ace_common::isHexChar (char c) |
Return true if 'c' is a hex character [0-9a-fA-F]. | |
Provides 2 functions to perform backslash-x encoding and decoding.
Non-printable characters are converted into \xHH
form, where HH
are hexadecimal digits. A \
is converted into \x5A
.
Definition in file backslash_x_encoding.h.
uint8_t ace_common::backslashXDecode | ( | char * | t, |
size_t | tcap, | ||
const char * | s, | ||
size_t * | written | ||
) |
Decode the source 's' to target string 't' with capacity 'tcap'.
The target 't' is always NUL-terminated. The written
parameter will be filled in with the number of actual bytes written. This can be useful for chaining multiple calls into a single buffer.
t | target c-string |
tcap | capacity of t |
s | source c-string |
written | (nullable) the number of bytes written to 't' |
\x
was not followed by 2 hex characters Definition at line 79 of file backslash_x_encoding.cpp.
uint8_t ace_common::backslashXEncode | ( | char * | t, |
size_t | tcap, | ||
const char * | s, | ||
size_t * | written | ||
) |
Encode the source 's' to target string 't' with capacity 'tcap'.
The target 't' is always NUL-terminated. The written
parameter will be filled in with the number of actual bytes written. This can be useful for chaining multiple calls into a single buffer.
t | target c-string |
tcap | capacity of t |
s | source c-string |
written | (nullable) the number of bytes written to 't' |
Definition at line 30 of file backslash_x_encoding.cpp.