00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <wchar.h>
00022
00023 #ifndef RSTRING
00024 #define RSTRING
00025
00026 #ifdef __cplusplus
00027 extern "C"
00028 {
00029 #endif
00030
00031
00032 struct rui_wstring
00033 {
00034 wchar_t *text;
00035 size_t max;
00036 };
00037
00038 typedef struct rui_wstring rwstring;
00039
00040 struct rui_cstring
00041 {
00042 char *text;
00043 size_t max;
00044 };
00045
00046 typedef struct rui_cstring rcstring;
00047
00048
00049 enum rui_string_error_codes
00050 { RS_MEMORY, RS_OK = 1, RS_UNKNOWN };
00051
00052 typedef enum rui_string_error_codes rstring_code;
00053
00059 rwstring *rws_create (size_t length);
00060
00065 void rws_free (rwstring ** rws);
00066
00073 rstring_code rws_resize (rwstring * rws, size_t length);
00074
00080 rwstring *rws_duplicate (rwstring * copied);
00081
00086 size_t rws_length (rwstring * rws);
00087
00093 rstring_code rws_copyrws (rwstring * to, const rwstring * from);
00094
00101 rstring_code rws_copywcs (rwstring * to, const wchar_t * from, const size_t length);
00102
00108 rstring_code rws_catrws (rwstring * pre, const rwstring * pos);
00109
00115 rstring_code rws_catrcs (rwstring * pre, const rcstring * pos);
00116
00123 rstring_code rws_catwcs (rwstring * pre, const wchar_t * pos, const size_t length);
00124
00131 rstring_code rws_catcs (rwstring * pre, const char *pos, const size_t length);
00132
00138 rstring_code rws_catwc (rwstring * pre, const wchar_t c);
00139
00145 rstring_code rws_catc (rwstring * pre, const char c);
00146
00151 rwstring *rws_wrap (wchar_t * wcs);
00152
00157 wchar_t *rws_unwrap (rwstring * rws);
00158
00159
00165 rcstring *rcs_create (size_t length);
00166
00171 void rcs_free (rcstring ** rcs);
00172
00179 rstring_code rcs_resize (rcstring * rcs, size_t length);
00180
00186 rcstring *rcs_duplicate (rcstring * copied);
00187
00192 size_t rcs_length (rcstring * rcs);
00193
00199 rstring_code rcs_copyrcs (rcstring * to, const rcstring * from);
00200
00207 rstring_code rcs_copycs (rcstring * to, const char *from, const size_t length);
00208
00214 rstring_code rcs_catrcs (rcstring * pre, const rcstring * pos);
00215
00222 rstring_code rcs_catcs (rcstring * pre, const char *pos, const size_t length);
00223
00230 rstring_code rcs_catwcs (rcstring * pre, const wchar_t * pos, const size_t length);
00231
00237 rstring_code rcs_catwc (rcstring * pre, const wchar_t c);
00238
00244 rstring_code rcs_catc (rcstring * pre, const char c);
00245
00250 rcstring *rcs_wrap (char *cs);
00251
00256 char *rcs_unwrap (rcstring * rcs);
00257
00258
00259 #ifdef __cplusplus
00260 }
00261 #endif
00262 #endif