39#ifndef BLOCXX_STRINGBUFFER_HPP_INCLUDE_GUARD_
40#define BLOCXX_STRINGBUFFER_HPP_INCLUDE_GUARD_
41#include "blocxx/BLOCXX_config.h"
54#if defined(BLOCXX_AIX)
55 static const size_t BLOCXX_DEFAULT_ALLOCATION_UNIT;
57 static const size_t BLOCXX_DEFAULT_ALLOCATION_UNIT = 128;
59 StringBuffer(
size_t allocSize = BLOCXX_DEFAULT_ALLOCATION_UNIT);
77 size_t len = ::strlen(str);
79 ::strcpy(m_bfr+m_len, str);
95 {
return append(str); }
97 {
return append(arg); }
108#if defined(BLOCXX_INT32_IS_INT) && defined(BLOCXX_INT64_IS_LONG_LONG)
118 char operator[] (
size_t ndx)
const;
126 return String(String::E_TAKE_OWNERSHIP, bfr, m_len);
137 void truncate(
size_t index);
145 const char* getLine(std::istream& is,
bool resetBuffer=
true);
147 bool endsWith(
char ch)
const;
148 bool startsWith(
char ch)
const;
154 const char*
c_str()
const {
return m_bfr; }
155 bool equals(
const char* arg)
const;
161 size_t freeSpace = m_allocated - (m_len+1);
165 size_t toalloc = m_allocated * 2 + len;
166 char* bfr =
new char[toalloc];
167 ::memmove(bfr, m_bfr, m_len);
169 m_allocated = toalloc;
The Bool class is an abstraction for the boolean data type.
The Char16 class is an abstraction for a double byte character.
String toString() const
Convert this to UTF8.
StringBuffer & append(const char *str)
StringBuffer & append(char c)
const char * c_str() const
StringBuffer & append(const String &arg)
StringBuffer & append(const StringBuffer &arg)
void checkAvail(size_t len=1)
This String class is an abstract data type that represents as NULL terminated string of characters.
const char * c_str() const
bool operator==(const Array< T > &x, const Array< T > &y)
ostream & operator<<(ostream &ostrm, const Bool &arg)
bool operator!=(const Array< T > &x, const Array< T > &y)
Determine two Arrays are not equal.
void swap(Array< T > &x, Array< T > &y)