str.h
00001
00002
00003
00004
00005 #ifndef _U_LIBU_STRING_H_
00006 #define _U_LIBU_STRING_H_
00007
00008 #include <u/libu_conf.h>
00009
00010 #include <stdlib.h>
00011 #include <unistd.h>
00012 #include <stdio.h>
00013 #include <stdarg.h>
00014 #include <sys/types.h>
00015
00016 #ifdef __cplusplus
00017 extern "C" {
00018 #endif
00019
00020 struct u_string_s;
00021
00028 typedef struct u_string_s u_string_t;
00029
00044 #define u_string_ncat(s, buf, len) u_string_append(s, buf, len)
00045
00058 #define u_string_cat(s, buf) u_string_append(s, buf, strlen(buf))
00059
00060 const char *u_string_c (u_string_t *s);
00061 int u_string_append (u_string_t *s, const char *buf, size_t len);
00062 int u_string_aprintf (u_string_t *s, const char *fmt, ...);
00063 int u_string_clear (u_string_t *s);
00064 int u_string_copy (u_string_t *dst, u_string_t *src);
00065 int u_string_create (const char *buf, size_t len, u_string_t **ps);
00066 int u_string_do_printf (u_string_t *s, int clear, const char *fmt, ...);
00067 int u_string_free (u_string_t *s);
00068 int u_string_reserve (u_string_t *s, size_t size);
00069 int u_string_set (u_string_t *s, const char *buf, size_t len);
00070 int u_string_set_length (u_string_t *s, size_t len);
00071 int u_string_sprintf (u_string_t *s, const char *fmt, ...);
00072 int u_string_trim (u_string_t *s);
00073 size_t u_string_len (u_string_t *s);
00074 char *u_string_detach_cstr (u_string_t *s);
00075
00080 #ifdef __cplusplus
00081 }
00082 #endif
00083
00084 #endif