GATE
strings.h File Reference

String management, UTF conversion and basic text parsing functions. More...

#include "gate/gate_core_api.h"
#include "gate/atomics.h"
#include "gate/memalloc.h"
#include <stdarg.h>

Classes

struct  gate_stringbuffer8_class
 character (byte) string buffer class More...
 
struct  gate_strbuilder8_class
 character (byte) string builder class More...
 
struct  gate_string8_class
 character (byte) string class More...
 
struct  gate_cstrbuffer8_class
 C-string buffer class. More...
 
struct  gate_cstrbuffer16_class
 
struct  gate_cstrbuffer32_class
 
struct  gate_print_value_class
 Structure holding a pair of GATE_PRINT_* and a pointer to a target type specified by GATE_PRINT_* IDs. More...
 

Macros

#define GATE_STR_CR   "\r"
 
#define GATE_STR_LF   "\n"
 
#define GATE_STR_CRLF   "\r\n"
 
#define GATE_STR_WHITESPACES   " \t\r\n"
 
#define GATE_STR_WHITESPACES_LENGTH   4
 
#define GATE_STR_NEWLINE   "\n"
 
#define GATE_STR_NEWLINE_LENGTH   1
 
#define GATE_STR_CONST(varname, text)   char const varname[] = text
 
#define GATE_STRING_INIT(ptr_str)   { ptr_str, gate_str_length(ptr_str), NULL }
 Initializes a gate_string_t variable with a string pointer and dynamically detect string length.
 
#define GATE_STRING_INIT_EMPTY   { NULL, 0, NULL }
 Initializes a gate_string_t variable with NULL values like an empty string.
 
#define GATE_STRING_INIT_STATIC(const_text)   { const_text, sizeof(const_text) - 1, NULL }
 Initializes a gate_string_t variable with a static string literal.
 
#define GATE_STR_NPOS   GATE_INVALID_SIZE
 
#define gate_wstr_is_empty   gate_str32_is_empty
 
#define gate_wstr_comp_range   gate_str32_comp_range
 
#define gate_wstr_comp_range_ic   gate_str32_comp_range_ic
 
#define gate_wstr_to_lower   gate_str32_to_lower
 
#define gate_wstr_to_upper   gate_str32_to_upper
 
#define gate_wstr_reverse   gate_str32_reverse
 
#define gate_wstr_char_pos   gate_str32_char_pos
 
#define gate_wstr_char_pos_last   gate_str32_char_pos_last
 
#define gate_wstr_pos   gate_str32_pos
 
#define gate_wstr_length   gate_str32_length
 
#define gate_wstr_length_max   gate_str32_length_max
 
#define gate_wstr_comp   gate_str32_comp
 
#define gate_wstr_compare   gate_str32_compare
 
#define gate_wstr_comp_ic   gate_str32_comp_ic
 
#define gate_wstr_compare_ic   gate_str32_compare_ic
 
#define gate_wstr_is_numeric   gate_str32_is_numeric
 
#define gate_wstr_starts_with   gate_str32_starts_with
 
#define gate_wstr_ends_with   gate_str32_ends_with
 
#define gate_wstr_print_text   gate_str32_print_text
 
#define gate_wstr_print_int16   gate_str32_print_int16
 
#define gate_wstr_print_uint16   gate_str32_print_uint16
 
#define gate_wstr_print_int32   gate_str32_print_int32
 
#define gate_wstr_print_uint32   gate_str32_print_uint32
 
#define gate_wstr_print_int64   gate_str32_print_int64
 
#define gate_wstr_print_uint64   gate_str32_print_uint64
 
#define gate_cstr_to_wstr   gate_str_utf8_2_utf32
 
#define gate_wstr_to_cstr   gate_str_utf32_2_utf8
 
#define GATE_STR_PRINT_TEXT(destbuffer, srcbuffer)   gate_str_print_text(destbuffer, sizeof(destbuffer), srcbuffer, gate_str_length(srcbuffer))
 
#define GATE_STR_PRINT_INT16(destbuffer, num)   gate_str_print_int16(destbuffer, sizeof(destbuffer), num)
 
#define GATE_STR_PRINT_UINT16(destbuffer, num)   gate_str_print_uint16(destbuffer, sizeof(destbuffer), num)
 
#define GATE_STR_PRINT_INT32(destbuffer, num)   gate_str_print_int32(destbuffer, sizeof(destbuffer), num)
 
#define GATE_STR_PRINT_UINT32(destbuffer, num)   gate_str_print_uint32(destbuffer, sizeof(destbuffer), num)
 
#define GATE_STR_PRINT_INT64(destbuffer, num)   gate_str_print_int64(destbuffer, sizeof(destbuffer), num)
 
#define GATE_STR_PRINT_UINT64(destbuffer, num)   gate_str_print_uint64(destbuffer, sizeof(destbuffer), num)
 
#define GATE_STR_PRINT_REAL(destbuffer, num)   gate_str_print_real(destbuffer, sizeof(destbuffer), num, 0, 3, 0)
 
#define GATE_PRINT_END   ((int)0x00)
 
#define GATE_PRINT_CHAR   ((int)0x01)
 
#define GATE_PRINT_NEWLINE   ((int)0x02)
 
#define GATE_PRINT_CSTR   ((int)0x03)
 
#define GATE_PRINT_STRING   ((int)0x04)
 
#define GATE_PRINT_CR   ((int)0x05)
 
#define GATE_PRINT_LF   ((int)0x06)
 
#define GATE_PRINT_CRLF   ((int)0x07)
 
#define GATE_PRINT_BOOL   ((int)0x10)
 
#define GATE_PRINT_I8   ((int)0x11)
 
#define GATE_PRINT_UI8   ((int)0x12)
 
#define GATE_PRINT_I16   ((int)0x13)
 
#define GATE_PRINT_UI16   ((int)0x14)
 
#define GATE_PRINT_I32   ((int)0x15)
 
#define GATE_PRINT_UI32   ((int)0x16)
 
#define GATE_PRINT_I64   ((int)0x17)
 
#define GATE_PRINT_UI64   ((int)0x18)
 
#define GATE_PRINT_H8   ((int)0x1a)
 
#define GATE_PRINT_H16   ((int)0x1b)
 
#define GATE_PRINT_H32   ((int)0x1c)
 
#define GATE_PRINT_H64   ((int)0x1d)
 
#define GATE_PRINT_R32   ((int)0x21)
 
#define GATE_PRINT_R64   ((int)0x22)
 
#define GATE_PRINT_ADDRESS   ((int)0x23)
 
#define GP_END   GATE_PRINT_END
 
#define GP_CHAR   GATE_PRINT_CHAR
 
#define GP_NEWLINE   GATE_PRINT_NEWLINE
 
#define GP_CSTR   GATE_PRINT_CSTR
 
#define GP_STRING   GATE_PRINT_STRING
 
#define GP_BOOL   GATE_PRINT_BOOL
 
#define GP_I8   GATE_PRINT_I8
 
#define GP_UI8   GATE_PRINT_UI8
 
#define GP_I16   GATE_PRINT_I16
 
#define GP_UI16   GATE_PRINT_UI16
 
#define GP_I32   GATE_PRINT_I32
 
#define GP_UI32   GATE_PRINT_UI32
 
#define GP_I64   GATE_PRINT_I64
 
#define GP_UI64   GATE_PRINT_UI64
 
#define GP_H8   GATE_PRINT_H8
 
#define GP_H16   GATE_PRINT_H16
 
#define GP_H32   GATE_PRINT_H32
 
#define GP_H64   GATE_PRINT_H64
 
#define GP_R32   GATE_PRINT_R32
 
#define GP_R64   GATE_PRINT_R64
 
#define GP_ADDR   GATE_PRINT_ADDRESS
 
#define GATE_STRING_TO_BUFFER(src, dest_buffer)   gate_string_to_buffer((src), dest_buffer, sizeof(dest_buffer))
 

Typedefs

typedef struct gate_stringbuffer8_class gate_stringbuffer8_t
 character (byte) string buffer class
 
typedef gate_stringbuffer8_t gate_stringbuffer_t
 
typedef struct gate_strbuilder8_class gate_strbuilder8_t
 character (byte) string builder class
 
typedef gate_strbuilder8_t gate_strbuilder_t
 
typedef struct gate_string8_class gate_string8_t
 character (byte) string class
 
typedef gate_string8_t gate_string_t
 
typedef struct gate_cstrbuffer8_class gate_cstrbuffer8_t
 C-string buffer class.
 
typedef gate_cstrbuffer8_t gate_cstrbuffer_t
 
typedef struct gate_cstrbuffer16_class gate_cstrbuffer16_t
 
typedef struct gate_cstrbuffer32_class gate_cstrbuffer32_t
 
typedef char const * gate_cstr_t
 constant byte character string
 
typedef wchar_t const * gate_wstr_t
 constant wide character string
 
typedef gate_size_t gate_str_printer_t(void *printer_param, gate_char8_t const *data, gate_size_t datalen)
 
typedef struct gate_print_value_class gate_print_value_t
 Structure holding a pair of GATE_PRINT_* and a pointer to a target type specified by GATE_PRINT_* IDs.
 

Functions

GATE_CORE_API int gate_char_lowercase (int chr)
 Converts an ASCII character to its lower case.
 
GATE_CORE_API int gate_char_uppercase (int chr)
 Converts an ASCII character to its upper case.
 
GATE_CORE_API gate_bool_t gate_char_is_digit (int chr)
 Returns true, if the ASCII character is a digite '0' - '9'.
 
GATE_CORE_API gate_bool_t gate_char_is_whitespace (int chr)
 Returns true, if the ASCII character is a whitespace.
 
GATE_CORE_API gate_size_t gate_char_read_utf8 (gate_char8_t const *src, gate_size_t srclen, gate_char32_t *dst)
 Reads an UTF-8 encoded byte sequence and decodes a single unicode character.
 
GATE_CORE_API gate_size_t gate_char_read_utf16 (gate_char16_t const *src, gate_size_t srclen, gate_char32_t *dst)
 Reads an UTF-16 encoded sequence and decodes a single unicode character.
 
GATE_CORE_API gate_size_t gate_char_read_utf32 (gate_char32_t const *src, gate_size_t srclen, gate_char32_t *dst)
 Reads an UTF-32 encoded byte sequence and decodes a single unicode character.
 
GATE_CORE_API gate_size_t gate_char_write_utf8 (gate_char32_t src, gate_char8_t *dst, gate_size_t dstlen)
 Encodes one unicode character into an UTF-8 byte buffer.
 
GATE_CORE_API gate_size_t gate_char_write_utf16 (gate_char32_t src, gate_char16_t *dst, gate_size_t dstlen)
 Encodes one unicode character into an UTF-16 word buffer.
 
GATE_CORE_API gate_size_t gate_char_write_utf32 (gate_char32_t src, gate_char32_t *dst, gate_size_t dstlen)
 Encodes one unicode character into an UTF-32 word buffer.
 
GATE_CORE_API gate_size_t gate_str_utf8_2_utf16 (gate_char8_t const *src, gate_size_t srclen, gate_char16_t *dst, gate_size_t dstlen)
 Converts an UTF-8 input buffer into an UTF-16 output buffer.
 
GATE_CORE_API gate_size_t gate_str_utf8_2_utf32 (gate_char8_t const *src, gate_size_t srclen, gate_char32_t *dst, gate_size_t dstlen)
 Converts an UTF-8 input buffer into an UTF-32 output buffer.
 
