GATE
Loading...
Searching...
No Matches
gate_cstrbuffer8_class Struct Reference

C-string buffer class. More...

#include <strings.h>

Data Fields

gate_char8_t const * str
 
gate_size_t length
 
gate_char8_theap_buffer
 
gate_char8_t local_buffer [GATE_DEFAULT_LINE_LENGTH]
 

Detailed Description

C-string buffer class.

GATE strings need not to be NUL-terminated, but many C APIs require this convention. A C-string buffer takes a string pointer, and check it for NUL-termination. If it's NUL-terminated, it takes it as it is. Otherwise it checks the length and tries to copy it into a local buffer. If the local buffer is not big enough, a heap allocation is done to copy the string into it. At the end we get a string pointer that points to a NUL-terminated string.

Field Documentation

◆ str

gate_char8_t const* str

actual pointer to NUL-terminated string

◆ length

gate_size_t length

length of NUL-terminated string (not counting the NUL char)

◆ heap_buffer

gate_char8_t* heap_buffer

optional point to heap-allocated string (for deletion)

◆ local_buffer

< optional local buffer for NUL-terminated string


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