00001
00002
00003
00004
00005 #ifndef _U_STRING_H_
00006 #define _U_STRING_H_
00007 #include "libu_conf.h"
00008
00009 #include <sys/types.h>
00010
00011 #ifdef __cplusplus
00012 extern "C" {
00013 #endif
00014
00015 enum { BLOCK_SIZE = 64 };
00016
00017 struct u_string_s;
00018 typedef struct u_string_s u_string_t;
00019
00020 #define STRING_NULL { NULL, 0, 0, 0 };
00021
00022 int u_string_create(const char *buf, size_t len, u_string_t **ps);
00023 int u_string_append(u_string_t *s, const char *buf, size_t len);
00024 int u_string_set(u_string_t *s, const char *buf, size_t len);
00025 int u_string_clear(u_string_t *s);
00026 int u_string_free(u_string_t *s);
00027 const char *u_string_c(u_string_t *s);
00028 size_t u_string_len(u_string_t *s);
00029 int u_string_copy(u_string_t *dst, u_string_t *src);
00030 int u_string_set_length(u_string_t *s, size_t len);
00031 int u_string_trim(u_string_t *s);
00032
00033 int u_string_url_encode(u_string_t *s);
00034 int u_string_url_decode(u_string_t *s);
00035
00036 int u_string_html_encode(u_string_t *s);
00037 int u_string_html_decode(u_string_t *s);
00038
00039 int u_string_sql_encode(u_string_t *s);
00040 int u_string_sql_decode(u_string_t *s);
00041
00042 #ifdef __cplusplus
00043 }
00044 #endif
00045
00046 #endif