Back to index

libcitadel  8.12
Functions
Cast operators to interact with char based code
Stringbuffer, A class for manipulating strings with dynamic buffers

use these operators to interfere with code demanding char*; if you need to own the content, smash me. More...

Collaboration diagram for Cast operators to interact with char based code:

Functions

const char * ChrPtr (const StrBuf *Str)
 Cast operator to Plain String.
int StrLength (const StrBuf *Str)
 since we know strlen()'s result, provide it here.

Detailed Description

use these operators to interfere with code demanding char*; if you need to own the content, smash me.

Avoid, since we loose the length information.


Function Documentation

const char* ChrPtr ( const StrBuf Str) [inline]

Cast operator to Plain String.

Note:
if the buffer is altered by StrBuf operations, this pointer may become invalid. So don't lean on it after altering the buffer! Since this operation is considered cheap, rather call it often than risking your pointer to become invalid!
Parameters:
Strthe string we want to get the c-string representation for
Returns:
the Pointer to the Content. Don't mess with it!

Definition at line 269 of file stringbuf.c.

{
       if (Str == NULL)
              return "";
       return Str->buf;
}

Here is the caller graph for this function:

int StrLength ( const StrBuf Str) [inline]

since we know strlen()'s result, provide it here.

Parameters:
Strthe string to return the length to
Returns:
contentlength of the buffer

Definition at line 282 of file stringbuf.c.

{
       return (Str != NULL) ? Str->BufUsed : 0;
}

Here is the caller graph for this function: