-
Notifications
You must be signed in to change notification settings - Fork 0
/
csString.h
37 lines (30 loc) · 831 Bytes
/
csString.h
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
30
31
32
33
34
35
36
37
#ifndef csString_H_
#define csString_H_
#include "adt.h"
// Declare csString instance.
typedef struct csString {
struct csStringMethods *methods;
int size;
char * contents;
} csString, *csStringRef;
// Declare types of methods.
typedef uint32_t (*pfn_uint32_csStringRef)(csStringRef);
typedef bool (*pfn_bool_csStringRefAdtRef)(csStringRef, csAdtRef);
typedef char * (*pfn_cstr_csStringRef)(csStringRef);
typedef int (*pfn_int_csStringRef)(csStringRef);
// Declare csString interface.
typedef struct csStringMethods {
pfn_uint32_csStringRef hash;
pfn_bool_csStringRefAdtRef equals;
pfn_cstr_csStringRef description;
pfn_int_csStringRef size;
pfn_cstr_csStringRef cStr;
} csStringMethods, *csStringMethodsRef;
#ifdef __cplusplus
extern "C" {
#endif
csStringRef newCSString(char *);
#ifdef __cplusplus
}
#endif
#endif