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 enum { BLOCK_SIZE = 64 };
00021
00022 struct u_string_s;
00023 typedef struct u_string_s u_string_t;
00024
00025 #define STRING_NULL { NULL, 0, 0, 0 };
00026
00027 int u_string_create(const char *buf, size_t len, u_string_t **ps);
00028 int u_string_append(u_string_t *s, const char *buf, size_t len);
00029 int u_string_set(u_string_t *s, const char *buf, size_t len);
00030 int u_string_clear(u_string_t *s);
00031 int u_string_free(u_string_t *s);
00032 const char *u_string_c(u_string_t *s);
00033 size_t u_string_len(u_string_t *s);
00034 int u_string_copy(u_string_t *dst, u_string_t *src);
00035 int u_string_set_length(u_string_t *s, size_t len);
00036 int u_string_trim(u_string_t *s);
00037 int u_string_reserve(u_string_t *s, size_t size);
00038 int u_string_sprintf(u_string_t *s, const char *fmt, ...);
00039
00040 #ifdef __cplusplus
00041 }
00042 #endif
00043
00044 #endif