Nebula
Toggle main menu visibility
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
//------------------------------------------------------------------------------
28
namespace
Util
29
{
30
class
StringBuffer
31
{
32
public
:
34
StringBuffer
();
36
~StringBuffer
();
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
52
private
:
54
void
AllocNewChunk
();
55
56
Util::Array<char*>
chunks
;
57
SizeT
chunkSize
;
58
char
*
curPointer
;
59
};
60
61
//------------------------------------------------------------------------------
64
inline
bool
65
StringBuffer::IsValid
()
const
66
{
67
return
(0 != this->
curPointer
);
68
}
69
70
//------------------------------------------------------------------------------
73
inline
SizeT
74
StringBuffer::GetNumChunks
()
const
75
{
76
return
this->
chunks
.Size();
77
}
78
79
}
// namespace Util;
80
//------------------------------------------------------------------------------
array.h
Util::Array
Nebula's dynamic array class.
Definition
array.h:61
Util::StringBuffer::GetNumChunks
SizeT GetNumChunks() const
DEBUG: get number of allocated chunks.
Definition
stringbuffer.h:74
Util::StringBuffer::curPointer
char * curPointer
Definition
stringbuffer.h:58
Util::StringBuffer::AllocNewChunk
void AllocNewChunk()
allocate a new chunk
Definition
stringbuffer.cc:70
Util::StringBuffer::AddString
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::StringBuffer::chunks
Util::Array< char * > chunks
Definition
stringbuffer.h:56
Util::StringBuffer::chunkSize
SizeT chunkSize
Definition
stringbuffer.h:57
Util::StringBuffer::IsValid
bool IsValid() const
return true if string buffer has been setup
Definition
stringbuffer.h:65
Util::StringBuffer::~StringBuffer
~StringBuffer()
destructor
Definition
stringbuffer.cc:27
Util::StringBuffer::NextString
const char * NextString(const char *prev)
DEBUG: return next string in string buffer.
Util::StringBuffer::StringBuffer
StringBuffer()
constructor
Definition
stringbuffer.cc:17
Util::StringBuffer::Setup
void Setup(SizeT size)
setup the string buffer with size in bytes
Definition
stringbuffer.cc:40
Util::StringBuffer::Discard
void Discard()
discard the string buffer
Definition
stringbuffer.cc:52
Util
A quad tree designed to return regions of free 2D space.
Definition
String.cs:6
types.h
SizeT
int SizeT
Definition
types.h:42
code
foundation
util
stringbuffer.h
Generated on
for Nebula. Dark theme by
Tilen Majerle
. All rights reserved.