regify utility  2.0.0-0
Buffer Functions

This section contains utilities relating to buffer management. More...

Modules

 Buffer Object
 A data buffer implementation. This implementation allows for dynamically creating a buffer and appending to it in a reasonably efficient matter. It is like String Object but is not NULL terminated. Functions of both may be used interchangeably.
 

Macros

#define ruBufferNew(initialSize)   (ruBuffer) ruStringNewn(NULL, initialSize)
 Creates a new buffer object of given initial size. A Buffer Object is essentially a String Object that is not NULL terminated and therefore has a length parameter. String Object and Buffer Object may be used interchangeably. More...
 
#define ruBufferAppend(rb, buf, len)   ruStringAppendn(rb, buf, len)
 Append given data to Buffer Object. More...
 
#define ruBufferGetData(rb)   ruStringGetCString(rb)
 Returns the underlying char* of the given Buffer Object. More...
 
#define ruBufferLen(rb, code)   ruStringLen(rb, code)
 Returns the current length of the Buffer Object. More...
 
#define ruBufferFree(rb, keep)   ruStringFree(rb, keep);
 Frees the given String Object object. More...
 

Typedefs

typedef void * ruBuffer
 An opaque data type representing a regify-util string object that is not NULL terminated. More...
 

Functions

RUAPI int32_t ruBufferAppendUriEncoded (ruString rs, const char *buf, rusize len)
 Append given string URI encoded to String Object. More...
 

Detailed Description

This section contains utilities relating to buffer management.

Macro Definition Documentation

◆ ruBufferAppend

#define ruBufferAppend (   rb,
  buf,
  len 
)    ruStringAppendn(rb, buf, len)

Append given data to Buffer Object.

Parameters
rbData buffer to append data to.
bufdata to append.
lenNumber of bytes of data to append.
Returns
RUE_OK on success else a regify error code.

◆ ruBufferFree

#define ruBufferFree (   rb,
  keep 
)    ruStringFree(rb, keep);

Frees the given String Object object.

Parameters
rbString to free
keepWhether to also free the underlying char* buffer.

◆ ruBufferGetData

#define ruBufferGetData (   rb)    ruStringGetCString(rb)

Returns the underlying char* of the given Buffer Object.

Parameters
rbString buffer to return buffer of.
Returns
Underlying char* or NULL in case rs was invalid.

◆ ruBufferLen

#define ruBufferLen (   rb,
  code 
)    ruStringLen(rb, code)

Returns the current length of the Buffer Object.

Parameters
rbData buffer to return the length of.
code(Optional) Stores RUE_OK on success or regify error code.
Returns
The length of the string or 0 in case of an error.

◆ ruBufferNew

#define ruBufferNew (   initialSize)    (ruBuffer) ruStringNewn(NULL, initialSize)

Creates a new buffer object of given initial size. A Buffer Object is essentially a String Object that is not NULL terminated and therefore has a length parameter. String Object and Buffer Object may be used interchangeably.

Parameters
initialSizeInitial buffer to allocate.
Returns
The newly created Buffer Object object to be freed with ruBufferFree or NULL on error. Check ruLastError in case of NULL;

Typedef Documentation

◆ ruBuffer

typedef void* ruBuffer

An opaque data type representing a regify-util string object that is not NULL terminated.

Function Documentation

◆ ruBufferAppendUriEncoded()

RUAPI int32_t ruBufferAppendUriEncoded ( ruString  rs,
const char *  buf,
rusize  len 
)

Append given string URI encoded to String Object.

Parameters
rsData buffer to append data to.
bufData to append.
lenNumber of bytes of data to append.
Returns
RUE_OK on success else a regify error code.