GATE_CORE_API gate_size_t gate_str_utf16_2_utf8 (gate_char16_t const *src, gate_size_t srclen, gate_char8_t *dst, gate_size_t dstlen)
 Converts an UTF-16 input buffer into an UTF-8 output buffer.
 
GATE_CORE_API gate_size_t gate_str_utf16_2_utf32 (gate_char16_t const *src, gate_size_t srclen, gate_char32_t *dst, gate_size_t dstlen)
 Converts an UTF-16 input buffer into an UTF-32 output buffer.
 
GATE_CORE_API gate_size_t gate_str_utf32_2_utf8 (gate_char32_t const *src, gate_size_t srclen, gate_char8_t *dst, gate_size_t dstlen)
 Converts an UTF-32 input buffer into an UTF-8 output buffer.
 
GATE_CORE_API gate_size_t gate_str_utf32_2_utf16 (gate_char32_t const *src, gate_size_t srclen, gate_char16_t *dst, gate_size_t dstlen)
 Converts an UTF-32 input buffer into an UTF-16 output buffer.
 
GATE_CORE_API gate_size_t gate_str_length (gate_char8_t const *src)
 Returns the length of a NULL-terminated character string.
 
GATE_CORE_API gate_size_t gate_str_length_max (gate_char8_t const *src, gate_size_t capacity)
 Returns the length of a NULL-terminated character string with a limited capacity.
 
GATE_CORE_API gate_bool_t gate_str_is_empty (gate_char8_t const *src)
 Returns true if the given character string is emptry.
 
GATE_CORE_API int gate_str_comp_range (gate_char8_t const *str1, gate_char8_t const *str2, gate_size_t len)
 Compares two string ranges of equal size by their byte values.
 
GATE_CORE_API int gate_str_comp_range_ic (gate_char8_t const *str1, gate_char8_t const *str2, gate_size_t len)
 Compares two string ranges of equal size by their byte values and treats all ASCII values as lower-case.
 
GATE_CORE_API void gate_str_to_lower (gate_char8_t *str, gate_size_t len)
 Converts all ASCII characters in a string to their lower-case counterparts.
 
GATE_CORE_API void gate_str_to_upper (gate_char8_t *str, gate_size_t len)
 Converts all ASCII characters in a string to their upper-case counterparts.
 
GATE_CORE_API void gate_str_reverse (gate_char8_t *str, gate_size_t len)
 Reverses the bytes sequence of a string (first <-> last)
 
GATE_CORE_API gate_size_t gate_str_char_pos (gate_char8_t const *str, gate_size_t len, gate_char8_t find, gate_size_t startat)
 Searches for the first occurance of a character in a string.
 
GATE_CORE_API gate_size_t gate_str_char_pos_last (gate_char8_t const *str, gate_size_t len, gate_char8_t find)
 Searches for the last occurance of a character in a string.
 
GATE_CORE_API gate_size_t gate_str_pos (gate_char8_t const *str, gate_size_t len, gate_char8_t const *find, gate_size_t findlen, gate_size_t startat)
 Searches for the first occurance of a sub-string in a string.
 
GATE_CORE_API gate_size_t gate_str_count_chars (gate_char8_t const *str, gate_size_t len, gate_char8_t chr)
 Counts the amount of given character in a string.
 
GATE_CORE_API int gate_str_comp (gate_char8_t const *str1, gate_char8_t const *str2)
 Compares two NULL-terminated strings.
 
GATE_CORE_API int gate_str_comp_ic (gate_char8_t const *str1, gate_char8_t const *str2)
 Compares two NULL-terminated strings and compare characters case insensitive.
 
GATE_CORE_API int gate_str_compare (gate_char8_t const *str1, gate_size_t len1, gate_char8_t const *str2, gate_size_t len2)
 Compares two strings including their byte lengths.
 
GATE_CORE_API int gate_str_compare_ic (gate_char8_t const *str1, gate_size_t len1, gate_char8_t const *str2, gate_size_t len2)
 Compares two strings including their byte lengths and compare characters case insensitive.
 
GATE_CORE_API gate_size_t gate_str_is_numeric (gate_char8_t const *str, gate_size_t len)
 Checks the content of the string and returns the amount of consecutive digits.
 
GATE_CORE_API gate_bool_t gate_str_starts_with (gate_char8_t const *str, gate_size_t len, gate_char8_t const *starttoken, gate_size_t startlen)
 Detects if a string starts with the content of another string exactly.
 
GATE_CORE_API gate_bool_t gate_str_ends_with (gate_char8_t const *str, gate_size_t len, gate_char8_t const *endtoken, gate_size_t endlen)
 Detects if a string ends with the content of another string exactly.
 
GATE_CORE_API gate_bool_t gate_str_starts_with_ic (gate_char8_t const *str, gate_size_t len, gate_char8_t const *starttoken, gate_size_t startlen)
 Detects if a string starts with the content of another string by comparing case insensitive.
 
GATE_CORE_API gate_bool_t gate_str_ends_with_ic (gate_char8_t const *str, gate_size_t len, gate_char8_t const *endtoken, gate_size_t endlen)
 Detects if a string ends with the content of another string by comparing case insensitive.
 
GATE_CORE_API gate_size_t gate_str_print_text (gate_char8_t *dst, gate_size_t dstlen, gate_char8_t const *txt, gate_size_t txtlen)
 Prints the text content of a 8-bit encoded string into a destination string buffer.
 
GATE_CORE_API gate_size_t gate_str_print_wtext (gate_char8_t *dst, gate_size_t dstlen, wchar_t const *txt, gate_size_t txtlen)
 Prints the text content of a wide string into a destination string buffer.
 
GATE_CORE_API gate_size_t gate_str_print_uint (gate_char8_t *dst, gate_size_t dstlen, gate_uint64_t num, gate_size_t intlen)
 Prints a unsigned integer as a decimal number into a destination string buffer.
 
GATE_CORE_API gate_size_t gate_str_print_real (gate_char8_t *dst, gate_size_t dstlen, gate_real64_t num, unsigned intlen, unsigned decimallen, unsigned grouplen)
 Prints a floating point number into a destination string buffer.
 
GATE_CORE_API gate_bool_t gate_str_like (gate_char8_t const *str, gate_size_t len, gate_char8_t const *like, gate_size_t likelen)
 Evaluates if a string matches a simple wildcard pattern.
 
GATE_CORE_API gate_bool_t gate_str_like_one_of (gate_char8_t const *str, gate_size_t len, gate_char8_t const *like, gate_size_t likelen, gate_char8_t like_separator)
 Evaluates if a string matches one of a group of wildcard patterns.
 
GATE_CORE_API gate_size_t gate_str_find_first_of (gate_char8_t const *str, gate_size_t len, gate_size_t startat, gate_char8_t const *chars, gate_size_t charcount)
 Finds the first byte position of one match of some characters in a string.
 
GATE_CORE_API gate_size_t gate_str_find_first_not_of (gate_char8_t const *str, gate_size_t len, gate_size_t startat, gate_char8_t const *chars, gate_size_t charcount)
 Finds the first byte position of a character not matching a list of characters.
 
GATE_CORE_API gate_size_t gate_str_find_last_of (gate_char8_t const *str, gate_size_t len, gate_char8_t const *chars, gate_size_t charcount)
 Finds the last byte position of one match of some characters in a string.
 
GATE_CORE_API gate_size_t gate_str_find_last_not_of (gate_char8_t const *str, gate_size_t len, gate_char8_t const *chars, gate_size_t charcount)
 Finds the last byte position of a character not matching a list of characters.
 
GATE_CORE_API gate_uint32_t gate_str_hash (gate_char8_t const *str, gate_size_t len)
 Calculates a hash value over the content of the given string bytes.
 
GATE_CORE_API gate_size_t gate_str_replace (gate_char8_t *str, gate_size_t len, gate_char8_t find, gate_char8_t replace)
 Replaces all occurances of a character in a string with another character.
 
GATE_CORE_API gate_size_t gate_str16_length (gate_char16_t const *src)
 
GATE_CORE_API gate_size_t gate_str16_length_max (gate_char16_t const *src, gate_size_t capacity)
 
GATE_CORE_API gate_bool_t gate_str16_is_empty (gate_char16_t const *src)
 
GATE_CORE_API int gate_str16_comp_range (gate_char16_t const *str1, gate_char16_t const *str2, gate_size_t len)
 
GATE_CORE_API int gate_str16_comp_range_ic (gate_char16_t const *str1, gate_char16_t const *str2, gate_size_t len)
 
GATE_CORE_API void gate_str16_to_lower (gate_char16_t *str, gate_size_t len)
 
GATE_CORE_API void gate_str16_to_upper (gate_char16_t *str, gate_size_t len)
 
GATE_CORE_API void gate_str16_reverse (gate_char16_t *str, gate_size_t len)
 
GATE_CORE_API gate_size_t gate_str16_char_pos (gate_char16_t const *str, gate_size_t len, gate_char16_t find, gate_size_t startat)
 
GATE_CORE_API gate_size_t gate_str16_char_pos_last (gate_char16_t const *str, gate_size_t len, gate_char16_t find)
 
GATE_CORE_API gate_size_t gate_str16_pos (gate_char16_t const *str, gate_size_t len, gate_char16_t const *find, gate_size_t findlen, gate_size_t startat)
 
GATE_CORE_API int gate_str16_comp (gate_char16_t const *str1, gate_char16_t const *str2)
 
GATE_CORE_API int gate_str16_compare (gate_char16_t const *str1, gate_size_t len1, gate_char16_t const *str2, gate_size_t len2)
 
GATE_CORE_API int gate_str16_comp_ic (gate_char16_t const *str1, gate_char16_t const *str2)
 
GATE_CORE_API int gate_str16_compare_ic (gate_char16_t const *str1, gate_size_t len1, gate_char16_t const *str2, gate_size_t len2)
 
GATE_CORE_API gate_size_t gate_str16_is_numeric (gate_char16_t const *str, gate_size_t len)
 
GATE_CORE_API gate_bool_t gate_str16_starts_with (gate_char16_t const *str, gate_size_t len, gate_char16_t const *starttoken, gate_size_t startlen)
 
GATE_CORE_API gate_bool_t gate_str16_ends_with (gate_char16_t const *str, gate_size_t len, gate_char16_t const *endtoken, gate_size_t endlen)
 
GATE_CORE_API gate_size_t gate_str16_print_text (gate_char16_t *dst, gate_size_t dstlen, gate_char16_t const *txt, gate_size_t txtlen)
 
GATE_CORE_API gate_size_t gate_str16_print_wtext (gate_char16_t *dst, gate_size_t dstlen, wchar_t const *txt, gate_size_t txtlen)
 
GATE_CORE_API gate_bool_t gate_str32_is_empty (gate_char32_t const *src)
 
GATE_CORE_API int gate_str32_comp_range (gate_char32_t const *str1, gate_char32_t const *str2, gate_size_t len)
 
GATE_CORE_API int gate_str32_comp_range_ic (gate_char32_t const *str1, gate_char32_t const *str2, gate_size_t len)
 
GATE_CORE_API void gate_str32_to_lower (gate_char32_t *str, gate_size_t len)
 
GATE_CORE_API void gate_str32_to_upper (gate_char32_t *str, gate_size_t len)
 
GATE_CORE_API void gate_str32_reverse (gate_char32_t *str, gate_size_t len)
 
GATE_CORE_API gate_size_t gate_str32_char_pos (gate_char32_t const *str, gate_size_t len, gate_char32_t find, gate_size_t startat)
 
GATE_CORE_API gate_size_t gate_str32_char_pos_last (gate_char32_t const *str, gate_size_t len, gate_char32_t find)
 
