INGOR
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ytStrBuff Class Reference

Expandable String Buffer. More...

#include <ytStrBuff.h>

Public Member Functions

ytStrBuffytStrBuff_new ()
 Generates the new ytStrBuff instance.
 
void ytStrBuff_delete (void *this)
 Deletes the ytStrBuff instance.
 
ytObjectytStrBuff_obj (ytStrBuff *this)
 Returns the pointer to the ytObject instance.
 
ytStrBuffytStrBuff_expand (ytStrBuff *this, size_t length)
 Expands the size of the allocated buffer memory.
 
ytStrBuffytStrBuff_add (ytStrBuff *this, char c)
 Adds a character to the end of the buffer.
 
ytStrBuffytStrBuff_addStr (ytStrBuff *this, const char *str)
 Adds a string to the end of the buffer.
 
size_t ytStrBuff_length (const ytStrBuff *this)
 Returns the length of the string in the buffer.
 
size_t ytStrBuff_len (const ytStrBuff *this)
 Returns the length of the string in the buffer.
 
const char * ytStrBuff_str (const ytStrBuff *this)
 Returns the pointer pointing to the current string.
 
void * ytStrBuff_ptr (const ytStrBuff *this)
 Returns the pointer pointing to the current string.
 
void ytStrBuff_clear (ytStrBuff *this)
 Clears the buffer.
 
char * ytStrBuff_gen (const ytStrBuff *this)
 Generates a new string identical to the string buffer.
 

Detailed Description

Expandable String Buffer.

Member Function Documentation

◆ ytStrBuff_add()

ytStrBuff * ytStrBuff_add ( ytStrBuff this,
char  c 
)

Adds a character to the end of the buffer.

Parameters
thispointer to the ytStrBuff instance.
ccharacter letter added to the ytStrBuff.

◆ ytStrBuff_addStr()

ytStrBuff * ytStrBuff_addStr ( ytStrBuff this,
const char *  str 
)

Adds a string to the end of the buffer.

Parameters
thispointer to the ytStrBuff instance.
strstring to be added to the ytStrBuff.

◆ ytStrBuff_clear()

void ytStrBuff_clear ( ytStrBuff this)

Clears the buffer.

Parameters
thispointer to the ytStrBuff.

◆ ytStrBuff_delete()

void ytStrBuff_delete ( void *  this)

Deletes the ytStrBuff instance.

Parameters
thispointer to the ytStrBuff to be deleted. The pointer has to be one returned by ytStrBuff_new().

◆ ytStrBuff_expand()

ytStrBuff * ytStrBuff_expand ( ytStrBuff this,
size_t  length 
)

Expands the size of the allocated buffer memory.

The new buffer size will be the current size + length.

Generally this is used internally, and users do not need to use this directly.

Parameters
thispointer to the ytStrBuff instance.
lengthbuffer size to be newly allocated.
Returns
this, or NULL if failed.

◆ ytStrBuff_gen()

char * ytStrBuff_gen ( const ytStrBuff this)

Generates a new string identical to the string buffer.

Parameters
thispointer to the ytStrBuff.
Returns
newly allocated pointer that has a string identical to this string buffer.

◆ ytStrBuff_len()

size_t ytStrBuff_len ( const ytStrBuff this)

Returns the length of the string in the buffer.

This returns the length of the string, excluding the terminal NULL letter.

This is the same as ytStrBuff_length().

Parameters
thispointer to the ytStrBuff instance.
Returns
length of the string in the buffer.

◆ ytStrBuff_length()

size_t ytStrBuff_length ( const ytStrBuff this)

Returns the length of the string in the buffer.

This returns the length of the string, excluding the terminal NULL letter.

Parameters
thispointer to the ytStrBuff instance.
Returns
length of the string in the buffer.

◆ ytStrBuff_new()

ytStrBuff * ytStrBuff_new ( )

Generates the new ytStrBuff instance.

Returns
pointer to the new ytStrBuff instance, or NULL if failed to allocate.

◆ ytStrBuff_ptr()

void * ytStrBuff_ptr ( const ytStrBuff this)

Returns the pointer pointing to the current string.

If the buffer contains nothing, in other words, if no memory space is allocated for the buffer, then this returns NULL.

Parameters
thispointer to the ytStrBuff.

◆ ytStrBuff_str()

const char * ytStrBuff_str ( const ytStrBuff this)

Returns the pointer pointing to the current string.

If the buffer contains nothing, in other words, if no memory space is allocated for the buffer, then this returns the constant pointer to the empty string.

Parameters
thispointer to the ytStrBuff.

The documentation for this class was generated from the following file: