ucx/string.h

changeset 125
fca8efb122de
parent 123
7fb0f74517c5
child 146
aa376dba1ba8
equal deleted inserted replaced
124:8b44653541ef 125:fca8efb122de
230 * 230 *
231 * If the string ends with the delimiter and the maximum list size is not 231 * If the string ends with the delimiter and the maximum list size is not
232 * exceeded, the last list item will be an empty string. 232 * exceeded, the last list item will be an empty string.
233 * 233 *
234 * <b>Attention:</b> All list items <b>AND</b> all sstr_t.ptr of the list 234 * <b>Attention:</b> All list items <b>AND</b> all sstr_t.ptr of the list
235 * items must be manually passed to <code>free()</code>. Use sstrsplita() with 235 * items must be manually passed to <code>free()</code>. Use sstrsplit_a() with
236 * an allocator to managed memory, to avoid this. 236 * an allocator to managed memory, to avoid this.
237 * 237 *
238 * @param string the string to split 238 * @param string the string to split
239 * @param delim the delimiter string 239 * @param delim the delimiter string
240 * @param count IN: the maximum size of the resulting list (0 for an 240 * @param count IN: the maximum size of the resulting list (0 for an
241 * unbounded list), OUT: the actual size of the list 241 * unbounded list), OUT: the actual size of the list
242 * @return a list of the split strings as sstr_t array or 242 * @return a list of the split strings as sstr_t array or
243 * <code>NULL</code> on error 243 * <code>NULL</code> on error
244 * 244 *
245 * @see sstrsplita() 245 * @see sstrsplit_a()
246 */ 246 */
247 sstr_t* sstrsplit(sstr_t string, sstr_t delim, size_t *count); 247 sstr_t* sstrsplit(sstr_t string, sstr_t delim, size_t *count);
248 248
249 /** 249 /**
250 * Performing sstrsplit() using an UcxAllocator. 250 * Performing sstrsplit() using an UcxAllocator.
256 * function. 256 * function.
257 * 257 *
258 * <b>Note:</b> the allocator is not used for memory that is freed within the 258 * <b>Note:</b> the allocator is not used for memory that is freed within the
259 * same call of this function (locally scoped variables). 259 * same call of this function (locally scoped variables).
260 * 260 *
261 * @param allocator the UcxAllocator used for allocating memory
261 * @param string the string to split 262 * @param string the string to split
262 * @param delim the delimiter string 263 * @param delim the delimiter string
263 * @param count IN: the maximum size of the resulting list (0 for an 264 * @param count IN: the maximum size of the resulting list (0 for an
264 * unbounded list), OUT: the actual size of the list 265 * unbounded list), OUT: the actual size of the list
265 * @param allocator the UcxAllocator used for allocating memory
266 * @return a list of the split strings as sstr_t array or 266 * @return a list of the split strings as sstr_t array or
267 * <code>NULL</code> on error 267 * <code>NULL</code> on error
268 * 268 *
269 * @see sstrsplit() 269 * @see sstrsplit()
270 */ 270 */
271 sstr_t* sstrsplita(sstr_t string, sstr_t delim, size_t *count, 271 sstr_t* sstrsplit_a(UcxAllocator *allocator, sstr_t string, sstr_t delim,
272 UcxAllocator *allocator); 272 size_t *count);
273 273
274 /** 274 /**
275 * Compares two UCX strings with standard <code>memcmp()</code>. 275 * Compares two UCX strings with standard <code>memcmp()</code>.
276 * 276 *
277 * At first it compares the sstr_t.length attribute of the two strings. The 277 * At first it compares the sstr_t.length attribute of the two strings. The
295 * The sstr_t.ptr of the return value will <i>always</i> be <code>NULL</code>- 295 * The sstr_t.ptr of the return value will <i>always</i> be <code>NULL</code>-
296 * terminated. 296 * terminated.
297 * 297 *
298 * @param string the string to duplicate 298 * @param string the string to duplicate
299 * @return a duplicate of the string 299 * @return a duplicate of the string
300 * @see sstrdupa() 300 * @see sstrdup_a()
301 */ 301 */
302 sstr_t sstrdup(sstr_t string); 302 sstr_t sstrdup(sstr_t string);
303 303
304 /** 304 /**
305 * Creates a duplicate of the specified string using an UcxAllocator. 305 * Creates a duplicate of the specified string using an UcxAllocator.
315 * @param allocator a valid instance of an UcxAllocator 315 * @param allocator a valid instance of an UcxAllocator
316 * @param string the string to duplicate 316 * @param string the string to duplicate
317 * @return a duplicate of the string 317 * @return a duplicate of the string
318 * @see sstrdup() 318 * @see sstrdup()
319 */ 319 */
320 sstr_t sstrdupa(UcxAllocator *allocator, sstr_t string); 320 sstr_t sstrdup_a(UcxAllocator *allocator, sstr_t string);
321 321
322 /** 322 /**
323 * Omits leading and trailing spaces. 323 * Omits leading and trailing spaces.
324 * 324 *
325 * This function returns a new sstr_t containing a trimmed version of the 325 * This function returns a new sstr_t containing a trimmed version of the

mercurial