GATE
gate_cstrbuffer8_class Struct Reference

C-string buffer class. More...

#include <strings.h>

Public Attributes

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.

Member Data Documentation

◆ heap_buffer

gate_char8_t* gate_cstrbuffer8_class::heap_buffer

optional point to heap-allocated string (for deletion)

◆ length

gate_size_t gate_cstrbuffer8_class::length

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

◆ local_buffer

gate_char8_t gate_cstrbuffer8_class::local_buffer[GATE_DEFAULT_LINE_LENGTH]

< optional local buffer for NUL-terminated string

◆ str

gate_char8_t const* gate_cstrbuffer8_class::str

actual pointer to NUL-terminated string


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