Subversion
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
svn_stringbuf_t functions
String handling

Functions

svn_stringbuf_tsvn_stringbuf_create (const char *cstring, apr_pool_t *pool)
 Create a new stringbuf copied from the null-terminated C string cstring.
 
svn_stringbuf_tsvn_stringbuf_ncreate (const char *bytes, apr_size_t size, apr_pool_t *pool)
 Create a new stringbuf copied from the generic string of bytes, bytes, of length size bytes.
 
svn_stringbuf_tsvn_stringbuf_create_empty (apr_pool_t *pool)
 Create a new, empty stringbuf.
 
svn_stringbuf_tsvn_stringbuf_create_ensure (apr_size_t minimum_size, apr_pool_t *pool)
 Create a new, empty stringbuf with at least minimum_size bytes of space available in the memory block.
 
svn_stringbuf_tsvn_stringbuf_create_from_string (const svn_string_t *str, apr_pool_t *pool)
 Create a new stringbuf copied from the string str.
 
svn_stringbuf_tsvn_stringbuf_create_wrap (char *str, apr_pool_t *pool)
 Create a new stringbuf using the given str as initial buffer.
 
svn_stringbuf_tsvn_stringbuf_createf (apr_pool_t *pool, const char *fmt,...)
 Create a new stringbuf by printf-style formatting using fmt and the variable arguments, which are as appropriate for apr_psprintf().
 
svn_stringbuf_tsvn_stringbuf_createv (apr_pool_t *pool, const char *fmt, va_list ap)
 Create a new stringbuf by printf-style formatting using fmt and ap.
 
void svn_stringbuf_ensure (svn_stringbuf_t *str, apr_size_t minimum_size)
 Make sure that str has at least minimum_size bytes of space available in the memory block.
 
void svn_stringbuf_set (svn_stringbuf_t *str, const char *value)
 Set str to a copy of the null-terminated C string value.
 
void svn_stringbuf_setempty (svn_stringbuf_t *str)
 Set str to empty (zero length).
 
svn_boolean_t svn_stringbuf_isempty (const svn_stringbuf_t *str)
 Return TRUE if str is empty (has length zero).
 
void svn_stringbuf_chop (svn_stringbuf_t *str, apr_size_t nbytes)
 Chop nbytes bytes off end of str, but not more than str->len.
 
void svn_stringbuf_fillchar (svn_stringbuf_t *str, unsigned char c)
 Fill str with character c.
 
void svn_stringbuf_appendbyte (svn_stringbuf_t *targetstr, char byte)
 Append the single character byte onto targetstr.
 
void svn_stringbuf_appendbytes (svn_stringbuf_t *targetstr, const char *bytes, apr_size_t count)
 Append the array of bytes bytes of length count onto targetstr.
 
void svn_stringbuf_appendfill (svn_stringbuf_t *targetstr, char byte, apr_size_t count)
 Append byte count times onto targetstr.
 
void svn_stringbuf_appendstr (svn_stringbuf_t *targetstr, const svn_stringbuf_t *appendstr)
 Append the stringbuf appendstr onto targetstr.
 
void svn_stringbuf_appendcstr (svn_stringbuf_t *targetstr, const char *cstr)
 Append the C string cstr onto targetstr.
 
void svn_stringbuf_insert (svn_stringbuf_t *str, apr_size_t pos, const char *bytes, apr_size_t count)
 Insert into str at position pos an array of bytes bytes which is count bytes long.
 
void svn_stringbuf_remove (svn_stringbuf_t *str, apr_size_t pos, apr_size_t count)
 Remove count bytes from str, starting at position pos.
 
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)
 Replace in str the substring which starts at pos and is old_count bytes long with a new substring bytes which is new_count bytes long.
 
svn_stringbuf_tsvn_stringbuf_dup (const svn_stringbuf_t *original_string, apr_pool_t *pool)
 Return a duplicate of original_string.
 
svn_boolean_t svn_stringbuf_compare (const svn_stringbuf_t *str1, const svn_stringbuf_t *str2)
 Return TRUE iff str1 and str2 have identical length and data.
 
apr_size_t svn_stringbuf_first_non_whitespace (const svn_stringbuf_t *str)
 Return offset of first non-whitespace character in str, or return str->len if none.
 
void svn_stringbuf_strip_whitespace (svn_stringbuf_t *str)
 Strip whitespace from both sides of str (modified in place).
 
apr_size_t svn_stringbuf_find_char_backward (const svn_stringbuf_t *str, char ch)
 Return position of last occurrence of ch in str, or return str->len if no occurrence.
 
svn_boolean_t svn_string_compare_stringbuf (const svn_string_t *str1, const svn_stringbuf_t *str2)
 Return TRUE iff str1 and str2 have identical length and data.
 

Detailed Description

Function Documentation

svn_boolean_t svn_string_compare_stringbuf ( const svn_string_t str1,
const svn_stringbuf_t str2 
)

Return TRUE iff str1 and str2 have identical length and data.

void svn_stringbuf_appendbyte ( svn_stringbuf_t targetstr,
char  byte 
)

Append the single character byte onto targetstr.

This is an optimized version of svn_stringbuf_appendbytes() that is much faster to call and execute. Gains vary with the ABI. The advantages extend beyond the actual call because the reduced register pressure allows for more optimization within the caller.

Reallocs if necessary. targetstr is affected, nothing else is.

