GME  13
Classes | Typedefs | Functions
svn_string.h File Reference

Counted-length strings for Subversion, plus some C string goodies. More...

Go to the source code of this file.

Classes

struct  svn_string_t
struct  svn_stringbuf_t

Typedefs

typedef struct svn_string_t svn_string_t
typedef struct svn_stringbuf_t svn_stringbuf_t

Functions

svn_string_tsvn_string_create (const char *cstring, apr_pool_t *pool)
svn_string_tsvn_string_create_empty (apr_pool_t *pool)
svn_string_tsvn_string_ncreate (const char *bytes, apr_size_t size, apr_pool_t *pool)
svn_string_tsvn_string_create_from_buf (const svn_stringbuf_t *strbuf, apr_pool_t *pool)
svn_string_tsvn_string_createf (apr_pool_t *pool, const char *fmt,...) __attribute__((format(printf
svn_string_t svn_string_tsvn_string_createv (apr_pool_t *pool, const char *fmt, va_list ap) __attribute__((format(printf
svn_string_t svn_string_t
svn_boolean_t 
svn_string_isempty (const svn_string_t *str)
svn_string_tsvn_string_dup (const svn_string_t *original_string, apr_pool_t *pool)
svn_boolean_t svn_string_compare (const svn_string_t *str1, const svn_string_t *str2)
apr_size_t svn_string_first_non_whitespace (const svn_string_t *str)
apr_size_t svn_string_find_char_backward (const svn_string_t *str, char ch)
svn_stringbuf_tsvn_stringbuf_create (const char *cstring, apr_pool_t *pool)
svn_stringbuf_tsvn_stringbuf_ncreate (const char *bytes, apr_size_t size, apr_pool_t *pool)
svn_stringbuf_tsvn_stringbuf_create_empty (apr_pool_t *pool)
svn_stringbuf_tsvn_stringbuf_create_ensure (apr_size_t minimum_size, apr_pool_t *pool)
svn_stringbuf_tsvn_stringbuf_create_from_string (const svn_string_t *str, apr_pool_t *pool)
svn_stringbuf_tsvn_stringbuf_createf (apr_pool_t *pool, const char *fmt,...) __attribute__((format(printf
svn_stringbuf_t svn_stringbuf_tsvn_stringbuf_createv (apr_pool_t *pool, const char *fmt, va_list ap) __attribute__((format(printf
svn_stringbuf_t
svn_stringbuf_t void 
svn_stringbuf_ensure (svn_stringbuf_t *str, apr_size_t minimum_size)
void svn_stringbuf_set (svn_stringbuf_t *str, const char *value)
void svn_stringbuf_setempty (svn_stringbuf_t *str)
svn_boolean_t svn_stringbuf_isempty (const svn_stringbuf_t *str)
void svn_stringbuf_chop (svn_stringbuf_t *str, apr_size_t nbytes)
void svn_stringbuf_fillchar (svn_stringbuf_t *str, unsigned char c)
void svn_stringbuf_appendbyte (svn_stringbuf_t *targetstr, char byte)
void svn_stringbuf_appendbytes (svn_stringbuf_t *targetstr, const char *bytes, apr_size_t count)
void svn_stringbuf_appendstr (svn_stringbuf_t *targetstr, const svn_stringbuf_t *appendstr)
void svn_stringbuf_appendcstr (svn_stringbuf_t *targetstr, const char *cstr)
void svn_stringbuf_insert (svn_stringbuf_t *str, apr_size_t pos, const char *bytes, apr_size_t count)
void svn_stringbuf_remove (svn_stringbuf_t *str, apr_size_t pos, apr_size_t count)
void svn_stringbuf_replace (svn_stringbuf_t *str, apr_size_t pos, apr_size_t old_count, const char *bytes, apr_size_t new_count)
svn_stringbuf_tsvn_stringbuf_dup (const svn_stringbuf_t *original_string, apr_pool_t *pool)
svn_boolean_t svn_stringbuf_compare (const svn_stringbuf_t *str1, const svn_stringbuf_t *str2)
apr_size_t svn_stringbuf_first_non_whitespace (const svn_stringbuf_t *str)
void svn_stringbuf_strip_whitespace (svn_stringbuf_t *str)
apr_size_t svn_stringbuf_find_char_backward (const svn_stringbuf_t *str, char ch)
svn_boolean_t svn_string_compare_stringbuf (const svn_string_t *str1, const svn_stringbuf_t *str2)
apr_array_header_tsvn_cstring_split (const char *input, const char *sep_chars, svn_boolean_t chop_whitespace, apr_pool_t *pool)
void svn_cstring_split_append (apr_array_header_t *array, const char *input, const char *sep_chars, svn_boolean_t chop_whitespace, apr_pool_t *pool)
svn_boolean_t svn_cstring_match_glob_list (const char *str, const apr_array_header_t *list)
svn_boolean_t svn_cstring_match_list (const char *str, const apr_array_header_t *list)
char * svn_cstring_tokenize (const char *sep, char **str)
int svn_cstring_count_newlines (const char *msg)
char * svn_cstring_join (const apr_array_header_t *strings, const char *separator, apr_pool_t *pool)
int svn_cstring_casecmp (const char *str1, const char *str2)
svn_error_tsvn_cstring_strtoi64 (apr_int64_t *n, const char *str, apr_int64_t minval, apr_int64_t maxval, int base)
svn_error_tsvn_cstring_atoi64 (apr_int64_t *n, const char *str)
svn_error_tsvn_cstring_atoi (int *n, const char *str)
svn_error_tsvn_cstring_strtoui64 (apr_uint64_t *n, const char *str, apr_uint64_t minval, apr_uint64_t maxval, int base)
svn_error_tsvn_cstring_atoui64 (apr_uint64_t *n, const char *str)
svn_error_tsvn_cstring_atoui (unsigned int *n, const char *str)

Detailed Description

Counted-length strings for Subversion, plus some C string goodies.

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ====================================================================

There are two string datatypes: svn_string_t and svn_stringbuf_t. The former is a simple pointer/length pair useful for passing around strings (or arbitrary bytes) with a counted length. svn_stringbuf_t is buffered to enable efficient appending of strings without an allocation and copy for each append operation.

svn_string_t contains a const char * for its data, so it is most appropriate for constant data and for functions which expect constant, counted data. Functions should generally use const svn_string_t * as their parameter to indicate they are expecting a constant, counted string.

svn_stringbuf_t uses a plain char * for its data, so it is most appropriate for modifiable data.

Invariants

1. Null termination:

Both structures maintain a significant invariant:

s->data[s->len] == '\0'

The functions defined within this header file will maintain the invariant (which does imply that memory is allocated/defined as len+1 bytes). If code outside of the svn_string.h functions manually builds these structures, then they must enforce this invariant.

Note that an svn_string(buf)_t may contain binary data, which means that strlen(s->data) does not have to equal s->len. The null terminator is provided to make it easier to pass s->data to C string interfaces.

2. Non-NULL input:

All the functions assume their input data pointer is non-NULL, unless otherwise documented, and may seg fault if passed NULL. The input data may *contain* null bytes, of course, just the data pointer itself must not be NULL.

Memory allocation

All the functions make a deep copy of all input data, and never store a pointer to the original input data.

Definition in file svn_string.h.