Lines Matching refs:string
2 * Simple string interface allows indiscriminate allocation of strings
4 * one chunk via a string factory - saves lots of hassle in remembering what
46 /** Base string class tracks the allocations and provides simple string
47 * tracking functions. Mostly you can work directly on the string for things
54 /** The factory that created this string
58 /** Pointer to the current string value (starts at NULL unless
59 * the string allocator is told to create it with a pre known size.
63 /** Current length of the string up to and not including, the trailing '\0'
69 /** Current size of the string in bytes including the trailing '\0'
73 /** Index of string (allocation number) in case someone wants
78 /** Occasionally it is useful to know what the encoding of the string
83 /** Pointer to function that sets the string value to a specific string in the default encoding
84 * for this string. For instance, if this is 8 bit, then this function is the same as set8
88 pANTLR3_UINT8 (*set) (struct ANTLR3_STRING_struct * string, const char * chars);
90 /** Pointer to function that sets the string value to a specific 8 bit string in the default encoding
91 * for this string. For instance, if this is an 8 bit string, then this function is the same as set8
95 pANTLR3_UINT8 (*set8) (struct ANTLR3_STRING_struct * string, const char * chars);
98 * for this string. For instance, if this is 8 bit, then this function is the same as append8
102 pANTLR3_UINT8 (*append) (struct ANTLR3_STRING_struct * string, const char * newbit);
105 * for this string. For instance, if this is a UTF16 string, then this function assumes the pointer
108 pANTLR3_UINT8 (*append8) (struct ANTLR3_STRING_struct * string, const char * newbit);
110 /** Pointer to function that inserts the supplied string at the specified
111 * offset in the current string in the default encoding for this string. For instance, if this is an 8
112 * bit string, then this is the same as insert8, but if this is a UTF16 string, then the pointer
115 pANTLR3_UINT8 (*insert) (struct ANTLR3_STRING_struct * string, ANTLR3_UINT32 point, const char * newbit);
117 /** Pointer to function that inserts the supplied string at the specified
118 * offset in the current string in the default encoding for this string. For instance, if this is a UTF16 string
121 pANTLR3_UINT8 (*insert8) (struct ANTLR3_STRING_struct * string, ANTLR3_UINT32 point, const char * newbit);
123 /** Pointer to function that sets the string value to a copy of the supplied string (strings must be in the
126 pANTLR3_UINT8 (*setS) (struct ANTLR3_STRING_struct * string, struct ANTLR3_STRING_struct * chars);
128 /** Pointer to function appends a copy of the characters contained in another string. Strings must be in the
131 pANTLR3_UINT8 (*appendS) (struct ANTLR3_STRING_struct * string, struct ANTLR3_STRING_struct * newbit);
133 /** Pointer to function that inserts a copy of the characters in the supplied string at the specified
134 * offset in the current string. strings must be in the same encoding.
136 pANTLR3_UINT8 (*insertS) (struct ANTLR3_STRING_struct * string, ANTLR3_UINT32 point, struct ANTLR3_STRING_struct * newbit);
138 /** Pointer to function that inserts the supplied integer in string form at the specified
139 * offset in the current string.
141 pANTLR3_UINT8 (*inserti) (struct ANTLR3_STRING_struct * string, ANTLR3_UINT32 point, ANTLR3_INT32 i);
143 /** Pointer to function that adds a single character to the end of the string, in the encoding of the
144 * string - 8 bit, UTF16, utf-8 etc. Input is a single UTF32 (32 bits wide integer) character.
146 pANTLR3_UINT8 (*addc) (struct ANTLR3_STRING_struct * string, ANTLR3_UINT32 c);
149 * to the string.
151 pANTLR3_UINT8 (*addi) (struct ANTLR3_STRING_struct * string, ANTLR3_INT32 i);
153 /** Pointer to function that compares the text of a string to the supplied
154 * 8 bit character string and returns a result a la strcmp()
156 ANTLR3_UINT32 (*compare8) (struct ANTLR3_STRING_struct * string, const char * compStr);
158 /** Pointer to a function that compares the text of a string with the supplied character string
159 * (which is assumed to be in the same encoding as the string itself) and returns a result
162 ANTLR3_UINT32 (*compare) (struct ANTLR3_STRING_struct * string, const char * compStr);
164 /** Pointer to a function that compares the text of a string with the supplied string
165 * (which is assumed to be in the same encoding as the string itself) and returns a result
168 ANTLR3_UINT32 (*compareS) (struct ANTLR3_STRING_struct * string, struct ANTLR3_STRING_struct * compStr);
173 ANTLR3_UCHAR (*charAt) (struct ANTLR3_STRING_struct * string, ANTLR3_UINT32 offset);
175 /** Pointer to a function that returns a substring of the supplied string a la .subString(s,e)
179 (*subString) (struct ANTLR3_STRING_struct * string, ANTLR3_UINT32 startIndex, ANTLR3_UINT32 endIndex);
182 * at the beginning of the string
184 ANTLR3_INT32 (*toInt32) (struct ANTLR3_STRING_struct * string);
186 /** Pointer to a function that yields an 8 bit string regardless of the encoding of the supplied
187 * string. This is useful when you want to use the text of a token in some way that requires an 8 bit
188 * value, such as the key for a hashtable. The function is required to produce a usable string even
193 (*to8) (struct ANTLR3_STRING_struct * string);
195 /// Pointer to a function that yields a UT8 encoded string of the current string,
196 /// regardless of the current encoding of the string. Because there is currently no UTF8
197 /// handling in the string class, it creates therefore, a string that is useful only for read only
201 (*toUTF8) (struct ANTLR3_STRING_struct * string);
206 /** Definition of the string factory interface, which creates and tracks
215 /* Index of next string that we allocate
219 /** Pointer to function that manufactures an empty string
223 /** Pointer to function that manufactures a raw string with no text in it but space for size
228 /** Pointer to function that manufactures a string from a given pointer and length. The pointer is assumed
229 * to point to characters in the same encoding as the string type, hence if this is a UTF16 string the
232 pANTLR3_STRING (*newPtr) (struct ANTLR3_STRING_FACTORY_struct * factory, pANTLR3_UINT8 string, ANTLR3_UINT32 size);
234 /** Pointer to function that manufactures a string from a given pointer and length. The pointer is assumed to
235 * point at 8 bit characters which must be converted on the fly to the encoding of the actual string.
237 pANTLR3_STRING (*newPtr8) (struct ANTLR3_STRING_FACTORY_struct * factory, pANTLR3_UINT8 string, ANTLR3_UINT32 size);
239 /** Pointer to function that manufactures a string from a given pointer and works out the length. The pointer is
240 * assumed to point to characters in the same encoding as the string itself, i.e. UTF16 if a UTF16
241 * string and so on.
243 pANTLR3_STRING (*newStr) (struct ANTLR3_STRING_FACTORY_struct * factory, pANTLR3_UINT8 string);
245 /** Pointer to function that manufactures a string from a given pointer and length. The pointer should
246 * point to 8 bit characters regardless of the actual encoding of the string. The 8 bit characters
247 * will be converted to the actual string encoding on the fly.
249 pANTLR3_STRING (*newStr8) (struct ANTLR3_STRING_FACTORY_struct * factory, pANTLR3_UINT8 string);
251 /** Pointer to function that deletes the string altogether
253 void (*destroy) (struct ANTLR3_STRING_FACTORY_struct * factory, pANTLR3_STRING string);
255 /** Pointer to function that returns a copy of the string in printable form without any control
258 pANTLR3_STRING (*printable)(struct ANTLR3_STRING_FACTORY_struct * factory, pANTLR3_STRING string);