GATE_CORE_API gate_size_t gate_str32_pos (gate_char32_t const *str, gate_size_t len, gate_char32_t const *find, gate_size_t findlen, gate_size_t startat)
 
GATE_CORE_API gate_size_t gate_str32_length (gate_char32_t const *src)
 
GATE_CORE_API gate_size_t gate_str32_length_max (gate_char32_t const *src, gate_size_t capacity)
 
GATE_CORE_API int gate_str32_comp (gate_char32_t const *str1, gate_char32_t const *str2)
 
GATE_CORE_API int gate_str32_compare (gate_char32_t const *str1, gate_size_t len1, gate_char32_t const *str2, gate_size_t len2)
 
GATE_CORE_API int gate_str32_comp_ic (gate_char32_t const *str1, gate_char32_t const *str2)
 
GATE_CORE_API int gate_str32_compare_ic (gate_char32_t const *str1, gate_size_t len1, gate_char32_t const *str2, gate_size_t len2)
 
GATE_CORE_API gate_size_t gate_str32_is_numeric (gate_char32_t const *str, gate_size_t len)
 
GATE_CORE_API gate_bool_t gate_str32_starts_with (gate_char32_t const *str, gate_size_t len, gate_char32_t const *starttoken, gate_size_t startlen)
 
GATE_CORE_API gate_bool_t gate_str32_ends_with (gate_char32_t const *str, gate_size_t len, gate_char32_t const *endtoken, gate_size_t endlen)
 
GATE_CORE_API gate_size_t gate_str32_print_text (gate_char32_t *dst, gate_size_t dstlen, gate_char32_t const *txt, gate_size_t txtlen)
 
GATE_CORE_API gate_size_t gate_str32_print_wtext (gate_char32_t *dst, gate_size_t dstlen, wchar_t const *txt, gate_size_t txtlen)
 
GATE_CORE_API gate_size_t gate_str_print_int16 (gate_char8_t *dst, gate_size_t dstlen, gate_int16_t num)
 Prints a 16 bit signed integer into a destination string buffer.
 
GATE_CORE_API gate_size_t gate_str_print_uint16 (gate_char8_t *dst, gate_size_t dstlen, gate_uint16_t num)
 Prints a 16 bit unsigned signed integer into a destination string buffer.
 
GATE_CORE_API gate_size_t gate_str_print_int32 (gate_char8_t *dst, gate_size_t dstlen, gate_int32_t num)
 Prints a 32 bit signed integer into a destination string buffer.
 
GATE_CORE_API gate_size_t gate_str_print_uint32 (gate_char8_t *dst, gate_size_t dstlen, gate_uint32_t num)
 Prints a 32 bit unsigned integer into a destination string buffer.
 
GATE_CORE_API gate_size_t gate_str_print_int64 (gate_char8_t *dst, gate_size_t dstlen, gate_int64_t num)
 Prints a 64 bit signed integer into a destination string buffer.
 
GATE_CORE_API gate_size_t gate_str_print_uint64 (gate_char8_t *dst, gate_size_t dstlen, gate_uint64_t num)
 Prints a 64 bit unsigned integer into a destination string buffer.
 
GATE_CORE_API gate_size_t gate_str16_print_int16 (gate_char16_t *dst, gate_size_t dstlen, gate_int16_t num)
 
GATE_CORE_API gate_size_t gate_str16_print_uint16 (gate_char16_t *dst, gate_size_t dstlen, gate_uint16_t num)
 
GATE_CORE_API gate_size_t gate_str16_print_int32 (gate_char16_t *dst, gate_size_t dstlen, gate_int32_t num)
 
GATE_CORE_API gate_size_t gate_str16_print_uint32 (gate_char16_t *dst, gate_size_t dstlen, gate_uint32_t num)
 
GATE_CORE_API gate_size_t gate_str16_print_int64 (gate_char16_t *dst, gate_size_t dstlen, gate_int64_t num)
 
GATE_CORE_API gate_size_t gate_str16_print_uint64 (gate_char16_t *dst, gate_size_t dstlen, gate_uint64_t num)
 
GATE_CORE_API gate_size_t gate_str32_print_int16 (gate_char32_t *dst, gate_size_t dstlen, gate_int16_t num)
 
GATE_CORE_API gate_size_t gate_str32_print_uint16 (gate_char32_t *dst, gate_size_t dstlen, gate_uint16_t num)
 
GATE_CORE_API gate_size_t gate_str32_print_int32 (gate_char32_t *dst, gate_size_t dstlen, gate_int32_t num)
 
GATE_CORE_API gate_size_t gate_str32_print_uint32 (gate_char32_t *dst, gate_size_t dstlen, gate_uint32_t num)
 
GATE_CORE_API gate_size_t gate_str32_print_int64 (gate_char32_t *dst, gate_size_t dstlen, gate_int64_t num)
 
GATE_CORE_API gate_size_t gate_str32_print_uint64 (gate_char32_t *dst, gate_size_t dstlen, gate_uint64_t num)
 
GATE_CORE_API gate_char8_t gate_str_print_hex_nibble (gate_uint8_t nibble, gate_bool_t uppercase)
 Prints a 4-bit number (nibble) into a hexadecimal character.
 
GATE_CORE_API gate_size_t gate_str_print_hex_byte (gate_char8_t *dst, gate_size_t dstlen, gate_uint8_t num, gate_bool_t uppercase)
 Prints a byte as a hexadecimal number of 2 characters.
 
GATE_CORE_API gate_size_t gate_str_print_hex_num (gate_char8_t *dst, gate_size_t dstlen, gate_uint64_t num, gate_bool_t uppercase)
 Prints a number as a hexadecimal number without leading zeros.
 
GATE_CORE_API gate_size_t gate_str_print_hex_uint16 (gate_char8_t *dst, gate_size_t dstlen, gate_uint16_t num, gate_bool_t uppercase)
 Prints a 16-bit number as a hexadecimal number of 4 characters.
 
GATE_CORE_API gate_size_t gate_str_print_hex_uint32 (gate_char8_t *dst, gate_size_t dstlen, gate_uint32_t num, gate_bool_t uppercase)
 Prints a 32-bit number as a hexadecimal number of 8 characters.
 
GATE_CORE_API gate_size_t gate_str_print_hex_uint64 (gate_char8_t *dst, gate_size_t dstlen, gate_uint64_t num, gate_bool_t uppercase)
 Prints a 64-bit number as a hexadecimal number of 16 characters.
 
GATE_CORE_API gate_size_t gate_str_print_hex_buffer (gate_char8_t *dst, gate_size_t dstlen, void const *buffer, gate_size_t bufferlen, gate_bool_t uppercase)
 Prints a binary buffer as a hexadecimal number representation.
 
GATE_CORE_API gate_size_t gate_str_print_hex (gate_char8_t *dst, gate_size_t dstlen, gate_uint64_t num, gate_size_t numlen, gate_bool_t uppercase)
 Prints a number as a hexadecimal number.
 
GATE_CORE_API gate_size_t gate_str_print_to (gate_str_printer_t printer, void *printer_param, va_list arg)
 Prints pairs of (type + parameter) arguments using a user defined printer function.
 
GATE_CORE_API gate_size_t gate_str_print (gate_char8_t *dst, gate_size_t dstlen,...)
 Prints pairs of (type + parameter) arguments into a destination string buffer.
 
GATE_CORE_API gate_size_t gate_str_print_values (gate_char8_t *dst, gate_size_t dstlen, gate_print_value_t const *values, gate_size_t values_count)
 Prints an array of type + parameter arguments into a destination string buffer.
 
GATE_CORE_API gate_bool_t gate_str_parse_digit (gate_char8_t const *src, gate_uint8_t *digit)
 Parses a string for a digit character.
 
GATE_CORE_API gate_size_t gate_str_parse_bool (gate_char8_t const *src, gate_size_t srclen, gate_bool_t *value)
 Parses a string for a boolean value.
 
GATE_CORE_API gate_size_t gate_str_parse_uint64 (gate_char8_t const *src, gate_size_t srclen, gate_uint64_t *num)
 Parses a string for an unsigned 64-bit decimal integer value.
 
GATE_CORE_API gate_size_t gate_str_parse_int64 (gate_char8_t const *src, gate_size_t srclen, gate_int64_t *num)
 Parses a string for a signed 64-bit decimal integer value.
 
GATE_CORE_API gate_size_t gate_str_parse_real (gate_char8_t const *src, gate_size_t srclen, gate_real64_t *num)
 Parses a string for 64-bit floating point decimal integer value.
 
GATE_CORE_API gate_bool_t gate_str_parse_hex_nibble (gate_char8_t chr, gate_uint8_t *value)
 Parses a character for a hexadecimal nibble (0-9)|(a-f)
 
GATE_CORE_API gate_bool_t gate_str_parse_hex_byte (gate_char8_t const chr[2], gate_uint8_t *value)
 Parses a string for a a hexadecimal byte value value.
 
GATE_CORE_API gate_size_t gate_str_parse_hex_int (gate_char8_t const *text, gate_size_t textlen, gate_uint64_t *num)
 Parses a string for an unsigned 64-bit hexadecimal integer value.
 
GATE_CORE_API gate_size_t gate_str_parse_hex_buffer (gate_char8_t const *text, gate_size_t textlen, gate_char8_t *buffer, gate_size_t bufferlen)
 Parses a string for a hexadecimal number sequence into an output buffer.
 
GATE_CORE_API gate_bool_t gate_str_parse_oct_byte (gate_char8_t const chr[3], gate_uint8_t *value)
 Parses a string for a octal number into a byte.
 
GATE_CORE_API gate_size_t gate_str_parse_line (gate_char8_t const *text, gate_size_t textlen, gate_char8_t *buffer, gate_size_t *bufferlen)
 Parses a string for a full text line (until end-of-line character is detected)
 
GATE_CORE_API void gate_strbuilder_create (gate_strbuilder_t *builder, gate_size_t capacity)
 Creates a string-builder instance and tries to preallocate memory for the requested capacity.
 
GATE_CORE_API void gate_strbuilder_create_static (gate_strbuilder_t *builder, char *buffer, gate_size_t capacity, gate_size_t length_used)
 Creates a string-builder instance and binds it to a static (external) buffer.
 
GATE_CORE_API void gate_strbuilder_release (gate_strbuilder_t *builder)
 Releases all allocated resources of a stringbuilder object.
 
GATE_CORE_API gate_size_t gate_strbuilder_resize (gate_strbuilder_t *builder, gate_size_t sz)
 Tries to resize the internal buffer of a string builder.
 
GATE_CORE_API gate_size_t gate_strbuilder_length (gate_strbuilder_t const *builder)
 Returns the currently used length of text in a string builder.
 
GATE_CORE_API gate_char8_t const * gate_strbuilder_ptr (gate_strbuilder_t const *builder, gate_size_t charpos)
 Returns a pointer to the character within the string builder buffer at the given position.
 
GATE_CORE_API gate_size_t gate_strbuilder_increase (gate_strbuilder_t *builder, gate_size_t sz)
 Tries to increase the allocated size of a string builder.
 
GATE_CORE_API gate_size_t gate_strbuilder_append_text (gate_strbuilder_t *builder, gate_char8_t const *txt, gate_size_t txtlen)
 
GATE_CORE_API gate_size_t gate_strbuilder_append_chars (gate_strbuilder_t *builder, gate_size_t char_count, char chr)
 
GATE_CORE_API gate_size_t gate_strbuilder_append_text16 (gate_strbuilder_t *builder, gate_char16_t const *txt, gate_size_t txtlen)
 
