BAM
Abstract Machine for Bottom-Up Evaluation with the Push Method
str.h
Go to the documentation of this file.
1 // ============================================================================
2 // Project: Deductive Database
3 // Filename: str.h
4 // Purpose: The String Datatype
5 // Last Change: 04.08.2017
6 // Language: C++
7 // EMail: brass@informatik.uni-halle.de
8 // WWW: http://www.informatik.uni-halle.de/~brass/
9 // Address: Feldschloesschen 15, D-06120 Halle (Saale), GERMANY
10 // Copyright: (c) 1998-2017 by Stefan Brass
11 // License: See file "LICENSE" for copying conditions.
12 // Note: There is no warranty at all - this code may contain bugs.
13 // ============================================================================
14 
15 
22 //=============================================================================
23 // Include File Frame:
24 //=============================================================================
25 
26 #ifndef STR_INCLUDED
27 #define STR_INCLUDED
28 
29 //=============================================================================
30 // Exported Types:
31 //=============================================================================
32 
33 //-----------------------------------------------------------------------------
34 // str_t:
35 //-----------------------------------------------------------------------------
36 
41 typedef const char *str_t;
42 
43 
44 //-----------------------------------------------------------------------------
45 // STR_NULL:
46 //-----------------------------------------------------------------------------
47 
52 #define STR_NULL (static_cast<str_t>(0))
53 
54 
55 //=============================================================================
56 // Exported Functions:
57 //=============================================================================
58 
59 //-----------------------------------------------------------------------------
60 // str_len:
61 //-----------------------------------------------------------------------------
62 
67 int str_len(register str_t str);
68 
69 //-----------------------------------------------------------------------------
70 // str_cpy:
71 //-----------------------------------------------------------------------------
72 
81 void str_cpy(register char* buf, int len, register str_t str);
82 
83 //-----------------------------------------------------------------------------
84 // str_cat:
85 //-----------------------------------------------------------------------------
86 
95 void str_cat(register char* buf, int len, register str_t str);
96 
97 //-----------------------------------------------------------------------------
98 // str_eq:
99 //-----------------------------------------------------------------------------
100 
112 bool str_eq(register str_t str1, register str_t str2);
113 
114 //-----------------------------------------------------------------------------
115 // str_contains:
116 //-----------------------------------------------------------------------------
117 
122 bool str_contains(register char c, register str_t str);
123 
124 //-----------------------------------------------------------------------------
125 // str_indent:
126 //-----------------------------------------------------------------------------
127 
132 str_t str_indent(int n);
133 
134 //-----------------------------------------------------------------------------
135 // str_error:
136 //-----------------------------------------------------------------------------
137 
142 void str_error(int err_no, char *buf, int buf_size);
143 
144 //-----------------------------------------------------------------------------
145 // STR_ERRMSG_LEN:
146 //-----------------------------------------------------------------------------
147 
152 #define STR_ERRMSG_LEN 80
153 
154 //-----------------------------------------------------------------------------
155 // str_uint:
156 //-----------------------------------------------------------------------------
157 
162 int str_uint(char *buf, int buf_len, unsigned int n);
163 
164 //-----------------------------------------------------------------------------
165 // str_int:
166 //-----------------------------------------------------------------------------
167 
172 int str_int(char *buf, int buf_len, int n);
173 
174 //-----------------------------------------------------------------------------
175 // STR_INT_LEN:
176 //-----------------------------------------------------------------------------
177 
182 #define STR_INT_LEN 11
183 
184 //-----------------------------------------------------------------------------
185 // str_fill:
186 //-----------------------------------------------------------------------------
187 
194 str_t str_fill(int n, int field_width);
195 
196 //-----------------------------------------------------------------------------
197 // str_ptr:
198 //-----------------------------------------------------------------------------
199 
204 int str_ptr(char *buf, int buf_len, const void *ptr);
205 
206 //-----------------------------------------------------------------------------
207 // STR_PTR_LEN:
208 //-----------------------------------------------------------------------------
209 
214 #define STR_PTR_LEN 17
215 
216 //=============================================================================
217 // End of File:
218 //=============================================================================
219 
220 #endif
221 
str_t str_indent(int n)
Definition: str.cpp:150
bool str_eq(register str_t str1, register str_t str2)
Definition: str.cpp:112
int str_int(char *buf, int buf_len, int n)
Definition: str.cpp:250
void str_error(int err_no, char *buf, int buf_size)
Definition: str.cpp:172
void str_cpy(register char *buf, int len, register str_t str)
Definition: str.cpp:49
int str_len(register str_t str)
Definition: str.cpp:34
void str_cat(register char *buf, int len, register str_t str)
Definition: str.cpp:88
str_t str_fill(int n, int field_width)
Definition: str.cpp:286
const char * str_t
Definition: str.h:41
bool str_contains(register char c, register str_t str)
Definition: str.cpp:132
int str_ptr(char *buf, int buf_len, const void *ptr)
Definition: str.cpp:319
int str_uint(char *buf, int buf_len, unsigned int n)
Definition: str.cpp:197