3 #include "NPLMemPool.h" 8 template <
typename UserAllocator = ParaEngine::CNPLPool_Char_allocator >
30 template <
typename UserAllocator>
36 typedef UserAllocator user_allocator;
75 inline size_t length()
const {
return m_size; }
76 inline size_t size()
const {
return m_size; }
86 inline bool empty()
const {
return m_size == 0; }
94 void append(
const string_type& sz);
99 void append(
const Char* sz);
105 void append(
const Char* sz,
size_t len);
118 void appendBinary(uint16 i);
119 void appendBinary(uint32 i);
126 template <
class T>
inline void appendHex(
const T& i) {
for (
size_t j = 0; j <
sizeof(T); ++j)
appendHex(*(((uint8*)&i) + j)); }
131 inline void append(_W64
unsigned int i) {
append((uint32) i); }
133 inline void append(
unsigned int i) {
append((uint32) i); }
138 #endif // platform-switch. 150 template<
typename TYPE>
153 memcpy(m_buffer + nIndex, &val,
sizeof(TYPE));
156 void WriteAt(
int nIndex,
const Char* data,
size_t nSize);
175 void remove(int32 start);
183 void remove(int32 start, int32 end);
186 inline void pop_back() {
if (m_size > 0) --m_size; }
191 template<
typename TYPE>
inline void set(
const TYPE& val) {
clear();
append(val); }
202 const Char*
c_str()
const;
203 inline operator const Char*()
const {
return c_str(); }
206 Char*
str() {
return m_buffer; };
209 Char&
operator[] (
const int nIndex) {
return *(m_buffer+nIndex); };
216 int32
index(Char c)
const;
223 int32
rindex(Char c)
const;
227 Char
back()
const { assert(m_size > 0);
return m_buffer[m_size-1]; }
229 void enlarge(
size_t minimum);
237 template <
typename UserAllocator>
240 append((
const char*)(&i), 4);
243 template <
typename UserAllocator>
246 append((
const char*)(&i), 2);
StringBuilderT()
Creates a new builder with an empty buffer.
Definition: StringBuilder.hpp:221
void appendHex(uint8 i)
Appends the integer value, after converting it to a fm::string, in hexadecimal, to the content of the...
Definition: StringBuilder.hpp:388
int32 index(Char c) const
Retrieves the index of the first character within the content of the builder that is equivalent to th...
Definition: StringBuilder.hpp:429
string_type ToString() const
Converts the content of the builder to a standard string.
Definition: StringBuilder.h:196
void appendHex(const T &i)
See above.
Definition: StringBuilder.h:126
StringBuilderT & operator=(const TYPE &val)
See above.
Definition: StringBuilder.h:192
different physics engine has different winding order.
Definition: EventBinding.h:32
void append(long i)
See above.
Definition: StringBuilder.h:137
int32 rindex(Char c) const
Retrieves the index of the last character within the content of the builder that is equivalent to the...
Definition: StringBuilder.hpp:443
void resize(size_t length)
resize the buffer
Definition: StringBuilder.hpp:247
Char * str()
get raw string
Definition: StringBuilder.h:206
void clear()
Clears the content of the builder.
Definition: StringBuilder.hpp:241
const Char * c_str() const
Converts the content of the builder to a character array.
Definition: StringBuilder.hpp:420
std::string string_type
The standard string object which correspond to the builder.
Definition: StringBuilder.h:35
StringBuilderT< ParaEngine::CNPLPool_Char_allocator > StringBuilder
the string builder class using CNPLPool_Char_alloc
Definition: StringBuilder.h:9
void append(Char c)
Appends a character to the content of the builder.
Definition: StringBuilder.hpp:257
void WriteAt(int nIndex, const TYPE &val)
this is useful for writing to a previous cached location.
Definition: StringBuilder.h:151
size_t length() const
Retrieves the length of the content within the builder.
Definition: StringBuilder.h:75
Char & operator[](const int nIndex)
overload the operator [].
Definition: StringBuilder.h:209
void reserve(size_t length)
Reserves a given number of character slots.
Definition: StringBuilder.hpp:480
A NON-thread-safe, mutable sequence of characters(Binary is also possible).
Definition: StringBuilder.h:9
~StringBuilderT()
Deletes the builder.
Definition: StringBuilder.hpp:229
bool empty() const
Retrieves whether the builder is empty.
Definition: StringBuilder.h:86
StringBuilderT & operator+=(const TYPE &val)
Appends a value to the content of the builder.
Definition: StringBuilder.h:163
void pop_back()
Removes the last character of the content of the builder.
Definition: StringBuilder.h:186
void appendLine(const Char *sz)
Appends a character array to the content of the builder.
Definition: StringBuilder.hpp:381
Char back() const
Retrieves the last character within the content of the builder.
Definition: StringBuilder.h:227