GATE_CORE_API gate_size_t gate_strbuilder_append_text32 (gate_strbuilder_t *builder, gate_char32_t const *txt, gate_size_t txtlen)
 
GATE_CORE_API gate_size_t gate_strbuilder_append_cstr (gate_strbuilder_t *builder, char const *txt)
 
GATE_CORE_API gate_size_t gate_strbuilder_append_string (gate_strbuilder_t *builder, gate_string_t const *txt)
 
GATE_CORE_API gate_size_t gate_strbuilder_append_int16 (gate_strbuilder_t *builder, gate_int16_t num)
 
GATE_CORE_API gate_size_t gate_strbuilder_append_uint16 (gate_strbuilder_t *builder, gate_uint16_t num)
 
GATE_CORE_API gate_size_t gate_strbuilder_append_int32 (gate_strbuilder_t *builder, gate_int32_t num)
 
GATE_CORE_API gate_size_t gate_strbuilder_append_uint32 (gate_strbuilder_t *builder, gate_uint32_t num)
 
GATE_CORE_API gate_size_t gate_strbuilder_append_int64 (gate_strbuilder_t *builder, gate_int64_t num)
 
GATE_CORE_API gate_size_t gate_strbuilder_append_uint64 (gate_strbuilder_t *builder, gate_uint64_t num)
 
GATE_CORE_API gate_size_t gate_strbuilder_append_hex (gate_strbuilder_t *builder, gate_uint8_t const *bytes, gate_size_t byte_count, gate_bool_t uppercase)
 
GATE_CORE_API gate_size_t gate_strbuilder_append_real (gate_strbuilder_t *builder, gate_real64_t num, unsigned intlen, unsigned decimallen, unsigned grouplen)
 
GATE_CORE_API gate_size_t gate_strbuilder_append (gate_strbuilder_t *builder,...)
 
GATE_CORE_API gate_size_t gate_strbuilder_insert (gate_strbuilder_t *builder, gate_size_t pos, char const *txt, gate_size_t txtlen)
 
GATE_CORE_API gate_size_t gate_strbuilder_remove (gate_strbuilder_t *builder, gate_size_t pos, gate_size_t length)
 
GATE_CORE_API gate_size_t gate_strbuilder_replace (gate_strbuilder_t *builder, gate_size_t pos, gate_size_t len, char const *txt, gate_size_t txtlen)
 
GATE_CORE_API gate_size_t gate_strbuilder_discard (gate_strbuilder_t *builder, gate_size_t charcount)
 
GATE_CORE_API gate_size_t gate_strbuilder_discard_back (gate_strbuilder_t *builder, gate_size_t charcount)
 
GATE_CORE_API gate_size_t gate_strbuilder_pos (gate_strbuilder_t *builder, gate_string_t const *token, gate_size_t start_at)
 
GATE_CORE_API gate_size_t gate_strbuilder_char_pos (gate_strbuilder_t *builder, gate_char8_t chr, gate_size_t start_at)
 
GATE_CORE_API gate_size_t gate_strbuilder_str_pos (gate_strbuilder_t *builder, gate_char8_t const *str, gate_size_t strlength, gate_size_t start_at)
 
GATE_CORE_API gate_string_tgate_strbuilder_to_string (gate_strbuilder_t *builder, gate_string_t *str)
 
GATE_CORE_API gate_string_tgate_strbuilder_copy_to_string (gate_strbuilder_t const *builder, gate_string_t *str)
 
GATE_CORE_API gate_result_t gate_strbuilder_copy_constructor (void *destMem, void const *srcMem)
 
GATE_CORE_API void gate_strbuilder_destructor (void *dest)
 
GATE_CORE_API gate_string_tgate_string_create (gate_string_t *obj, gate_char8_t const *str, gate_size_t len)
 
GATE_CORE_API gate_string_tgate_string_create_static_len (gate_string_t *obj, gate_char8_t const *str, gate_size_t len)
 
GATE_CORE_API gate_string_tgate_string_create_static (gate_string_t *obj, gate_char8_t const *str)
 
GATE_CORE_API gate_string_tgate_string_create_empty (gate_string_t *obj)
 
GATE_CORE_API gate_string_tgate_string_create_utf16 (gate_string_t *obj, gate_char16_t const *str, gate_size_t len)
 
GATE_CORE_API gate_string_tgate_string_create_utf32 (gate_string_t *obj, gate_char32_t const *str, gate_size_t len)
 
GATE_CORE_API gate_string_tgate_string_create_copy (gate_string_t *obj, gate_string_t const *src)
 
GATE_CORE_API gate_string_tgate_string_clone (gate_string_t *obj, gate_string_t const *src)
 
GATE_CORE_API gate_size_t gate_string_count_chars (gate_string_t const *obj, gate_char8_t chr)
 
GATE_CORE_API gate_char8_t gate_string_char_at (gate_string_t const *str, gate_size_t index)
 
GATE_CORE_API gate_size_t gate_string_char_pos (gate_string_t const *str, gate_char8_t find, gate_size_t startat)
 
GATE_CORE_API gate_size_t gate_string_char_pos_last (gate_string_t const *str, gate_char8_t find)
 
GATE_CORE_API gate_size_t gate_string_find_first_of (gate_string_t const *obj, gate_size_t startat, gate_string_t const *chars)
 
GATE_CORE_API gate_size_t gate_string_find_first_not_of (gate_string_t const *obj, gate_size_t startat, gate_string_t const *chars)
 
GATE_CORE_API gate_size_t gate_string_find_last_of (gate_string_t const *obj, gate_string_t const *chars)
 
GATE_CORE_API gate_size_t gate_string_find_last_not_of (gate_string_t const *obj, gate_string_t const *chars)
 
GATE_CORE_API gate_size_t gate_string_pos (gate_string_t const *str, gate_string_t const *find, gate_size_t startat)
 
GATE_CORE_API void gate_string_release (gate_string_t *obj)
 
GATE_CORE_API gate_bool_t gate_string_is_empty (gate_string_t const *obj)
 
GATE_CORE_API gate_string_tgate_string_duplicate (gate_string_t *dst, gate_string_t const *src)
 
GATE_CORE_API gate_size_t gate_string_length (gate_string_t const *obj)
 
GATE_CORE_API gate_bool_t gate_string_like (gate_string_t const *obj, gate_string_t const *pattern)
 
GATE_CORE_API gate_bool_t gate_string_like_one_of (gate_string_t const *obj, gate_string_t const *pattern, gate_char8_t separator)
 
GATE_CORE_API gate_size_t gate_string_parse (gate_string_t const *obj, gate_string_t const *find_separator, gate_size_t start_at, gate_string_t *head, gate_string_t *tail, gate_bool_t separator_as_tail)
 
GATE_CORE_API gate_size_t gate_string_parse_int (gate_string_t const *obj, gate_int64_t *num)
 
GATE_CORE_API gate_size_t gate_string_parse_uint (gate_string_t const *obj, gate_uint64_t *num)
 
GATE_CORE_API gate_size_t gate_string_parse_real (gate_string_t const *obj, gate_real64_t *num)
 
GATE_CORE_API gate_size_t gate_string_parse_hex (gate_string_t const *obj, gate_uint64_t *num)
 
GATE_CORE_API gate_char8_t const * gate_string_ptr (gate_string_t const *obj, gate_size_t index)
 
GATE_CORE_API gate_string_tgate_string_substr (gate_string_t *dst, gate_string_t const *src, gate_size_t offset, gate_size_t length)
 
GATE_CORE_API int gate_string_comp (gate_string_t const *src, gate_string_t const *dst)
 
GATE_CORE_API int gate_string_comp_ic (gate_string_t const *src, gate_string_t const *dst)
 
GATE_CORE_API gate_size_t gate_string_to_buffer (gate_string_t const *src, gate_char8_t *buffer, gate_size_t bufferlength)
 
GATE_CORE_API gate_bool_t gate_string_starts_with (gate_string_t const *obj, gate_string_t const *token)
 
GATE_CORE_API gate_bool_t gate_string_starts_with_str (gate_string_t const *obj, gate_char8_t const *text)
 
GATE_CORE_API gate_bool_t gate_string_starts_with_char (gate_string_t const *obj, gate_char8_t chr)
 
GATE_CORE_API gate_bool_t gate_string_ends_with (gate_string_t const *obj, gate_string_t const *token)
 
GATE_CORE_API gate_bool_t gate_string_ends_with_str (gate_string_t const *obj, gate_char8_t const *text)
 
GATE_CORE_API gate_bool_t gate_string_ends_with_char (gate_string_t const *obj, gate_char8_t chr)
 
GATE_CORE_API gate_bool_t gate_string_ends_with_ic (gate_string_t const *obj, gate_string_t const *token)
 
GATE_CORE_API gate_bool_t gate_string_ends_with_str_ic (gate_string_t const *obj, gate_char8_t const *text)
 
GATE_CORE_API gate_bool_t gate_string_contains (gate_string_t const *obj, gate_string_t const *token)
 
GATE_CORE_API gate_bool_t gate_string_equals (gate_string_t const *obj, gate_string_t const *token)
 
GATE_CORE_API gate_bool_t gate_string_equals_str (gate_string_t const *obj, gate_char8_t const *token)
 
GATE_CORE_API gate_bool_t gate_string_equals_ic (gate_string_t const *obj, gate_string_t const *token)
 
GATE_CORE_API gate_bool_t gate_string_equals_str_ic (gate_string_t const *obj, gate_char8_t const *token)
 
GATE_CORE_API gate_string_tgate_string_ltrim (gate_string_t *dst, gate_string_t const *src)
 
GATE_CORE_API gate_string_tgate_string_rtrim (gate_string_t *dst, gate_string_t const *src)
 
GATE_CORE_API gate_string_tgate_string_trim (gate_string_t *dst, gate_string_t const *src)
 
GATE_CORE_API gate_string_tgate_string_read_line (gate_string_t *line, gate_string_t const *src, gate_string_t *tail)
 
GATE_CORE_API gate_string_tgate_string_read_token (gate_string_t *token, gate_string_t const *src, gate_string_t *tail)
 
GATE_CORE_API gate_string_tgate_string_to_lower (gate_string_t *dst, gate_string_t const *src)
 
GATE_CORE_API gate_string_tgate_string_to_upper (gate_string_t *dst, gate_string_t const *src)
 
GATE_CORE_API gate_uint32_t gate_string_hash (gate_string_t const *obj)
 
GATE_CORE_API gate_result_t gate_string_copy_constructor (void *destMem, void const *srcMem)
 
GATE_CORE_API gate_result_t gate_string_duplicate_constructor (void *destMem, void const *srcMem)
 
GATE_CORE_API void gate_string_destructor (void *dest)
 
GATE_CORE_API gate_cstrbuffer_tgate_cstrbuffer_create (gate_cstrbuffer_t *buffer, gate_char8_t const *textptr, gate_size_t length, gate_bool_t copy_needed)
 Creates a C-string buffer from a given string-range.
 
GATE_CORE_API gate_cstrbuffer_tgate_cstrbuffer_create_string (gate_cstrbuffer_t *buffer, gate_string_t const *strptr, gate_bool_t copy_needed)
 Creates a C-string buffer from a given string.
 
GATE_CORE_API void gate_cstrbuffer_destroy (gate_cstrbuffer_t *buffer)
 Destroys C-string buffer (deallocates heap if used)
 
GATE_CORE_API gate_char8_t const * gate_cstrbuffer_get (gate_cstrbuffer_t const *buffer)
 Returns a pointer to the buffered NUL-terminated string.
 
