squareball  0.2.0.53-dd5b
A general-purpose library for C99
sb-string.h
Go to the documentation of this file.
1 /*
2  * squareball: A general-purpose library for C99.
3  * Copyright (C) 2014-2018 Rafael G. Martins <rafael@rafaelmartins.eng.br>
4  *
5  * This program can be distributed under the terms of the BSD License.
6  * See the file LICENSE.
7  */
8 
9 #ifndef _SQUAREBALL_STRING_H
10 #define _SQUAREBALL_STRING_H
11 
12 #include <stdarg.h>
13 #include <stdbool.h>
14 #include <stdlib.h>
15 
27 typedef struct {
28 
33  char *str;
34 
38  size_t len;
39 
44  size_t allocated_len;
45 
46 } sb_string_t;
47 
54 
66 char* sb_string_free(sb_string_t *str, bool free_str);
67 
75 
85 sb_string_t* sb_string_append_len(sb_string_t *str, const char *suffix, size_t len);
86 
94 sb_string_t* sb_string_append(sb_string_t *str, const char *suffix);
95 
104 
113 sb_string_t* sb_string_append_printf(sb_string_t *str, const char *format, ...);
114 
123 sb_string_t* sb_string_append_escaped(sb_string_t *str, const char *suffix);
124 
127 #endif /* _SQUAREBALL_STRING_H */
sb_string_t * sb_string_append_c(sb_string_t *str, char c)
size_t allocated_len
Definition: sb-string.h:44
char * sb_string_free(sb_string_t *str, bool free_str)
sb_string_t * sb_string_append_printf(sb_string_t *str, const char *format,...)
sb_string_t * sb_string_append_len(sb_string_t *str, const char *suffix, size_t len)
sb_string_t * sb_string_dup(sb_string_t *str)
size_t len
Definition: sb-string.h:38
Definition: sb-string.h:27
sb_string_t * sb_string_append_escaped(sb_string_t *str, const char *suffix)
char * str
Definition: sb-string.h:33
sb_string_t * sb_string_new(void)
sb_string_t * sb_string_append(sb_string_t *str, const char *suffix)