/[winpt]/trunk/Src/StringBuffer.cpp
ViewVC logotype

Diff of /trunk/Src/StringBuffer.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 326 by twoaday, Fri Sep 25 15:53:21 2009 UTC revision 441 by twoaday, Sat Apr 14 14:11:03 2012 UTC
# Line 28  void StringBuffer::addCharacters (const Line 28  void StringBuffer::addCharacters (const
28    
29    
30  /* Create an empty buffer object. */  /* Create an empty buffer object. */
31  StringBuffer::StringBuffer ()  StringBuffer::StringBuffer (void)
32  {  {
33      alloced_size = 0;      alloced_size = 0;
34      size = 0;      size = 0;
# Line 58  StringBuffer::StringBuffer (const char * Line 58  StringBuffer::StringBuffer (const char *
58    
59    
60  /* Destructor which fres the used memory. */  /* Destructor which fres the used memory. */
61  StringBuffer::~StringBuffer ()  StringBuffer::~StringBuffer (void)
62  {  {
63      if (private_contents != NULL)      if (private_contents != NULL)
64          delete []private_contents;          delete []private_contents;
# Line 120  void StringBuffer::add (int val) Line 120  void StringBuffer::add (int val)
120      addCharacters (tmp, strlen (tmp));          addCharacters (tmp, strlen (tmp));    
121  }  }
122    
123    void StringBuffer::add(const char* val, size_t len)
124    {
125        if (len > strlen(val))
126            len = strlen(val);
127        addCharacters(val, len);
128    }
129    
130  /* Add a single character to the buffer. */  /* Add a single character to the buffer. */
131  void StringBuffer::add (char val)  void StringBuffer::add (char val)
# Line 190  StringBuffer& StringBuffer::operator +(c Line 196  StringBuffer& StringBuffer::operator +(c
196      return *this;      return *this;
197  }  }
198    
199    StringBuffer& StringBuffer::operator +(char *val)
200    {
201        addCharacters (val, strlen(val));
202        return *this;
203    }
204    
205    
206  StringBuffer& StringBuffer::operator +=(int val)  StringBuffer& StringBuffer::operator +=(int val)
207  {  {
# Line 212  StringBuffer& StringBuffer::operator +=( Line 224  StringBuffer& StringBuffer::operator +=(
224  }  }
225    
226    
227    StringBuffer& StringBuffer::operator +=(char *val)
228    {
229        addCharacters (val, strlen (val));
230        return *this;
231    }
232    
233    
234  StringBuffer& StringBuffer::operator +=(char val)  StringBuffer& StringBuffer::operator +=(char val)
235  {  {
236      add (val);      add (val);
# Line 223  StringBuffer& StringBuffer::operator=(co Line 242  StringBuffer& StringBuffer::operator=(co
242  {  {
243      reset ();      reset ();
244      addCharacters (val, strlen (val));      addCharacters (val, strlen (val));
245        return *this;
246    }
247    
248    StringBuffer& StringBuffer::operator=(char *val)
249    {
250        reset ();
251        addCharacters (val, strlen (val));
252      return *this;      return *this;
253  }  }

Legend:
Removed from v.326  
changed lines
  Added in v.441

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26