GATE_CORE_API gate_size_t gate_cstrbuffer_length (gate_cstrbuffer_t const *buffer)
 Returns the length of the buffered string (not counting the NUL-terminator)
 
GATE_CORE_API gate_cstrbuffer16_tgate_cstrbuffer16_create (gate_cstrbuffer16_t *buffer, gate_char16_t const *textptr, gate_size_t length, gate_bool_t copy_needed)
 
GATE_CORE_API gate_cstrbuffer16_tgate_cstrbuffer16_create_string (gate_cstrbuffer16_t *buffer, gate_string_t const *ptr)
 
GATE_CORE_API void gate_cstrbuffer16_destroy (gate_cstrbuffer16_t *buffer)
 
GATE_CORE_API gate_char16_t const * gate_cstrbuffer16_get (gate_cstrbuffer16_t const *buffer)
 
GATE_CORE_API gate_size_t gate_cstrbuffer16_length (gate_cstrbuffer16_t const *buffer)
 
GATE_CORE_API gate_cstrbuffer32_tgate_cstrbuffer32_create (gate_cstrbuffer32_t *buffer, gate_char32_t const *textptr, gate_size_t length, gate_bool_t copy_needed)
 
GATE_CORE_API gate_cstrbuffer32_tgate_cstrbuffer32_create_string (gate_cstrbuffer32_t *buffer, gate_string_t const *ptr)
 
GATE_CORE_API void gate_cstrbuffer32_destroy (gate_cstrbuffer32_t *buffer)
 
GATE_CORE_API gate_char32_t const * gate_cstrbuffer32_get (gate_cstrbuffer32_t const *buffer)
 
GATE_CORE_API gate_size_t gate_cstrbuffer32_length (gate_cstrbuffer32_t const *buffer)
 

Detailed Description

String management, UTF conversion and basic text parsing functions.

Macro Definition Documentation

◆ GATE_PRINT_ADDRESS

#define GATE_PRINT_ADDRESS   ((int)0x23)

print pointer address as HEX chars

◆ GATE_PRINT_BOOL

#define GATE_PRINT_BOOL   ((int)0x10)

print boolean content (true / false)

◆ GATE_PRINT_CHAR

#define GATE_PRINT_CHAR   ((int)0x01)

print a single character

◆ GATE_PRINT_CR

#define GATE_PRINT_CR   ((int)0x05)

print CR character

◆ GATE_PRINT_CRLF

#define GATE_PRINT_CRLF   ((int)0x07)

print CR + LF characters

◆ GATE_PRINT_CSTR

#define GATE_PRINT_CSTR   ((int)0x03)

print null terminated char array (char const*)

◆ GATE_PRINT_END

#define GATE_PRINT_END   ((int)0x00)

end of print argument list

◆ GATE_PRINT_H16

#define GATE_PRINT_H16   ((int)0x1b)

print 16 bit word as 4 HEX chars

◆ GATE_PRINT_H32

#define GATE_PRINT_H32   ((int)0x1c)

print 32 bit dword as 8 HEX chars

◆ GATE_PRINT_H64

#define GATE_PRINT_H64   ((int)0x1d)

print 64 bit qword as 16 HEX chars

◆ GATE_PRINT_H8

#define GATE_PRINT_H8   ((int)0x1a)

print byte as 2 HEX chars

◆ GATE_PRINT_I16

#define GATE_PRINT_I16   ((int)0x13)

print signed 16 bit integer

◆ GATE_PRINT_I32

#define GATE_PRINT_I32   ((int)0x15)

print signed 32 bit integer

◆ GATE_PRINT_I64

#define GATE_PRINT_I64   ((int)0x17)

print signed 64 bit integer

◆ GATE_PRINT_I8

#define GATE_PRINT_I8   ((int)0x11)

print signed 8 bit integer

◆ GATE_PRINT_LF

#define GATE_PRINT_LF   ((int)0x06)

print LF character

◆ GATE_PRINT_NEWLINE

#define GATE_PRINT_NEWLINE   ((int)0x02)

send platform specific newline-characters

◆ GATE_PRINT_R32

#define GATE_PRINT_R32   ((int)0x21)

print 32 bit floating point number

◆ GATE_PRINT_R64

#define GATE_PRINT_R64   ((int)0x22)

print 64 bit floating point number

◆ GATE_PRINT_STRING

#define GATE_PRINT_STRING   ((int)0x04)

print content of gate_string_t

◆ GATE_PRINT_UI16

#define GATE_PRINT_UI16   ((int)0x14)

print unsigned 16 bit integer

◆ GATE_PRINT_UI32

#define GATE_PRINT_UI32   ((int)0x16)

print unsigned 32 bit integer

◆ GATE_PRINT_UI64

#define GATE_PRINT_UI64   ((int)0x18)

print unsigned 64 bit integer

◆ GATE_PRINT_UI8

#define GATE_PRINT_UI8   ((int)0x12)

print unsigned 8 bit integer

◆ GATE_STR_NPOS

#define GATE_STR_NPOS   GATE_INVALID_SIZE

Invalid position indicator

Typedef Documentation

◆ gate_cstrbuffer8_t

C-string buffer class.

GATE strings need not to be NUL-terminated, but many C APIs require this convention. A C-string buffer takes a string pointer, and check it for NUL-termination. If it's NUL-terminated, it takes it as it is. Otherwise it checks the length and tries to copy it into a local buffer. If the local buffer is not big enough, a heap allocation is done to copy the string into it. At the end we get a string pointer that points to a NUL-terminated string.

◆ gate_strbuilder8_t

character (byte) string builder class

Stringbuilders hold a stringbuffer and grow them if necessary (when the current capacity is reached)

◆ gate_string8_t

character (byte) string class

A string class holds a pointer to the first character of a constant (immutable) text string and the valid length. Strings are expected to be UTF-8 encoded but the encoding is not checked until conversion into other text-formats are performed. Strings need not to be null-terminated. If a string-buffer is attached, the content of the string is bound to the attached buffer. If no buffer is attached, the object points to a foreign region and its allocation must be ensured as long as the string object referres to it.

◆ gate_stringbuffer8_t

character (byte) string buffer class

The object is a reference-count managed, overallocated heap object Its data member as an "open array" of bytes

Function Documentation

◆ gate_char_is_digit()

GATE_CORE_API gate_bool_t gate_char_is_digit ( int chr)

Returns true, if the ASCII character is a digite '0' - '9'.

Parameters
chrinput ASCII character value
Returns
true if 'chr' is a digit, otherwise false

◆ gate_char_is_whitespace()

GATE_CORE_API gate_bool_t gate_char_is_whitespace ( int chr)

Returns true, if the ASCII character is a whitespace.

Parameters
chrinput ASCII character value
Returns
true if 'chr' is a whitespace character, otherwise false

◆ gate_char_lowercase()

GATE_CORE_API int gate_char_lowercase ( int chr)

Converts an ASCII character to its lower case.

Parameters
chrinput ASCII character value
Returns
lower case version of 'chr'

◆ gate_char_read_utf16()

GATE_CORE_API gate_size_t gate_char_read_utf16 ( gate_char16_t const * src,
gate_size_t srclen,
gate_char32_t * dst )

Reads an UTF-16 encoded sequence and decodes a single unicode character.

Parameters
srcpointer to 16-bit word sequence
srclentotal amount of 16-bit words in sequence
dstpointer to one output unicode character
Returns
amount of input 16-bit words processed to decode one unicode character

◆ gate_char_read_utf32()

GATE_CORE_API gate_size_t gate_char_read_utf32 ( gate_char32_t const * src,
gate_size_t srclen,
gate_char32_t * dst )

Reads an UTF-32 encoded byte sequence and decodes a single unicode character.

Parameters
srcpointer to 32-bit word sequence
srclentotal amount of 32-bit words in sequence
dstpointer to one output unicode character
Returns
amount of input 32-bit words processed to decode one unicode character

◆ gate_char_read_utf8()

GATE_CORE_API gate_size_t gate_char_read_utf8 ( gate_char8_t const * src,
gate_size_t srclen,
gate_char32_t * dst )

Reads an UTF-8 encoded byte sequence and decodes a single unicode character.

Parameters
srcpointer to byte sequence
srclentotal length of byte sequence
dstpointer to one output unicode character
Returns
amount of input bytes processed to decode one unicode character

◆ gate_char_uppercase()

GATE_CORE_API int gate_char_uppercase ( int chr)

Converts an ASCII character to its upper case.

Parameters
chrinput ASCII character value
Returns
upper case version of 'chr'

◆ gate_char_write_utf16()

GATE_CORE_API gate_size_t gate_char_write_utf16 ( gate_char32_t src,
gate_char16_t * dst,
gate_size_t dstlen )

Encodes one unicode character into an UTF-16 word buffer.

Parameters
srcone unicode character to encode
dstpointer to allocated output buffer that receives an UTF-16 character sequence
dstlensize of output buffer in 16-bit words
Returns
amount of used 16-bit words in output buffer

◆ gate_char_write_utf32()

GATE_CORE_API gate_size_t gate_char_write_utf32 ( gate_char32_t src,
gate_char32_t * dst,
gate_size_t dstlen )

Encodes one unicode character into an UTF-32 word buffer.

Parameters
srcone unicode character to encode
dstpointer to allocated output buffer that receives an UTF-32 character sequence
dstlensize of output buffer in 32-bit words
Returns
amount of used 32-bit words in output buffer

◆ gate_char_write_utf8()

GATE_CORE_API gate_size_t gate_char_write_utf8 ( gate_char32_t src,
gate_char8_t * dst,
gate_size_t dstlen )

Encodes one unicode character into an UTF-8 byte buffer.

Parameters
srcone unicode character to encode
dstpointer to allocated output buffer that receives an UTF-8 character sequence
dstlensize of output buffer in bytes
Returns
amount of used bytes in output buffer

◆ gate_cstrbuffer_create()

GATE_CORE_API gate_cstrbuffer_t * gate_cstrbuffer_create ( gate_cstrbuffer_t * buffer,
gate_char8_t const * textptr,
gate_size_t length,
gate_bool_t copy_needed )

Creates a C-string buffer from a given string-range.

Parameters
[out]bufferPointer to output cstrbuffer to be initialized
[in]textptrPointer to input string range to be integrated
[in]lengthLength of input string
[in]copy_neededContents of source buffer is always copied into local or heap buffer
Returns
buffer-Pointer in case of success, NULL in case of allocation error

◆ gate_cstrbuffer_create_string()

GATE_CORE_API gate_cstrbuffer_t * gate_cstrbuffer_create_string ( gate_cstrbuffer_t * buffer,
gate_string_t const * strptr,
gate_bool_t copy_needed )

Creates a C-string buffer from a given string.

Parameters
[out]bufferPointer to output cstrbuffer to be initialized
[in]strptrPointer to input string to be integrated
[in]copy_neededContents of source buffer is always copied into local or heap buffer
Returns
buffer-pointer in case of success, NULL in case of allocation error

◆ gate_cstrbuffer_destroy()

GATE_CORE_API void gate_cstrbuffer_destroy ( gate_cstrbuffer_t * buffer)

Destroys C-string buffer (deallocates heap if used)

Parameters
[in]bufferPointer to c-string buffer to be destroyed

◆ gate_cstrbuffer_get()

GATE_CORE_API gate_char8_t const * gate_cstrbuffer_get ( gate_cstrbuffer_t const * buffer)

Returns a pointer to the buffered NUL-terminated string.

Parameters
[in]bufferPointer to buffer to be accessed
Returns
Pointer to NUL-terminated string

