--- parser3/src/include/pa_string.h 2001/01/26 15:43:11 1.1 +++ parser3/src/include/pa_string.h 2001/01/27 15:00:04 1.6 @@ -1,5 +1,5 @@ /* - $Id: pa_string.h,v 1.1 2001/01/26 15:43:11 paf Exp $ + $Id: pa_string.h,v 1.6 2001/01/27 15:00:04 paf Exp $ */ /* @@ -20,6 +20,8 @@ #include +#include "pa_types.h" + class Pool; class String { @@ -35,10 +37,8 @@ private: // the pool I'm allocated on Pool *pool; - // last chank allocated count cache - int curr_chunk_rows; struct Chunk { - // the number of rows per chunk + // the number of rows in chunk int count; union Row { // chunk item @@ -47,7 +47,7 @@ private: size_t size; // length of the fragment } item; Chunk *link; // link to the next chunk in chain - } first[CR_PREALLOCATED_COUNT]; + } rows[CR_PREALLOCATED_COUNT]; // next rows are here Chunk *preallocated_link; } @@ -60,6 +60,17 @@ private: // of the link to the next chunk to allocate Chunk::Row *link_row; +private: + // last chank allocated count + int curr_chunk_rows; + + // string size + size_t fsize; + + // used rows in all chunks + int fused_rows; + +private: // new&constructors made private to enforce factory manufacturing at pool void *operator new(size_t size, Pool *apool); @@ -77,11 +88,20 @@ private: } void expand(); +private: //disabled + + String& operator = (String& src) { return *this; } + public: - size_t size(); + String(String& src); + size_t size() { return fsize; } + int used_rows() { return fused_rows; } char *c_str(); String& operator += (char *src); + bool operator == (String& src); + + uint hash_code(); }; #endif