1 /* Copyright David Abrahams 2004. Distributed under the Boost */
2 /* Software License, Version 1.0. (See accompanying */
3 /* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */
4 #ifndef JAMH_KSTRINGS_H
5 #define JAMH_KSTRINGS_H
8 //#define KSTRINGS_DEBUG
14 # define KJAMFA_PURE JAMFA_PURE
28 extern void kStringNew (tKString
*s
);
29 extern void kStringNewCStr (tKString
*s
, char const *rhs
);
30 extern void kStringFree (tKString
*s
);
31 extern void kStringClear (tKString
*s
); // clear allocated string; will not free allocated memory though
32 extern void kStringReserve (tKString
*s
, int capacity
);
33 extern void kStringAppendCStr (tKString
*s
, char const *str
);
34 extern void kStringAppendBytes (tKString
*s
, char const *start
, int len
); // len<0: use strlen()
35 extern void kStringAppendRange (tKString
*s
, char const *start
, char const *finish
); // *finish will not be included
36 extern void kStringTruncate (tKString
*s
, int n
);
37 extern char kStringPopBack (tKString
*s
); // returns 'popped' char (0 if string is empty)
38 extern void kStringPushBack (tKString
*s
, char x
);
39 extern char kStringLastChar (tKString
*s
) KJAMFA_PURE
; // return last char (0 if string is empty)
40 extern char *kStringCStr (tKString
*s
) KJAMFA_PURE
;
41 extern int kStringLen (tKString
*s
) KJAMFA_PURE
;
44 extern void kStringUnitTest (void);