◆ gate_cstrbuffer_length()

GATE_CORE_API gate_size_t gate_cstrbuffer_length ( gate_cstrbuffer_t const * buffer)

Returns the length of the buffered string (not counting the NUL-terminator)

Parameters
[in]bufferPointer to buffer to be accessed
Returns
Length of NUL-terminated string (not counting the NUL-terminator)

◆ gate_str_char_pos()

GATE_CORE_API gate_size_t gate_str_char_pos ( gate_char8_t const * str,
gate_size_t len,
gate_char8_t find,
gate_size_t startat )

Searches for the first occurance of a character in a string.

Parameters
strpointer to first character in string
lenlength of string
findcharacter value to search for
startatcharacter offset in string where search starts
Returns
position of found character, or GATE_STR_NPOS if not found

◆ gate_str_char_pos_last()

GATE_CORE_API gate_size_t gate_str_char_pos_last ( gate_char8_t const * str,
gate_size_t len,
gate_char8_t find )

Searches for the last occurance of a character in a string.

Parameters
strpointer to first character in string
lenlength of string
findcharacter value to search for
Returns
position of found character, or GATE_STR_NPOS if not found

◆ gate_str_comp()

GATE_CORE_API int gate_str_comp ( gate_char8_t const * str1,
gate_char8_t const * str2 )

Compares two NULL-terminated strings.

Parameters
str1pointer to first character in first string
str2pointer to first character in second string
Returns
0 if strings are equal, < 0 if first string has lower bytes values, > 0 if second string has lower byte values

◆ gate_str_comp_ic()

GATE_CORE_API int gate_str_comp_ic ( gate_char8_t const * str1,
gate_char8_t const * str2 )

Compares two NULL-terminated strings and compare characters case insensitive.

Parameters
str1pointer to first character in first string
str2pointer to first character in second string
Returns
0 if strings are equal, < 0 if first string has lower bytes values, > 0 if second string has lower byte values

◆ gate_str_comp_range()

GATE_CORE_API int gate_str_comp_range ( gate_char8_t const * str1,
gate_char8_t const * str2,
gate_size_t len )

Compares two string ranges of equal size by their byte values.

Parameters
str1pointer to first byte in first string
str2pointer to first byte in second string
lenlength of both strings in bytes
Returns
0 if strings are equal, < 0 if first string has lower byte values, > 0 if second string has lower byte values

◆ gate_str_comp_range_ic()

GATE_CORE_API int gate_str_comp_range_ic ( gate_char8_t const * str1,
gate_char8_t const * str2,
gate_size_t len )

Compares two string ranges of equal size by their byte values and treats all ASCII values as lower-case.

Parameters
str1pointer to first byte in first string
str2pointer to first byte in second string
lenlength of both strings in bytes
Returns
0 if strings are case-insensitive equal, < 0 if first string has lower byte values, > 0 if second string has lower byte values

◆ gate_str_compare()

GATE_CORE_API int gate_str_compare ( gate_char8_t const * str1,
gate_size_t len1,
gate_char8_t const * str2,
gate_size_t len2 )

Compares two strings including their byte lengths.

Parameters
str1pointer to first character in first string
len1length in bytes of str1
str2pointer to first character in second string
len2length in bytes of str2
Returns
0 if strings are equal, < 0 if first string has lower bytes values, > 0 if second string has lower byte values

◆ gate_str_compare_ic()

GATE_CORE_API int gate_str_compare_ic ( gate_char8_t const * str1,
gate_size_t len1,
gate_char8_t const * str2,
gate_size_t len2 )

Compares two strings including their byte lengths and compare characters case insensitive.

Parameters
str1pointer to first character in first string
len1length in bytes of str1
str2pointer to first character in second string
len2length in bytes of str2
Returns
0 if strings are equal, < 0 if first string has lower bytes values, > 0 if second string has lower byte values

◆ gate_str_count_chars()

GATE_CORE_API gate_size_t gate_str_count_chars ( gate_char8_t const * str,
gate_size_t len,
gate_char8_t chr )

Counts the amount of given character in a string.

Parameters
[in]strpointer to first character in first string
[in]lenLength of the string in bytes
[in]chrCharacter to be counted
Returns
Amount of found characters

◆ gate_str_ends_with()

GATE_CORE_API gate_bool_t gate_str_ends_with ( gate_char8_t const * str,
gate_size_t len,
gate_char8_t const * endtoken,
gate_size_t endlen )

Detects if a string ends with the content of another string exactly.

Parameters
strpointer to string to be analyzed
lenlength of text in str in bytes
endtokenpointer to string with expected end token
endlenlength of text in endtoken in bytes
Returns
true if str ends with endtoken's content

◆ gate_str_ends_with_ic()

GATE_CORE_API gate_bool_t gate_str_ends_with_ic ( gate_char8_t const * str,
gate_size_t len,
gate_char8_t const * endtoken,
gate_size_t endlen )

Detects if a string ends with the content of another string by comparing case insensitive.

Parameters
strpointer to string to be analyzed
lenlength of text in str in bytes
endtokenpointer to string with expected end token
endlenlength of text in endtoken in bytes
Returns
true if str ends with endtoken's content

◆ gate_str_find_first_not_of()

GATE_CORE_API gate_size_t gate_str_find_first_not_of ( gate_char8_t const * str,
gate_size_t len,
gate_size_t startat,
gate_char8_t const * chars,
gate_size_t charcount )

Finds the first byte position of a character not matching a list of characters.

Parameters
[in]strPointer to string to be evaluated
[in]lenLength of str in bytes
[in]startatOffset in string to start search
[in]charsPointer to array of characters to search
[in]charcountCount of characters in chars
Returns
Offset position of first found character in str NOT matching chars, or GATE_STR_NPOS if all characters are matching

◆ gate_str_find_first_of()

GATE_CORE_API gate_size_t gate_str_find_first_of ( gate_char8_t const * str,
gate_size_t len,
gate_size_t startat,
gate_char8_t const * chars,
gate_size_t charcount )

Finds the first byte position of one match of some characters in a string.

Parameters
[in]strPointer to string to be evaluated
[in]lenLength of str in bytes
[in]startatOffset in string to start search
[in]charsPointer to array of characters to search
[in]charcountCount of characters in chars
Returns
Offset position of first found character in str matchting chars, or GATE_STR_NPOS if no character was found

◆ gate_str_find_last_not_of()

GATE_CORE_API gate_size_t gate_str_find_last_not_of ( gate_char8_t const * str,
gate_size_t len,
gate_char8_t const * chars,
gate_size_t charcount )

Finds the last byte position of a character not matching a list of characters.

Parameters
[in]strPointer to string to be evaluated
[in]lenLength of str in bytes
[in]charsPointer to array of characters to search
[in]charcountCount of characters in chars
Returns
Offset position of last found character in str NOT matching chars (reverse search), or GATE_STR_NPOS if all characters are matching

◆ gate_str_find_last_of()

GATE_CORE_API gate_size_t gate_str_find_last_of ( gate_char8_t const * str,
gate_size_t len,
gate_char8_t const * chars,
gate_size_t charcount )

Finds the last byte position of one match of some characters in a string.

Parameters
[in]strPointer to string to be evaluated
[in]lenLength of str in bytes
[in]charsPointer to array of characters to search
[in]charcountCount of characters in chars
Returns
Offset position of last found character in str matchting chars (reverse search), or GATE_STR_NPOS if no character was found

◆ gate_str_hash()

GATE_CORE_API gate_uint32_t gate_str_hash ( gate_char8_t const * str,
gate_size_t len )

Calculates a hash value over the content of the given string bytes.

Parameters
[in]strPointer to string to be evaluated
[in]lenLength of str in bytes
Returns
Hash value of string content

◆ gate_str_is_empty()

GATE_CORE_API gate_bool_t gate_str_is_empty ( gate_char8_t const * src)

Returns true if the given character string is emptry.

Parameters
srcpointer to first character in string
Returns
true if 'src' is NULL or points to a NULL-terminator character

◆ gate_str_is_numeric()

GATE_CORE_API gate_size_t gate_str_is_numeric ( gate_char8_t const * str,
gate_size_t len )

Checks the content of the string and returns the amount of consecutive digits.

Parameters
strpointer to character string
lenlength of string in bytes
Returns
number of found digit characters

◆ gate_str_length()

GATE_CORE_API gate_size_t gate_str_length ( gate_char8_t const * src)

Returns the length of a NULL-terminated character string.

Parameters
srcpointer to first character in string
Returns
amount of bytes in character string until NULL was reached

◆ gate_str_length_max()

GATE_CORE_API gate_size_t gate_str_length_max ( gate_char8_t const * src,
gate_size_t capacity )

Returns the length of a NULL-terminated character string with a limited capacity.

Parameters
srcpointer to first character in string
capacitymaximum allocated space of string
Returns
amount of bytes in character string until NULL or given capacity was reached

◆ gate_str_like()

GATE_CORE_API gate_bool_t gate_str_like ( gate_char8_t const * str,
gate_size_t len,
gate_char8_t const * like,
gate_size_t likelen )

Evaluates if a string matches a simple wildcard pattern.

Wildcard patterns are "*" or "?", e.g. "Hello World" would match the pattern "He??o W*d"

Parameters
[in]strPointer to string to be evaluated
[in]lenLength of str in bytes
[in]likePointer to string with pattern
[in]likelenLength of like in bytes
Returns
true if str matches the pattern in like

◆ gate_str_like_one_of()

GATE_CORE_API gate_bool_t gate_str_like_one_of ( gate_char8_t const * str,
gate_size_t len,
gate_char8_t const * like,
gate_size_t likelen,
gate_char8_t like_separator )

Evaluates if a string matches one of a group of wildcard patterns.

Patterns are provided in one string, a separator character cuts their the group into separate patterns

Parameters
[in]strPointer to string to be evaluated
[in]lenLength of str in bytes
[in]likePointer to string with multiple patterns
[in]likelenLength of like in bytes
[in]like_separatorCharacter used to cut like into pieces
Returns
true if str matches at least on of the patterns in like

◆ gate_str_parse_bool()

GATE_CORE_API gate_size_t gate_str_parse_bool ( gate_char8_t const * src,
gate_size_t srclen,
gate_bool_t * value )

Parses a string for a boolean value.

Supported values are "true", "false", "on", "off", "yes", "no", "1", "0"

Parameters
[in]srcPointer to string to be parsed
[in]srclenLength of src in bytes
[out]valuePointer to ouput value filled with parsing result
Returns
Amount of bytes that were parsed

◆ gate_str_parse_digit()

GATE_CORE_API gate_bool_t gate_str_parse_digit ( gate_char8_t const * src,
gate_uint8_t * digit )

Parses a string for a digit character.

Parameters
[in]srcPointer to printer-function that receives strings to print
[out]digitUser parameter handed over to printer function
Returns
true, if first character of string is a digit

◆ gate_str_parse_hex_buffer()

GATE_CORE_API gate_size_t gate_str_parse_hex_buffer ( gate_char8_t const * text,
gate_size_t textlen,
gate_char8_t * buffer,
gate_size_t bufferlen )

Parses a string for a hexadecimal number sequence into an output buffer.

Parameters
[in]textPointer to string to be parsed
[in]textlenLength of text in bytes
[out]bufferPointer to ouput value filled with parsing result
[in]bufferlenCapacity of buffer
Returns
Amount of bytes that were parsed

◆ gate_str_parse_hex_byte()

GATE_CORE_API gate_bool_t gate_str_parse_hex_byte ( gate_char8_t const chr[2],
gate_uint8_t * value )

