1 /* 2 dynamicstring.h 3 4 String utilities 5 6 $Id: dynamicstring.h,v 1.3 2000/05/12 16:52:41 enz Exp $ 7 */ 8 9 #ifndef DYNAMICSTRING_H 10 #define DYNAMICSTRING_H 11 12 #if HAVE_CONFIG_H 13 #include <config.h> 14 #endif 15 16 #include <sys/types.h> 17 18 /* A dynamically growing string */ 19 struct DynStr; 20 typedef struct DynStr DynStr; 21 22 /* Create new DynStr with given capacity */ 23 DynStr * 24 new_DynStr( int reserve ); 25 26 /* Delete DynStr */ 27 void 28 del_DynStr( DynStr *self ); 29 30 /* Return DynStr's length */ 31 int 32 DynStr_len( const DynStr *self ); 33 34 /* Return DynStr's content ptr */ 35 const char * 36 DynStr_str( const DynStr *self ); 37 38 /* append C-string to DynStr */ 39 void 40 DynStr_app( DynStr *self, const char *s ); 41 42 /* append a DynStr to DynStr */ 43 void 44 DynStr_appDynStr( DynStr *self, const DynStr *s ); 45 46 /* Append C-string + newline to DynStr */ 47 void 48 DynStr_appLn( DynStr *self, const char *s ); 49 50 /* Append a maximum of n characters from C-string s to DynStr self */ 51 void 52 DynStr_appN( DynStr *self, const char *s, int n ); 53 54 /* Truncate content of DynString to zero length */ 55 void 56 DynStr_clear( DynStr *self ); 57 58 #endif 59