Update of /cvsroot/cppunit/cppunit2/include/cpptl
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1509/include/cpptl
Modified Files:
conststring.h
Log Message:
* ConstString, a string that can be safely passed between thread
* StringBuffer, a mutable string buffer designed for quick buffer expansion
Index: conststring.h
===================================================================
RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/conststring.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** conststring.h 26 Feb 2005 13:44:14 -0000 1.1
--- conststring.h 27 Feb 2005 10:11:45 -0000 1.2
***************
*** 2,9 ****
# define CPPTL_CONSTSTRING_H_INCLUDED
! # include <cpptl/config.h>
# include <string.h>
namespace CppTL {
class ConstStringIterator
--- 2,69 ----
# define CPPTL_CONSTSTRING_H_INCLUDED
[...991 lines suppressed...]
+ return ConstString( buffer_ + index, length );
+ }
+
+
+ inline void
+ StringBuffer::prepareBuffer( size_type length )
+ {
+ if ( length <= capacity_ )
+ return;
+ size_type newCapacity = (size_type(capacity_ * 1.43 + 16) & ~15) -1;
+ if ( length > newCapacity )
+ newCapacity = ((length + 16) & ~15) -1;
+ reserve( newCapacity );
+ }
+
} // namespace CppTL
+
#endif // CPPTL_CONSTSTRING_H_INCLUDED
|