Parses a string for a a hexadecimal byte value value.

Parameters
[in]chrPointer to 2-bytes string
[out]valuePointer to ouput value filled with parsing result
Returns
true if byte could be parsed, otherwise false

◆ gate_str_parse_hex_int()

GATE_CORE_API gate_size_t gate_str_parse_hex_int ( gate_char8_t const * text,
gate_size_t textlen,
gate_uint64_t * num )

Parses a string for an unsigned 64-bit hexadecimal integer value.

Parameters
[in]textPointer to string to be parsed
[in]textlenLength of text in bytes
[out]numPointer to ouput value filled with parsing result
Returns
Amount of bytes that were parsed

◆ gate_str_parse_hex_nibble()

GATE_CORE_API gate_bool_t gate_str_parse_hex_nibble ( gate_char8_t chr,
gate_uint8_t * value )

Parses a character for a hexadecimal nibble (0-9)|(a-f)

Parameters
[in]chrCharacter to be parsed
[out]valuePointer to ouput value filled with parsing result
Returns
true if nibble could be parsed, otherwise false

◆ gate_str_parse_int64()

GATE_CORE_API gate_size_t gate_str_parse_int64 ( gate_char8_t const * src,
gate_size_t srclen,
gate_int64_t * num )

Parses a string for a signed 64-bit decimal integer value.

Parameters
[in]srcPointer to string to be parsed
[in]srclenLength of src in bytes
[out]numPointer to ouput value filled with parsing result
Returns
Amount of bytes that were parsed

◆ gate_str_parse_line()

GATE_CORE_API gate_size_t gate_str_parse_line ( gate_char8_t const * text,
gate_size_t textlen,
gate_char8_t * buffer,
gate_size_t * bufferlen )

Parses a string for a full text line (until end-of-line character is detected)

Parameters
[in]textPointer to string to be parsed
[in]textlenLength of text in bytes
[out]bufferPointer to ouput buffer filled with parsed line content
[in,out]bufferlenPointer to size of buffer, updated with amout of used bytes after parsing (not including line-ending characters)
Returns
Amount of bytes that were totally parsed

◆ gate_str_parse_oct_byte()

GATE_CORE_API gate_bool_t gate_str_parse_oct_byte ( gate_char8_t const chr[3],
gate_uint8_t * value )

Parses a string for a octal number into a byte.

Parameters
[in]chr3-character string to be parsed
[out]valuePointer to ouput value filled with parsing result
Returns
true if parsing succeeded, otherwise false

◆ gate_str_parse_real()

GATE_CORE_API gate_size_t gate_str_parse_real ( gate_char8_t const * src,
gate_size_t srclen,
gate_real64_t * num )

Parses a string for 64-bit floating point decimal integer value.

Parameters
[in]srcPointer to string to be parsed
[in]srclenLength of src in bytes
[out]numPointer to ouput value filled with parsing result
Returns
Amount of bytes that were parsed

◆ gate_str_parse_uint64()

GATE_CORE_API gate_size_t gate_str_parse_uint64 ( gate_char8_t const * src,
gate_size_t srclen,
gate_uint64_t * num )

Parses a string for an unsigned 64-bit decimal integer value.

Parameters
[in]srcPointer to string to be parsed
[in]srclenLength of src in bytes
[out]numPointer to ouput value filled with parsing result
Returns
Amount of bytes that were parsed

◆ gate_str_pos()

GATE_CORE_API gate_size_t gate_str_pos ( gate_char8_t const * str,
gate_size_t len,
gate_char8_t const * find,
gate_size_t findlen,
gate_size_t startat )

Searches for the first occurance of a sub-string in a string.

Parameters
strpointer to first character in string
lenlength of string
findpointer to first character in sub-string token to search for
findlenlength of sub-string token to search for
startatcharacter offset in string where search starts
Returns
start position of found sub-string, or GATE_STR_NPOS if not found

◆ gate_str_print()

GATE_CORE_API gate_size_t gate_str_print ( gate_char8_t * dst,
gate_size_t dstlen,
... )

Prints pairs of (type + parameter) arguments into a destination string buffer.

Parameters
[in]dstPointer to destination string where output is printed to
[in]dstlenCapacity of destination string buffer dst
Returns
Amount of printed character bytes

◆ gate_str_print_hex()

GATE_CORE_API gate_size_t gate_str_print_hex ( gate_char8_t * dst,
gate_size_t dstlen,
gate_uint64_t num,
gate_size_t numlen,
gate_bool_t uppercase )

Prints a number as a hexadecimal number.

Parameters
[out]dstPointer to string to be updated
[in]dstlenCapacity of buffer in str in bytes
[in]numnumber to be printed
[in]numlenamount of bytes to be printed in target buffer (length limit, using leading zeros when required)
[in]uppercaseif true, uses upper case letters (A-F), otherwise lower case (a-f)
Returns
Amount of bytes used in dst

◆ gate_str_print_hex_buffer()

GATE_CORE_API gate_size_t gate_str_print_hex_buffer ( gate_char8_t * dst,
gate_size_t dstlen,
void const * buffer,
gate_size_t bufferlen,
gate_bool_t uppercase )

Prints a binary buffer as a hexadecimal number representation.

Parameters
[out]dstPointer to string to be updated
[in]dstlenCapacity of buffer in str in bytes
[in]bufferSource buffer thats bytes are printed
[in]bufferlenLength of buffer in bytes
[in]uppercaseif true, uses upper case letters (A-F), otherwise lower case (a-f)
Returns
Amount of bytes used in dst

◆ gate_str_print_hex_byte()

GATE_CORE_API gate_size_t gate_str_print_hex_byte ( gate_char8_t * dst,
gate_size_t dstlen,
gate_uint8_t num,
gate_bool_t uppercase )

Prints a byte as a hexadecimal number of 2 characters.

Parameters
[out]dstPointer to string to be updated
[in]dstlenCapacity of buffer in str in bytes
[in]numnumber to be printed
[in]uppercaseif true, uses upper case letters (A-F), otherwise lower case (a-f)
Returns
Amount of bytes used in dst

◆ gate_str_print_hex_nibble()

GATE_CORE_API gate_char8_t gate_str_print_hex_nibble ( gate_uint8_t nibble,
gate_bool_t uppercase )

Prints a 4-bit number (nibble) into a hexadecimal character.

Parameters
[in]nibble4-bit unsigned number to be printed
[in]uppercasetrue prints letters in upper case, otherwise lower case
Returns
Character mapping of number (0-9)|(a-f)

◆ gate_str_print_hex_num()

GATE_CORE_API gate_size_t gate_str_print_hex_num ( gate_char8_t * dst,
gate_size_t dstlen,
gate_uint64_t num,
gate_bool_t uppercase )

Prints a number as a hexadecimal number without leading zeros.

Parameters
[out]dstPointer to string to be updated
[in]dstlenCapacity of buffer in str in bytes
[in]numnumber to be printed
[in]uppercaseif true, uses upper case letters (A-F), otherwise lower case (a-f)
Returns
Amount of bytes used in dst

◆ gate_str_print_hex_uint16()

GATE_CORE_API gate_size_t gate_str_print_hex_uint16 ( gate_char8_t * dst,
gate_size_t dstlen,
gate_uint16_t num,
gate_bool_t uppercase )

Prints a 16-bit number as a hexadecimal number of 4 characters.

Parameters
[out]dstPointer to string to be updated
[in]dstlenCapacity of buffer in str in bytes
[in]numnumber to be printed
[in]uppercaseif true, uses upper case letters (A-F), otherwise lower case (a-f)
Returns
Amount of bytes used in dst

◆ gate_str_print_hex_uint32()

GATE_CORE_API gate_size_t gate_str_print_hex_uint32 ( gate_char8_t * dst,
gate_size_t dstlen,
gate_uint32_t num,
gate_bool_t uppercase )

Prints a 32-bit number as a hexadecimal number of 8 characters.

Parameters
[out]dstPointer to string to be updated
[in]dstlenCapacity of buffer in str in bytes
[in]numnumber to be printed
[in]uppercaseif true, uses upper case letters (A-F), otherwise lower case (a-f)
Returns
Amount of bytes used in dst

◆ gate_str_print_hex_uint64()

GATE_CORE_API gate_size_t gate_str_print_hex_uint64 ( gate_char8_t * dst,
gate_size_t dstlen,
gate_uint64_t num,
gate_bool_t uppercase )

Prints a 64-bit number as a hexadecimal number of 16 characters.

Parameters
[out]dstPointer to string to be updated
[in]dstlenCapacity of buffer in str in bytes
[in]numnumber to be printed
[in]uppercaseif true, uses upper case letters (A-F), otherwise lower case (a-f)
Returns
Amount of bytes used in dst

◆ gate_str_print_int16()

GATE_CORE_API gate_size_t gate_str_print_int16 ( gate_char8_t * dst,
gate_size_t dstlen,
gate_int16_t num )

Prints a 16 bit signed integer into a destination string buffer.

Parameters
[out]dstPointer to string to be updated
[in]dstlenCapacity of buffer in str in bytes
[in]numinteger to be printed
Returns
Amount of bytes used in dst

◆ gate_str_print_int32()

GATE_CORE_API gate_size_t gate_str_print_int32 ( gate_char8_t * dst,
gate_size_t dstlen,
gate_int32_t num )

Prints a 32 bit signed integer into a destination string buffer.

Parameters
[out]dstPointer to string to be updated
[in]dstlenCapacity of buffer in str in bytes
[in]numinteger to be printed
Returns
Amount of bytes used in dst

◆ gate_str_print_int64()

GATE_CORE_API gate_size_t gate_str_print_int64 ( gate_char8_t * dst,
gate_size_t dstlen,
gate_int64_t num )

Prints a 64 bit signed integer into a destination string buffer.

Parameters
[out]dstPointer to string to be updated
[in]dstlenCapacity of buffer in str in bytes
[in]numinteger to be printed
Returns
Amount of bytes used in dst

◆ gate_str_print_real()

GATE_CORE_API gate_size_t gate_str_print_real ( gate_char8_t * dst,
gate_size_t dstlen,
gate_real64_t num,
unsigned intlen,
unsigned decimallen,
unsigned grouplen )

Prints a floating point number into a destination string buffer.

A null-terminator will be appended in the buffer, but it is not counted

Parameters
[out]dstpointer to destination buffer to be filled
[in]dstlenbyte capacity of destination buffer
[in]numfloating point value to be printed
[in]intlenfixed length of size, 0: means free length, length < intlen: leading zeros are added, length > intlen: leading digits are cut off
[in]decimallenmaximum amount of post-comma digits, zero prints as much as possible
[in]grouplenlength of digits in a group (some cultures use 3 to separate 1000 steps), zero disables grouping
Returns
amount of bytes transferred into buffer

◆ gate_str_print_text()

GATE_CORE_API gate_size_t gate_str_print_text ( gate_char8_t * dst,
gate_size_t dstlen,
gate_char8_t const * txt,
gate_size_t txtlen )

Prints the text content of a 8-bit encoded string into a destination string buffer.

A null-terminator will be appended in the buffer, but it is not counted

Parameters
dstpointer to destination buffer to be filled
dstlenbyte capacity of destination buffer
txtpointer to first character in text to be printed into buffer
txtlenbyte length of string in txt to be printed
Returns
amount of bytes transferred into buffer

◆ gate_str_print_to()

GATE_CORE_API gate_size_t gate_str_print_to ( gate_str_printer_t printer,
void * printer_param,
va_list arg )

Prints pairs of (type + parameter) arguments using a user defined printer function.

