|
libamxc
1.10.3
C Generic Data Containers
|
Ambiorix string API header file. More...
#include <stddef.h>#include <stdbool.h>#include <stdint.h>#include <stdarg.h>#include <amxc/amxc_common.h>#include <amxc/amxc_llist.h>Go to the source code of this file.
Data Structures | |
| struct | _amxc_string |
| The string structure. More... | |
Macros | |
| #define | AMXC_STRING_MAX SIZE_MAX |
| #define | amxc_string_from_llist_it(ll_it) amxc_container_of(ll_it, amxc_string_t, it) |
| Get the pointer to a string structure from an amxc linked list iterator. More... | |
Typedefs | |
| typedef struct _amxc_string | amxc_string_t |
| The string structure. More... | |
| typedef enum _amxc_string_flags | amxc_string_flags_t |
| amxc_string_set_at possible flags More... | |
| typedef int(* | amxc_string_is_char_fn_t) (int c) |
| Definition of the signature of the "is char" callback function. More... | |
| typedef bool(* | amxc_string_is_safe_cb_t) (const char *replacement) |
| Checks if given replacement is safe to be included in a bigger string in a particular language. More... | |
Enumerations | |
| enum | _amxc_string_flags { amxc_string_no_flags = 0x00 , amxc_string_insert = 0x00 , amxc_string_overwrite = 0x01 } |
| amxc_string_set_at possible flags More... | |
Functions | |
| int | amxc_string_new (amxc_string_t **string, const size_t length) |
| Allocates a string. More... | |
| void | amxc_string_delete (amxc_string_t **string) |
| Frees the previously allocated string. More... | |
| int | amxc_string_init (amxc_string_t *const string, const size_t length) |
| Initializes a string. More... | |
| void | amxc_string_clean (amxc_string_t *const string) |
| Frees the string buffer and reset length attributes. More... | |
| void | amxc_string_reset (amxc_string_t *const string) |
| Resets the buffer, reset the content to all 0. More... | |
| int | amxc_string_copy (amxc_string_t *const dest, const amxc_string_t *const src) |
| Copies the content. More... | |
| int | amxc_string_grow (amxc_string_t *const string, const size_t length) |
| Grows the string buffer. More... | |
| int | amxc_string_shrink (amxc_string_t *const string, const size_t length) |
| Shrinks the string buffer. More... | |
| int | amxc_string_set_at (amxc_string_t *const string, const size_t pos, const char *const text, const size_t length, const amxc_string_flags_t flags) |
| Set text in the string buffer at a certain position. More... | |
| int | amxc_string_remove_at (amxc_string_t *const string, const size_t pos, size_t length) |
| Removes part of the text in the string buffer. More... | |
| const char * | amxc_string_get (const amxc_string_t *const string, const size_t offset) |
| Gets the content of the string buffer. More... | |
| char * | amxc_string_take_buffer (amxc_string_t *const string) |
| Takes the string buffer. More... | |
| int | amxc_string_push_buffer (amxc_string_t *const string, char *buffer, size_t length) |
| Sets the string buffer. More... | |
| char * | amxc_string_dup (const amxc_string_t *const string, const size_t start, size_t length) |
| Creates a full or partial copy of the text in the string buffer. More... | |
| void | amxc_string_triml (amxc_string_t *const string, amxc_string_is_char_fn_t fn) |
| Trim left. More... | |
| void | amxc_string_trimr (amxc_string_t *const string, amxc_string_is_char_fn_t fn) |
| Trim right. More... | |
| void | amxc_string_trim (amxc_string_t *const string, amxc_string_is_char_fn_t fn) |
| Trim. More... | |
| int | amxc_string_vsetf (amxc_string_t *const string, const char *fmt, va_list ap) |
| Sets the content of the string using printf like formatting. More... | |
| int | amxc_string_setf (amxc_string_t *const string, const char *fmt,...) __attribute__((format(printf |
| Sets the content of the string using printf like formatting. More... | |
| int int | amxc_string_vsetf_checked (amxc_string_t *const string, amxc_string_is_safe_cb_t is_safe_cb, const char *fmt, va_list args) |
| va_list version of amxc_string_setf_checked More... | |
| int | amxc_string_setf_checked (amxc_string_t *target_string, amxc_string_is_safe_cb_t is_safe_cb, const char *fmt,...) __attribute__((format(printf |
| Sets the content of a string using printf like formatting while performing safety checks on the replacements. More... | |
| int int | amxc_string_vappendf (amxc_string_t *const string, const char *fmt, va_list ap) |
| Appends a formatted string to a string. More... | |
| int | amxc_string_appendf (amxc_string_t *const string, const char *fmt,...) __attribute__((format(printf |
| Appends a formatted string to a string. More... | |
| int int | amxc_string_vappendf_checked (amxc_string_t *target_string, amxc_string_is_safe_cb_t is_safe_cb, const char *fmt, va_list args) |
| va_list version of amxc_string_appendf_checked More... | |
| int | amxc_string_appendf_checked (amxc_string_t *string, amxc_string_is_safe_cb_t is_safe_cb, const char *fmt,...) __attribute__((format(printf |
| Appends a formatted string while performing safety checks on the replacements. More... | |
| int int | amxc_string_vprependf (amxc_string_t *const string, const char *fmt, va_list ap) |
| Prepends a formatted string to a string. More... | |
| int | amxc_string_prependf (amxc_string_t *const string, const char *fmt,...) __attribute__((format(printf |
| Prepends a formatted string to a string. More... | |
| int bool | amxc_string_is_numeric (const amxc_string_t *const string) |
| Checks if a string is fully numeric. More... | |
| int | amxc_string_search (const amxc_string_t *const string, const char *needle, uint32_t start_pos) |
| Searches a sub-string in a string. More... | |
| int | amxc_string_replace (amxc_string_t *const string, const char *needle, const char *newstr, uint32_t max) |
| Replaces a number of sub-string occurrences in a string. More... | |
| int | amxc_string_to_upper (amxc_string_t *const string) |
| Converts all lower case characters to upper case. More... | |
| int | amxc_string_to_lower (amxc_string_t *const string) |
| Converts all upper case characters to lower case. More... | |
| AMXC_INLINE int | amxc_string_append (amxc_string_t *const string, const char *const text, const size_t length) |
| Appends text to the end of the current content of the string buffer. More... | |
| AMXC_INLINE int | amxc_string_prepend (amxc_string_t *const string, const char *const text, const size_t length) |
| Inserts text at the beginning of the current content of the string buffer. More... | |
| AMXC_INLINE size_t | amxc_string_buffer_length (const amxc_string_t *const string) |
| Gets the current size of the allocate string buffer. More... | |
| AMXC_INLINE size_t | amxc_string_text_length (const amxc_string_t *const string) |
| Gets the current size of the used string buffer. More... | |
| AMXC_INLINE bool | amxc_string_is_empty (const amxc_string_t *const string) |
| Checks if the string is empty. More... | |
| AMXC_INLINE int | amxc_string_insert_at (amxc_string_t *const string, const size_t pos, const char *text, size_t length) |
| Inserts a string of the given length into a string at a certain position. More... | |
| size_t | amxc_string_set (amxc_string_t *const string, const char *text) |
| Sets a 0 terminated string in the string buffer. More... | |
| int | amxc_string_bytes_2_hex_binary (amxc_string_t *const string, const char bytes[], const uint32_t len, const char *sep) |
| Creates a hexbinary string from an array of bytes. More... | |
| int | amxc_string_hex_binary_2_bytes (const amxc_string_t *const string, char **bytes, uint32_t *len, const char *sep) |
| Creates an array of bytes from a hex binary string. More... | |
Ambiorix string API header file.
Definition in file amxc_string.h.
| #define AMXC_STRING_MAX SIZE_MAX |
Definition at line 71 of file amxc_string.h.