Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
wmem_strbuf.h
1 /* wmem_strbuf.h
2  * Definitions for the Wireshark Memory Manager String Buffer
3  * Copyright 2012, Evan Huus <eapache@gmail.com>
4  *
5  * Wireshark - Network traffic analyzer
6  * By Gerald Combs <gerald@wireshark.org>
7  * Copyright 1998 Gerald Combs
8  *
9  * SPDX-License-Identifier: GPL-2.0-or-later
10  */
11 
12 #ifndef __WMEM_STRBUF_H__
13 #define __WMEM_STRBUF_H__
14 
15 #include <string.h>
16 #include <glib.h>
17 
18 #include "wmem_core.h"
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif /* __cplusplus */
23 
33 struct _wmem_strbuf_t;
34 
35 typedef struct _wmem_strbuf_t wmem_strbuf_t;
36 
37 WS_DLL_PUBLIC
39 wmem_strbuf_sized_new(wmem_allocator_t *allocator,
40  gsize alloc_len, gsize max_len)
41 G_GNUC_MALLOC;
42 
43 #define wmem_strbuf_new_label(ALLOCATOR) \
44  wmem_strbuf_sized_new((ALLOCATOR), 0, ITEM_LABEL_LENGTH)
45 
46 WS_DLL_PUBLIC
48 wmem_strbuf_new(wmem_allocator_t *allocator, const gchar *str)
49 G_GNUC_MALLOC;
50 
51 WS_DLL_PUBLIC
52 void
53 wmem_strbuf_append(wmem_strbuf_t *strbuf, const gchar *str);
54 
55 WS_DLL_PUBLIC
56 void
57 wmem_strbuf_append_printf(wmem_strbuf_t *strbuf, const gchar *format, ...)
58 G_GNUC_PRINTF(2, 3);
59 
60 WS_DLL_PUBLIC
61 void
62 wmem_strbuf_append_c(wmem_strbuf_t *strbuf, const gchar c);
63 
64 WS_DLL_PUBLIC
65 void
66 wmem_strbuf_append_unichar(wmem_strbuf_t *strbuf, const gunichar c);
67 
68 WS_DLL_PUBLIC
69 void
70 wmem_strbuf_truncate(wmem_strbuf_t *strbuf, const gsize len);
71 
72 WS_DLL_PUBLIC
73 const gchar *
74 wmem_strbuf_get_str(wmem_strbuf_t *strbuf);
75 
76 WS_DLL_PUBLIC
77 gsize
78 wmem_strbuf_get_len(wmem_strbuf_t *strbuf);
79 
85 WS_DLL_PUBLIC
86 char *
88 
92 #ifdef __cplusplus
93 }
94 #endif /* __cplusplus */
95 
96 #endif /* __WMEM_STRBUF_H__ */
97 
98 /*
99  * Editor modelines - http://www.wireshark.org/tools/modelines.html
100  *
101  * Local variables:
102  * c-basic-offset: 4
103  * tab-width: 8
104  * indent-tabs-mode: nil
105  * End:
106  *
107  * vi: set shiftwidth=4 tabstop=8 expandtab:
108  * :indentSize=4:tabSize=8:noTabs=true:
109  */
Definition: wmem_strbuf.c:36
Definition: wmem_allocator.h:26
WS_DLL_PUBLIC char * wmem_strbuf_finalize(wmem_strbuf_t *strbuf)
Definition: wmem_strbuf.c:272