squareball 0.2.0.29-1f41 A general-purpose library for C99

- Main Page
- Data Structures
- Files
- Examples

- File List
- Globals

All Data Structures Files Functions Variables Typedefs
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
53 sb_string_t* sb_string_new(void);
54
66 char* sb_string_free(sb_string_t *str, bool free_str);
67
74 sb_string_t* sb_string_dup(sb_string_t *str);
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
103 sb_string_t* sb_string_append_c(sb_string_t *str, char c);
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_append_c
sb_string_t * sb_string_append_c(sb_string_t *str, char c)
sb_string_t::allocated_len
size_t allocated_len
Definition: sb-string.h:44
sb_string_free
char * sb_string_free(sb_string_t *str, bool free_str)
sb_string_append_printf
sb_string_t * sb_string_append_printf(sb_string_t *str, const char *format,...)
sb_string_append_len
sb_string_t * sb_string_append_len(sb_string_t *str, const char *suffix, size_t len)
sb_string_dup
sb_string_t * sb_string_dup(sb_string_t *str)
sb_string_t::len
size_t len
Definition: sb-string.h:38
sb_string_t
Definition: sb-string.h:27
sb_string_append_escaped
sb_string_t * sb_string_append_escaped(sb_string_t *str, const char *suffix)
sb_string_t::str
char * str
Definition: sb-string.h:33
sb_string_new
sb_string_t * sb_string_new(void)
sb_string_append
sb_string_t * sb_string_append(sb_string_t *str, const char *suffix)