All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
kzc_string_buffer.h File Reference

String buffer. More...

Functions

kzsError kzcStringBufferCreate (const struct KzcMemoryManager *memoryManager, kzUint initialCapacity, struct KzcStringBuffer **out_stringBuffer)
 Creates a new string buffer with capacity to hold string of given length. More...
 
kzsError kzcStringBufferCreateDefault (const struct KzcMemoryManager *memoryManager, struct KzcStringBuffer **out_stringBuffer)
 Creates a new string buffer with initial capacity of 16 characters. More...
 
kzsError kzcStringBufferDelete (struct KzcStringBuffer *stringBuffer)
 Deletes a string buffer. More...
 
kzsError kzcStringBufferAppend (struct KzcStringBuffer *stringBuffer, kzString string)
 Appends the given string to the end of a string buffer. More...
 
kzsError kzcStringBufferAppendCharacter (struct KzcStringBuffer *stringBuffer, kzChar character)
 Appends the given character to the end of a string buffer. More...
 
kzsError kzcStringBufferAppendUnicodeCharacter (struct KzcStringBuffer *stringBuffer, kzUnicodeChar character)
 Appends the given unicode character to the end of a string buffer. More...
 
kzsError kzcStringBufferAppendFormat (struct KzcStringBuffer *stringBuffer, kzString format,...)
 Appends the given format string to the end of a string buffer. More...
 
void kzcStringBufferClear (struct KzcStringBuffer *stringBuffer)
 Clears the content of the string buffer. More...
 
kzUint kzcStringBufferGetLength (const struct KzcStringBuffer *stringBuffer)
 Returns the length of a string buffer. More...
 
kzString kzcStringBufferGetString (const struct KzcStringBuffer *stringBuffer)
 Returns the underlying string of the string buffer. More...
 
kzsError kzcStringBufferToString (const struct KzcMemoryManager *memoryManager, const struct KzcStringBuffer *stringBuffer, kzMutableString *out_string)
 Creates an ordinary mutable string from a string buffer. More...
 

Detailed Description

String buffer.

Copyright 2008-2020 by Rightware. All rights reserved.

Function Documentation

kzsError kzcStringBufferCreate ( const struct KzcMemoryManager memoryManager,
kzUint  initialCapacity,
struct KzcStringBuffer **  out_stringBuffer 
)

Creates a new string buffer with capacity to hold string of given length.

kzsError kzcStringBufferCreateDefault ( const struct KzcMemoryManager memoryManager,
struct KzcStringBuffer **  out_stringBuffer 
)

Creates a new string buffer with initial capacity of 16 characters.

kzsError kzcStringBufferDelete ( struct KzcStringBuffer stringBuffer)

Deletes a string buffer.

kzsError kzcStringBufferAppend ( struct KzcStringBuffer stringBuffer,
kzString  string 
)

Appends the given string to the end of a string buffer.

kzsError kzcStringBufferAppendCharacter ( struct KzcStringBuffer stringBuffer,
kzChar  character 
)

Appends the given character to the end of a string buffer.

kzsError kzcStringBufferAppendUnicodeCharacter ( struct KzcStringBuffer stringBuffer,
kzUnicodeChar  character 
)

Appends the given unicode character to the end of a string buffer.

kzsError kzcStringBufferAppendFormat ( struct KzcStringBuffer stringBuffer,
kzString  format,
  ... 
)

Appends the given format string to the end of a string buffer.

void kzcStringBufferClear ( struct KzcStringBuffer stringBuffer)

Clears the content of the string buffer.

As a result the string buffer will contain an empty string. Capacity is not decreased with this call.

kzUint kzcStringBufferGetLength ( const struct KzcStringBuffer stringBuffer)

Returns the length of a string buffer.

kzString kzcStringBufferGetString ( const struct KzcStringBuffer stringBuffer)

Returns the underlying string of the string buffer.

This can be used to quickly access the content of the string buffer.

kzsError kzcStringBufferToString ( const struct KzcMemoryManager memoryManager,
const struct KzcStringBuffer stringBuffer,
kzMutableString out_string 
)

Creates an ordinary mutable string from a string buffer.

This can be used to retrieve the content of the string buffer for storing it after the string buffer itself is no longer needed. This function allocates a new string, which must be manually freed when no longer needed.