Parameters
[in]printerPointer to printer-function that receives strings to print
[in]printer_paramUser parameter handed over to printer function
[in]argva_list arguments containing pairs of GATE_PRINT_* integers + data types
Returns
Amount of printed character bytes

◆ gate_str_print_uint()

GATE_CORE_API gate_size_t gate_str_print_uint ( gate_char8_t * dst,
gate_size_t dstlen,
gate_uint64_t num,
gate_size_t intlen )

Prints a unsigned integer as a decimal number into a destination string buffer.

A null-terminator will be appended in the buffer, but it is not counted

Parameters
dstpointer to destination buffer to be filled
dstlenbyte capacity of destination buffer
numunsigned integer to be printed
intlenfixed length of size, 0: means free length, length < intlen: leading zeros are added, length > intlen: leading digits are cut off
Returns
amount of bytes transferred into buffer

◆ gate_str_print_uint16()

GATE_CORE_API gate_size_t gate_str_print_uint16 ( gate_char8_t * dst,
gate_size_t dstlen,
gate_uint16_t num )

Prints a 16 bit unsigned signed integer into a destination string buffer.

Parameters
[out]dstPointer to string to be updated
[in]dstlenCapacity of buffer in str in bytes
[in]numinteger to be printed
Returns
Amount of bytes used in dst

◆ gate_str_print_uint32()

GATE_CORE_API gate_size_t gate_str_print_uint32 ( gate_char8_t * dst,
gate_size_t dstlen,
gate_uint32_t num )

Prints a 32 bit unsigned integer into a destination string buffer.

Parameters
[out]dstPointer to string to be updated
[in]dstlenCapacity of buffer in str in bytes
[in]numinteger to be printed
Returns
Amount of bytes used in dst

◆ gate_str_print_uint64()

GATE_CORE_API gate_size_t gate_str_print_uint64 ( gate_char8_t * dst,
gate_size_t dstlen,
gate_uint64_t num )

Prints a 64 bit unsigned integer into a destination string buffer.

Parameters
[out]dstPointer to string to be updated
[in]dstlenCapacity of buffer in str in bytes
[in]numinteger to be printed
Returns
Amount of bytes used in dst

◆ gate_str_print_values()

GATE_CORE_API gate_size_t gate_str_print_values ( gate_char8_t * dst,
gate_size_t dstlen,
gate_print_value_t const * values,
gate_size_t values_count )

Prints an array of type + parameter arguments into a destination string buffer.

Parameters
[out]dstPointer to destination string where output is printed to
[in]dstlenCapacity of destination string buffer dst
[in]valuesPointer to first gate_print_value_t structure in an array
[in]values_countAmount of gate_print_value_t structures in array
Returns
Amount of printed character bytes

◆ gate_str_print_wtext()

GATE_CORE_API gate_size_t gate_str_print_wtext ( gate_char8_t * dst,
gate_size_t dstlen,
wchar_t const * txt,
gate_size_t txtlen )

Prints the text content of a wide string into a destination string buffer.

A null-terminator will be appended in the buffer, but it is not counted

Parameters
dstpointer to destination buffer to be filled
dstlenbyte capacity of destination buffer
txtpointer to first character in text to be printed into buffer
txtlenamount of wide-characters in the text to be printed
Returns
amount of bytes transferred into buffer

◆ gate_str_replace()

GATE_CORE_API gate_size_t gate_str_replace ( gate_char8_t * str,
gate_size_t len,
gate_char8_t find,
gate_char8_t replace )

Replaces all occurances of a character in a string with another character.

Parameters
[in]strPointer to string to be updated
[in]lenLength of str in bytes
[in]findCharacter to be searched for
[in]replaceCharacter to replace all found characters of value find
Returns
Amount of characters that were replaced

◆ gate_str_reverse()

GATE_CORE_API void gate_str_reverse ( gate_char8_t * str,
gate_size_t len )

Reverses the bytes sequence of a string (first <-> last)

Parameters
strpointer to first character in string
lenlength of string

◆ gate_str_starts_with()

GATE_CORE_API gate_bool_t gate_str_starts_with ( gate_char8_t const * str,
gate_size_t len,
gate_char8_t const * starttoken,
gate_size_t startlen )

Detects if a string starts with the content of another string exactly.

Parameters
strpointer to string to be analyzed
lenlength of text in str in bytes
starttokenpointer to string with expected start token
startlenlength of text in starttoken in bytes
Returns
true if str begins with startoken's content

◆ gate_str_starts_with_ic()

GATE_CORE_API gate_bool_t gate_str_starts_with_ic ( gate_char8_t const * str,
gate_size_t len,
gate_char8_t const * starttoken,
gate_size_t startlen )

Detects if a string starts with the content of another string by comparing case insensitive.

Parameters
strpointer to string to be analyzed
lenlength of text in str in bytes
starttokenpointer to string with expected start token
startlenlength of text in starttoken in bytes
Returns
true if str begins with startoken's content

◆ gate_str_to_lower()

GATE_CORE_API void gate_str_to_lower ( gate_char8_t * str,
gate_size_t len )

Converts all ASCII characters in a string to their lower-case counterparts.

Parameters
strpointer to first character in string
lenlength of string

◆ gate_str_to_upper()

GATE_CORE_API void gate_str_to_upper ( gate_char8_t * str,
gate_size_t len )

Converts all ASCII characters in a string to their upper-case counterparts.

Parameters
strpointer to first character in string
lenlength of string

◆ gate_str_utf16_2_utf32()

GATE_CORE_API gate_size_t gate_str_utf16_2_utf32 ( gate_char16_t const * src,
gate_size_t srclen,
gate_char32_t * dst,
gate_size_t dstlen )

Converts an UTF-16 input buffer into an UTF-32 output buffer.

Parameters
srcpointer to first 16-bit word in UTF-16 input buffer
srclenlength of 16-bit words in UTF-16 input buffer
dstpointer to first 32-bit word in UTF-32 output buffer
dstlenlength of UTF-32 output buffer in 32-bit words
Returns
amount of used 32-bit words in output buffer

◆ gate_str_utf16_2_utf8()

GATE_CORE_API gate_size_t gate_str_utf16_2_utf8 ( gate_char16_t const * src,
gate_size_t srclen,
gate_char8_t * dst,
gate_size_t dstlen )

Converts an UTF-16 input buffer into an UTF-8 output buffer.

Parameters
srcpointer to first 16-bit word in UTF-16 input buffer
srclenlength of 16-bit words in UTF-16 input buffer
dstpointer to first byte in UTF-8 output buffer
dstlenlength of UTF-8 output buffer in bytes
Returns
amount of used bytes in output buffer

◆ gate_str_utf32_2_utf16()

GATE_CORE_API gate_size_t gate_str_utf32_2_utf16 ( gate_char32_t const * src,
gate_size_t srclen,
gate_char16_t * dst,
gate_size_t dstlen )

Converts an UTF-32 input buffer into an UTF-16 output buffer.

Parameters
srcpointer to first 32-bit word in UTF-32 input buffer
srclenlength of 32-bit words in UTF-32 input buffer
dstpointer to first 16-bit word in UTF-16 output buffer
dstlenlength of UTF-16 output buffer in 16-bit words
Returns
amount of used 16-bit words in output buffer

◆ gate_str_utf32_2_utf8()

GATE_CORE_API gate_size_t gate_str_utf32_2_utf8 ( gate_char32_t const * src,
gate_size_t srclen,
gate_char8_t * dst,
gate_size_t dstlen )

Converts an UTF-32 input buffer into an UTF-8 output buffer.

Parameters
srcpointer to first 32-bit word in UTF-32 input buffer
srclenlength of 32-bit words in UTF-32 input buffer
dstpointer to first byte in UTF-8 output buffer
dstlenlength of UTF-8 output buffer in bytes
Returns
amount of used bytes in output buffer

◆ gate_str_utf8_2_utf16()

GATE_CORE_API gate_size_t gate_str_utf8_2_utf16 ( gate_char8_t const * src,
gate_size_t srclen,
gate_char16_t * dst,
gate_size_t dstlen )

Converts an UTF-8 input buffer into an UTF-16 output buffer.

Parameters
srcpointer to first byte in UTF-8 input buffer
srclenlength of bytes in UTF-8 input buffer
dstpointer to first word in UTF-16 output buffer
dstlenlength of UTF-16 output buffer in 16-bit words
Returns
amount of used 16-bit words in output buffer

◆ gate_str_utf8_2_utf32()

GATE_CORE_API gate_size_t gate_str_utf8_2_utf32 ( gate_char8_t const * src,
gate_size_t srclen,
gate_char32_t * dst,
gate_size_t dstlen )

Converts an UTF-8 input buffer into an UTF-32 output buffer.

Parameters
srcpointer to first byte in UTF-8 input buffer
srclenlength of bytes in UTF-8 input buffer
dstpointer to first word in UTF-32 output buffer
dstlenlength of UTF-32 output buffer in 32-bit words
Returns
amount of used 32-bit words in output buffer

◆ gate_strbuilder_create()

GATE_CORE_API void gate_strbuilder_create ( gate_strbuilder_t * builder,
gate_size_t capacity )

Creates a string-builder instance and tries to preallocate memory for the requested capacity.

If capacity allocation fails, string-builder starts with an empty buffer, no error is generated

Parameters
[out]builderPointer to string-builder to be initialized
[in]capacityAmount of bytes of preallocated buffer capacity in string-builder

◆ gate_strbuilder_create_static()

GATE_CORE_API void gate_strbuilder_create_static ( gate_strbuilder_t * builder,
char * buffer,
gate_size_t capacity,
gate_size_t length_used )

Creates a string-builder instance and binds it to a static (external) buffer.

A static string builder cannot grow over the size of the given external buffer

Parameters
[out]builderPointer to string-builder to be initialized
[in]bufferExternal buffer to be used within string-builder
[in]capacityTotal capacity of buffer
[in]length_usedLength of bytes in buffer that are already valid as a string

◆ gate_strbuilder_increase()

GATE_CORE_API gate_size_t gate_strbuilder_increase ( gate_strbuilder_t * builder,
gate_size_t sz )

Tries to increase the allocated size of a string builder.

Parameters
[in]builderPointer to string-builder to be accessed
[in]szAmount of bytes to increase the internal buffer size
Returns
New capacity if internal buffer in bytes

◆ gate_strbuilder_length()

GATE_CORE_API gate_size_t gate_strbuilder_length ( gate_strbuilder_t const * builder)

Returns the currently used length of text in a string builder.

Parameters
[in]builderPointer to string-builder to be accessed
Returns
Length of contained string in bytes

◆ gate_strbuilder_ptr()

GATE_CORE_API gate_char8_t const * gate_strbuilder_ptr ( gate_strbuilder_t const * builder,
gate_size_t charpos )

Returns a pointer to the character within the string builder buffer at the given position.

Parameters
[in]builderPointer to string-builder to be accessed
[in]charposPosition of character to be accessed
Returns
Pointer to character, or NULL if charpos is out of range.

◆ gate_strbuilder_release()

GATE_CORE_API void gate_strbuilder_release ( gate_strbuilder_t * builder)

Releases all allocated resources of a stringbuilder object.

Parameters
[in]builderPointer to string-builder to be released

◆ gate_strbuilder_resize()

GATE_CORE_API gate_size_t gate_strbuilder_resize ( gate_strbuilder_t * builder,
gate_size_t sz )

Tries to resize the internal buffer of a string builder.

Parameters
[in]builderPointer to string-builder to be accessed
[in]szSize in bytes of requested new size
Returns
New capacity of builder, or 0 in case of an error