1 /* 2 3 Copyright (c) 2012 NFG Net Facilities Group BV support@nfg.nl 4 5 This program is free software; you can redistribute it and/or 6 modify it under the terms of the GNU General Public License 7 as published by the Free Software Foundation; either 8 version 2 of the License, or (at your option) any later 9 version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program; if not, write to the Free Software 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 */ 20 21 /* 22 * ADT interface for Strings allocated from Memory Pool 23 * 24 */ 25 26 27 #ifndef DM_STRING_H 28 #define DM_STRING_H 29 30 #include <stdint.h> 31 #include "dm_mempool.h" 32 33 typedef struct String_T *String_T; 34 35 extern String_T p_string_new(Mempool_T, const char *); 36 extern String_T p_string_assign(String_T, const char *); 37 extern void p_string_printf(String_T, const char *, ...); 38 extern void p_string_append_printf(String_T, const char *, ...); 39 extern void p_string_append_vprintf(String_T, const char *, va_list); 40 extern void p_string_append_len(String_T, const char *, size_t); 41 extern String_T p_string_erase(String_T, size_t, int); 42 extern String_T p_string_truncate(String_T, size_t); 43 extern uint64_t p_string_len(String_T); 44 extern const char * p_string_str(String_T); 45 extern void p_string_unescape(String_T); 46 extern char * p_string_free(String_T, gboolean); 47 extern char * p_trim(char *str, const char *seps); 48 49 #define p_string_append(S, s) p_string_append_len(S, s, strlen(s)) 50 51 #endif 52