Nebula
Loading...
Searching...
No Matches
stringbuffer.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
24#include "core/types.h"
25#include "util/array.h"
26
27//------------------------------------------------------------------------------
28namespace Util
29{
31{
32public:
37
39 void Setup(SizeT size);
41 void Discard();
43 bool IsValid() const;
44
46 const char* AddString(const char* str);
48 const char* NextString(const char* prev);
50 SizeT GetNumChunks() const;
51
52private:
54 void AllocNewChunk();
55
59};
60
61//------------------------------------------------------------------------------
64inline bool
66{
67 return (0 != this->curPointer);
68}
69
70//------------------------------------------------------------------------------
73inline SizeT
75{
76 return this->chunks.Size();
77}
78
79} // namespace Util;
80//------------------------------------------------------------------------------
Nebula's dynamic array class.
Definition array.h:60
const SizeT Size() const
get number of elements in array
Definition array.h:880
Global string buffer for the StringAtom system.
Definition stringbuffer.h:31
SizeT GetNumChunks() const
DEBUG: get number of allocated chunks.
Definition stringbuffer.h:74
char * curPointer
Definition stringbuffer.h:58
void AllocNewChunk()
allocate a new chunk
Definition stringbuffer.cc:70
const char * AddString(const char *str)
add a string to the end of the string buffer, return pointer to string
Definition stringbuffer.cc:83
Util::Array< char * > chunks
Definition stringbuffer.h:56
SizeT chunkSize
Definition stringbuffer.h:57
bool IsValid() const
return true if string buffer has been setup
Definition stringbuffer.h:65
~StringBuffer()
destructor
Definition stringbuffer.cc:27
const char * NextString(const char *prev)
DEBUG: return next string in string buffer.
StringBuffer()
constructor
Definition stringbuffer.cc:17
void Setup(SizeT size)
setup the string buffer with size in bytes
Definition stringbuffer.cc:40
void Discard()
discard the string buffer
Definition stringbuffer.cc:52
A pinned array is an array which manages its own virtual memory.
Definition String.cs:6
int SizeT
Definition types.h:49