forked from metalab-kassomat/kassomat-payout
-
Notifications
You must be signed in to change notification settings - Fork 0
/
StringBuffer.h
23 lines (18 loc) · 1.07 KB
/
StringBuffer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
* Taken from: https://sites.google.com/site/rickcreamer/Home/cc/c-implementation-of-stringbuffer-functionality
*/
#ifndef _STRINGBUFFER_H_
#define _STRINGBUFFER_H_
struct StringBuffer; /* Forward declaration of StringBuffer symbol for typedef line */
typedef struct StringBuffer SB; /* Forward typedef declaration so can use SB in struct definition */
struct StringBuffer {
size_t count; /* Number of strings appended */
size_t capacity; /* Length of ptrList */
char **ptrList; /* Array of char * pointers added w/ append() */
void (*append) ( SB *sb, char *s ); /* The append() function pointer */
char * (*toString) ( SB *sb ); /* The toString() function pointer */
void (*dispose) ( SB **sb ); /* The dispose() function pointer */
};
/* Only quasi-public function - remainder wrapped in StringBuffer struct members */
SB *getStringBuffer();
#endif