Since
New in 1.7.
void svn_stringbuf_appendbytes ( svn_stringbuf_t targetstr,
const char *  bytes,
apr_size_t  count 
)

Append the array of bytes bytes of length count onto targetstr.

Reallocs if necessary. targetstr is affected, nothing else is.

Since
1.9 bytes can be NULL if count is zero.
void svn_stringbuf_appendcstr ( svn_stringbuf_t targetstr,
const char *  cstr 
)

Append the C string cstr onto targetstr.

Reallocs if necessary. targetstr is affected, nothing else is.

void svn_stringbuf_appendfill ( svn_stringbuf_t targetstr,
char  byte,
apr_size_t  count 
)

Append byte count times onto targetstr.

Reallocs if necessary. targetstr is affected, nothing else is.

Since
New in 1.9.
void svn_stringbuf_appendstr ( svn_stringbuf_t targetstr,
const svn_stringbuf_t appendstr 
)

Append the stringbuf appendstr onto targetstr.

Reallocs if necessary. targetstr is affected, nothing else is.

void svn_stringbuf_chop ( svn_stringbuf_t str,
apr_size_t  nbytes 
)

Chop nbytes bytes off end of str, but not more than str->len.

svn_boolean_t svn_stringbuf_compare ( const svn_stringbuf_t str1,
const svn_stringbuf_t str2 
)

Return TRUE iff str1 and str2 have identical length and data.

svn_stringbuf_t* svn_stringbuf_create_empty ( apr_pool_t *  pool)

Create a new, empty stringbuf.

Since
New in 1.8.
svn_stringbuf_t* svn_stringbuf_create_ensure ( apr_size_t  minimum_size,
apr_pool_t *  pool 
)

Create a new, empty stringbuf with at least minimum_size bytes of space available in the memory block.

The allocated string buffer will be at least one byte larger than minimum_size to account for a final '\0'.

Since
New in 1.6.
svn_stringbuf_t* svn_stringbuf_create_wrap ( char *  str,
apr_pool_t *  pool 
)

Create a new stringbuf using the given str as initial buffer.

Allocate the result in pool. In contrast to svn_stringbuf_create, the contents of str may change when the stringbuf gets modified.

Since
New in 1.9
svn_stringbuf_t* svn_stringbuf_createv ( apr_pool_t *  pool,
const char *  fmt,
va_list  ap 
)

Create a new stringbuf by printf-style formatting using fmt and ap.

This is the same as svn_stringbuf_createf() except for the different way of passing the variable arguments.

svn_stringbuf_t* svn_stringbuf_dup ( const svn_stringbuf_t original_string,
apr_pool_t *  pool 
)

Return a duplicate of original_string.

void svn_stringbuf_ensure ( svn_stringbuf_t str,
apr_size_t  minimum_size 
)

Make sure that str has at least minimum_size bytes of space available in the memory block.

The allocated string buffer will be at least one byte larger than minimum_size to account for a final '\0'.

Note
: Before Subversion 1.8 this function did not ensure space for one byte more than minimum_size. If compatibility with pre-1.8 behaviour is required callers must assume space for only minimum_size-1 data bytes plus a final '\0'.
void svn_stringbuf_fillchar ( svn_stringbuf_t str,
unsigned char  c 
)

Fill str with character c.

void svn_stringbuf_insert ( svn_stringbuf_t str,
apr_size_t  pos,
const char *  bytes,
apr_size_t  count 
)

Insert into str at position pos an array of bytes bytes which is count bytes long.

The resulting string will be count+str->len bytes long. If pos is larger than or equal to str->len, simply append bytes.

Reallocs if necessary. str is affected, nothing else is.

Note
The inserted string may be a sub-range of str.
Since
New in 1.8.
Since 1.9, bytes can be NULL if count is zero.
svn_boolean_t svn_stringbuf_isempty ( const svn_stringbuf_t str)

Return TRUE if str is empty (has length zero).

svn_stringbuf_t* svn_stringbuf_ncreate ( const char *  bytes,
apr_size_t  size,
apr_pool_t *  pool 
)

Create a new stringbuf copied from the generic string of bytes, bytes, of length size bytes.

bytes is NOT assumed to be null-terminated, but the new stringbuf will be.

Since
Since 1.9, bytes can be NULL if size is zero.
void svn_stringbuf_remove ( svn_stringbuf_t str,
apr_size_t  pos,
apr_size_t  count 
)

Remove count bytes from str, starting at position pos.

If that range exceeds the current string data, truncate str at pos. If pos is larger than or equal to str->len, this will be a no-op. Otherwise, the resulting string will be str->len-count bytes long.

Since
New in 1.8.
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 
)

Replace in str the substring which starts at pos and is old_count bytes long with a new substring bytes which is new_count bytes long.

This is faster but functionally equivalent to the following sequence:

svn_stringbuf_remove(str, pos, old_count);
svn_stringbuf_insert(str, pos, bytes, new_count);
Since
New in 1.8.
Since 1.9, bytes can be NULL if new_count is zero.
void svn_stringbuf_set ( svn_stringbuf_t str,
const char *  value 
)

Set str to a copy of the null-terminated C string value.

void svn_stringbuf_setempty ( svn_stringbuf_t str)

Set str to empty (zero length).

void svn_stringbuf_strip_whitespace ( svn_stringbuf_t str)

Strip whitespace from both sides of str (modified in place).