Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Related Pages

str.h

00001 #ifndef STR__H__ 00002 #define STR__H__ 00003 00022 #define STR_BLOCKSIZE 16 00023 00027 struct str 00028 { 00033 char* s; 00037 unsigned len; 00039 unsigned size; 00040 }; 00041 typedef struct str str; 00042 00047 struct str_sortentry 00048 { 00049 const char* str; 00050 unsigned long len; 00051 }; 00052 typedef struct str_sortentry str_sortentry; 00053 00056 extern const char str_lcase_digits[36]; 00057 extern const char str_ucase_digits[36]; 00058 /* @} */ 00059 00062 int str_init(str* s); 00063 int str_alloc(str* s, unsigned size, int copy); 00065 #define str_ready(S,SZ) str_alloc(S,SZ,0) 00066 00067 #define str_realloc(S,SZ) str_alloc(S,SZ,1) 00068 void str_free(str* s); 00069 int str_truncate(str* s, unsigned len); 00070 /* @} */ 00071 00074 int str_copy(str* s, const str* in); 00075 int str_copys(str* s, const char* in); 00076 int str_copyb(str* s, const char* in, unsigned len); 00077 int str_copyns(str* s, unsigned int count, ...); 00078 int str_copy2s(str* s, const char* a, const char* b); 00079 int str_copy3s(str* s, const char* a, const char* b, const char* c); 00080 int str_copy4s(str* s, const char* a, const char* b, const char* c, const char* d); 00081 int str_copy5s(str* s, const char* a, const char* b, const char* c, const char* d, const char* e); 00082 int str_copy6s(str* s, const char* a, const char* b, const char* c, const char* d, const char* e, const char* f); 00083 /* @} */ 00084 00087 int str_cat(str* s, const str* in); 00088 int str_cats(str* s, const char* in); 00089 int str_catc(str* s, char in); 00090 int str_catb(str* s, const char* in, unsigned len); 00091 int str_cati(str* s, long in); 00092 int str_catiw(str* s, long in, unsigned width, char pad); 00093 int str_catu(str* s, unsigned long in); 00094 int str_catuw(str* s, unsigned long in, unsigned width, char pad); 00095 int str_catx(str* s, unsigned long in); 00096 int str_catxw(str* s, unsigned long in, unsigned width, char pad); 00097 int str_catill(str* s, long long in); 00098 int str_catiwll(str* s, long long in, unsigned width, char pad); 00099 int str_catull(str* s, unsigned long long in); 00100 int str_catuwll(str* s, unsigned long long in, unsigned width, char pad); 00101 int str_catxll(str* s, unsigned long long in); 00102 int str_catxwll(str* s, unsigned long long in, unsigned width, char pad); 00103 int str_catsnumw(str* s, long in, unsigned width, char pad, 00104 unsigned base, const char* digits); 00105 int str_catunumw(str* s, unsigned long in, unsigned width, char pad, 00106 unsigned base, const char* digits); 00107 int str_catsllnumw(str* s, long long in, unsigned width, char pad, 00108 unsigned base, const char* digits); 00109 int str_catullnumw(str* s, unsigned long long in, unsigned width, char pad, 00110 unsigned base, const char* digits); 00111 int str_catns(str* s, unsigned int count, ...); 00112 int str_cat2s(str* s, const char* a, const char* b); 00113 int str_cat3s(str* s, const char* a, const char* b, const char* c); 00114 int str_cat4s(str* s, const char* a, const char* b, const char* c, const char* d); 00115 int str_cat5s(str* s, const char* a, const char* b, const char* c, const char* d, const char* e); 00116 int str_cat6s(str* s, const char* a, const char* b, const char* c, const char* d, const char* e, const char* f); 00117 00118 int str_join(str* s, char sep, const str* t); 00119 int str_joins(str* s, char sep, const char* in); 00120 int str_joinb(str* s, char sep, const char* in, unsigned len); 00121 /* @} */ 00122 00124 /* @{ */ 00125 void str_lower(str* s); 00126 void str_upper(str* s); 00127 long str_subst(str* s, char from, char to); 00128 void str_lstrip(str* s); 00129 void str_rstrip(str* s); 00130 #define str_strip(S) (str_rstrip(S), str_lstrip(S)) 00131 void str_lcut(str* s, unsigned count); 00132 void str_rcut(str* s, unsigned count); 00133 int str_sort(str* s, char sep, long count, 00134 int (*fn)(const str_sortentry* a, const str_sortentry* b)); 00135 int str_splice(str* s, unsigned start, unsigned len, const str* r); 00136 int str_splices(str* s, unsigned start, unsigned len, const char* r); 00137 int str_spliceb(str* s, unsigned start, unsigned len, 00138 const char* r, unsigned rlen); 00139 long str_xlate(str* s, const char* from, const char* to, unsigned nchars); 00140 /* @} */ 00141 00144 int str_cmp(const str* a, unsigned aoffset, const str* b, unsigned boffset); 00145 int str_cmps(const str* a, unsigned offset, const char* b); 00146 int str_cmpb(const str* a, unsigned offset, const char* b, unsigned len); 00147 00148 int str_diff(const str* a, const str* b); 00149 int str_diffs(const str* a, const char* b); 00150 int str_diffb(const str* a, const char* b, unsigned len); 00151 00152 int str_start(const str* a, const str* b); 00153 int str_starts(const str* a, const char* b); 00154 int str_startb(const str* a, const char* b, unsigned len); 00155 00156 int str_case_start(const str* a, const str* b); 00157 int str_case_starts(const str* a, const char* b); 00158 int str_case_startb(const str* a, const char* b, unsigned len); 00159 /* @} */ 00160 00163 void str_buildmap(int map[256], const char* list); 00164 unsigned str_count(const str* s, char ch); 00165 unsigned str_countof(const str* s, const char* list); 00166 #define str_findfirst(S,C) str_findnext(S,C,0) 00167 #define str_findfirstof(S,L) str_findnextof(S,L,0) 00168 #define str_findfirstnot(S,L) str_findnextnot(S,L,0) 00169 #define str_findlast(S,C) str_findprev(S,C,-1) 00170 #define str_findlastof(S,L) str_findprevof(S,L,-1) 00171 #define str_findlastnot(S,L) str_findprevof(S,L,-1) 00172 int str_findnext(const str* s, char ch, unsigned pos); 00173 int str_findnextof(const str* s, const char* list, unsigned pos); 00174 int str_findnextnot(const str* s, const char* list, unsigned pos); 00175 int str_findprev(const str* s, char ch, unsigned pos); 00176 int str_findprevof(const str* s, const char* list, unsigned pos); 00177 int str_findprevnot(const str* s, const char* list, unsigned pos); 00178 /* @} */ 00179 00182 int str_match(const str* s, const str* pattern); 00183 int str_matchb(const str* s, const char* pptr, unsigned plen); 00184 int str_matchs(const str* s, const char* pattern); 00185 int str_case_match(const str* s, const str* pattern); 00186 int str_case_matchb(const str* s, const char* pptr, unsigned plen); 00187 int str_case_matchs(const str* s, const char* pattern); 00188 int str_glob(const str* s, const str* pattern); 00189 int str_globb(const str* s, const char* pptr, unsigned plen); 00190 int str_globs(const str* s, const char* pattern); 00191 int str_case_glob(const str* s, const str* pattern); 00192 int str_case_globb(const str* s, const char* pptr, unsigned plen); 00193 int str_case_globs(const str* s, const char* pattern); 00194 /* @} */ 00195 00196 /* @} */ 00197 00198 #endif

Generated on Mon Nov 15 14:50:26 2004 for bglibs by doxygen 1.3.8