GME  13
svn_string.h
Go to the documentation of this file.
00001 
00075 #ifndef SVN_STRING_H
00076 #define SVN_STRING_H
00077 
00078 #include <apr.h>          /* for apr_size_t */
00079 #include <apr_pools.h>    /* for apr_pool_t */
00080 #include <apr_tables.h>   /* for apr_array_header_t */
00081 
00082 #include "svn_types.h"    /* for svn_boolean_t, svn_error_t */
00083 
00084 #ifdef __cplusplus
00085 extern "C" {
00086 #endif /* __cplusplus */
00087 
00093 
00094 
00096 typedef struct svn_string_t
00097 {
00098   const char *data; 
00099   apr_size_t len;   
00100 } svn_string_t;
00101 
00104 typedef struct svn_stringbuf_t
00105 {
00110   apr_pool_t *pool;
00111 
00113   char *data;
00114 
00116   apr_size_t len;
00117 
00119   apr_size_t blocksize;
00120 } svn_stringbuf_t;
00121 
00122 
00130 svn_string_t *
00131 svn_string_create(const char *cstring, apr_pool_t *pool);
00132 
00137 svn_string_t *
00138 svn_string_create_empty(apr_pool_t *pool);
00139 
00144 svn_string_t *
00145 svn_string_ncreate(const char *bytes, apr_size_t size, apr_pool_t *pool);
00146 
00149 svn_string_t *
00150 svn_string_create_from_buf(const svn_stringbuf_t *strbuf, apr_pool_t *pool);
00151 
00155 svn_string_t *
00156 svn_string_createf(apr_pool_t *pool, const char *fmt, ...)
00157   __attribute__((format(printf, 2, 3)));
00158 
00163 svn_string_t *
00164 svn_string_createv(apr_pool_t *pool, const char *fmt, va_list ap)
00165   __attribute__((format(printf, 2, 0)));
00166 
00168 svn_boolean_t
00169 svn_string_isempty(const svn_string_t *str);
00170 
00172 svn_string_t *
00173 svn_string_dup(const svn_string_t *original_string, apr_pool_t *pool);
00174 
00176 svn_boolean_t
00177 svn_string_compare(const svn_string_t *str1, const svn_string_t *str2);
00178 
00182 apr_size_t
00183 svn_string_first_non_whitespace(const svn_string_t *str);
00184 
00188 apr_size_t
00189 svn_string_find_char_backward(const svn_string_t *str, char ch);
00190 
00193 
00202 svn_stringbuf_t *
00203 svn_stringbuf_create(const char *cstring, apr_pool_t *pool);
00204 
00209 svn_stringbuf_t *
00210 svn_stringbuf_ncreate(const char *bytes, apr_size_t size, apr_pool_t *pool);
00211 
00216 svn_stringbuf_t *
00217 svn_stringbuf_create_empty(apr_pool_t *pool);
00218 
00227 svn_stringbuf_t *
00228 svn_stringbuf_create_ensure(apr_size_t minimum_size, apr_pool_t *pool);
00229 
00232 svn_stringbuf_t *
00233 svn_stringbuf_create_from_string(const svn_string_t *str, apr_pool_t *pool);
00234 
00238 svn_stringbuf_t *
00239 svn_stringbuf_createf(apr_pool_t *pool, const char *fmt, ...)
00240   __attribute__((format(printf, 2, 3)));
00241 
00246 svn_stringbuf_t *
00247 svn_stringbuf_createv(apr_pool_t *pool, const char *fmt, va_list ap)
00248   __attribute__((format(printf, 2, 0)));
00249 
00261 void
00262 svn_stringbuf_ensure(svn_stringbuf_t *str, apr_size_t minimum_size);
00263 
00265 void
00266 svn_stringbuf_set(svn_stringbuf_t *str, const char *value);
00267 
00269 void
00270 svn_stringbuf_setempty(svn_stringbuf_t *str);
00271 
00273 svn_boolean_t
00274 svn_stringbuf_isempty(const svn_stringbuf_t *str);
00275 
00277 void
00278 svn_stringbuf_chop(svn_stringbuf_t *str, apr_size_t nbytes);
00279 
00281 void
00282 svn_stringbuf_fillchar(svn_stringbuf_t *str, unsigned char c);
00283 
00294 void
00295 svn_stringbuf_appendbyte(svn_stringbuf_t *targetstr,
00296                          char byte);
00297 
00302 void
00303 svn_stringbuf_appendbytes(svn_stringbuf_t *targetstr,
00304                           const char *bytes,
00305                           apr_size_t count);
00306 
00311 void
00312 svn_stringbuf_appendstr(svn_stringbuf_t *targetstr,
00313                         const svn_stringbuf_t *appendstr);
00314 
00319 void
00320 svn_stringbuf_appendcstr(svn_stringbuf_t *targetstr,
00321                          const char *cstr);
00322 
00334 void
00335 svn_stringbuf_insert(svn_stringbuf_t *str,
00336                      apr_size_t pos,
00337                      const char *bytes,
00338                      apr_size_t count);
00339 
00348 void
00349 svn_stringbuf_remove(svn_stringbuf_t *str,
00350                      apr_size_t pos,
00351                      apr_size_t count);
00352 
00365 void
00366 svn_stringbuf_replace(svn_stringbuf_t *str,
00367                       apr_size_t pos,
00368                       apr_size_t old_count,
00369                       const char *bytes,
00370                       apr_size_t new_count);
00371 
00373 svn_stringbuf_t *
00374 svn_stringbuf_dup(const svn_stringbuf_t *original_string, apr_pool_t *pool);
00375 
00377 svn_boolean_t
00378 svn_stringbuf_compare(const svn_stringbuf_t *str1,
00379                       const svn_stringbuf_t *str2);
00380 
00384 apr_size_t
00385 svn_stringbuf_first_non_whitespace(const svn_stringbuf_t *str);
00386 
00388 void
00389 svn_stringbuf_strip_whitespace(svn_stringbuf_t *str);
00390 
00394 apr_size_t
00395 svn_stringbuf_find_char_backward(const svn_stringbuf_t *str, char ch);
00396 
00398 svn_boolean_t
00399 svn_string_compare_stringbuf(const svn_string_t *str1,
00400                              const svn_stringbuf_t *str2);
00401 
00404 
00422 apr_array_header_t *
00423 svn_cstring_split(const char *input,
00424                   const char *sep_chars,
00425                   svn_boolean_t chop_whitespace,
00426                   apr_pool_t *pool);
00427 
00432 void
00433 svn_cstring_split_append(apr_array_header_t *array,
00434                          const char *input,
00435                          const char *sep_chars,
00436                          svn_boolean_t chop_whitespace,
00437                          apr_pool_t *pool);
00438 
00439 
00443 svn_boolean_t
00444 svn_cstring_match_glob_list(const char *str, const apr_array_header_t *list);
00445 
00450 svn_boolean_t
00451 svn_cstring_match_list(const char *str, const apr_array_header_t *list);
00452 
00464 char *
00465 svn_cstring_tokenize(const char *sep, char **str);
00466 
00473 int
00474 svn_cstring_count_newlines(const char *msg);
00475 
00484 char *
00485 svn_cstring_join(const apr_array_header_t *strings,
00486                  const char *separator,
00487                  apr_pool_t *pool);
00488 
00499 int
00500 svn_cstring_casecmp(const char *str1, const char *str2);
00501 
00510 svn_error_t *
00511 svn_cstring_strtoi64(apr_int64_t *n, const char *str,
00512                      apr_int64_t minval, apr_int64_t maxval,
00513                      int base);
00514 
00522 svn_error_t *
00523 svn_cstring_atoi64(apr_int64_t *n, const char *str);
00524 
00532 svn_error_t *
00533 svn_cstring_atoi(int *n, const char *str);
00534 
00543 svn_error_t *
00544 svn_cstring_strtoui64(apr_uint64_t *n, const char *str,
00545                       apr_uint64_t minval, apr_uint64_t maxval,
00546                       int base);
00547 
00555 svn_error_t *
00556 svn_cstring_atoui64(apr_uint64_t *n, const char *str);
00557 
00565 svn_error_t *
00566 svn_cstring_atoui(unsigned int *n, const char *str);
00567 
00572 
00573 #ifdef __cplusplus
00574 }
00575 #endif /* __cplusplus */
00576 
00577 #endif  /* SVN_STRING_H */