GME  13
Functions
svn_stringbuf_t functions
String handling
Collaboration diagram for svn_stringbuf_t functions:

Functions

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)

Function Documentation

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 an array of bytes onto targetstr.

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

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_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.

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

svn_stringbuf_t* svn_stringbuf_create ( const char *  cstring,
apr_pool_t pool 
)

Create a new stringbuf copied from the null-terminated C string cstring.

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.

Create a new stringbuf copied from the string str.

svn_stringbuf_t* svn_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_t 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.

svn_stringbuf_t svn_stringbuf_t 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.

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.

Return offset of first non-whitespace character in str, or return str->len if none.

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

Read count bytes from bytes and insert them into str at position pos and following. The resulting string will be count+str->len bytes long. If pos is larger or equal to the number of bytes currently used in str, simply append bytes.

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

Note:
The inserted string may be a sub-range if str.
Since:
New in 1.8.

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.

void svn_stringbuf_remove ( svn_stringbuf_t str,
apr_size_t  pos,
apr_size_t  count 
)

Removes count bytes from str, starting at position pos. If that range exceeds the current string data, str gets truncated at pos. If the latter is larger or equal to str->pos, 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.
void svn_stringbuf_set ( svn_stringbuf_t str,
const char *  value 
)

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

Set str to empty (zero length).

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