summaryrefslogtreecommitdiff
path: root/lib/stringbuf.h
blob: 95474cbde1cce19974456ec37b0cb976787f208b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef _STRINGBUF_H_
#define _STRINGBUF_H_

/** \file lib/stringbuf.h
 *
 */

typedef /*@abstract@*/ struct StringBufRec *StringBuf;

#ifdef __cplusplus
extern "C" {
#endif

/*@only@*/ StringBuf newStringBuf(void);
void freeStringBuf( /*@only@*/ StringBuf sb);
void truncStringBuf(StringBuf sb);
/*@observer@*/ char *getStringBuf(StringBuf sb);
void stripTrailingBlanksStringBuf(StringBuf sb);

#define appendStringBuf(sb, s)     appendStringBufAux(sb, s, 0)
#define appendLineStringBuf(sb, s) appendStringBufAux(sb, s, 1)

void appendStringBufAux(StringBuf sb, const char *s, int nl);

#ifdef __cplusplus
}
#endif

#endif	/* _STRINGBUF_H_ */