--- parser3/src/include/pa_string.h 2001/01/29 21:51:51 1.13 +++ parser3/src/include/pa_string.h 2001/02/11 11:27:24 1.15 @@ -1,5 +1,5 @@ /* - $Id: pa_string.h,v 1.13 2001/01/29 21:51:51 paf Exp $ + $Id: pa_string.h,v 1.15 2001/02/11 11:27:24 paf Exp $ */ /* @@ -24,10 +24,9 @@ #include +#include "pa_pool.h" #include "pa_types.h" -class Pool; - #ifndef NO_STRING_ORIGIN # define STRING_APPEND_PARAMS const char *src, char *file, uint line # define APPEND(src, file, line) real_append(src, file, line) @@ -36,8 +35,7 @@ class Pool; # define APPEND(src, file, line) real_append(src) #endif - -class String { +class String : public Pooled { public: enum { CR_PREALLOCATED_COUNT=5, @@ -46,24 +44,18 @@ public: public: - void *operator new(size_t size, Pool& apool); String(Pool& apool); - String(String& src); - size_t size() { return fsize; } - int used_rows() { return fused_rows; } - char *cstr(); + String(const String& src); + size_t size() const { return fsize; } + int used_rows() const { return fused_rows; } + char *cstr() const; String& real_append(STRING_APPEND_PARAMS); - bool operator == (String& src); + bool operator == (const String& src) const; - uint hash_code(); + uint hash_code() const; const Origin& origin() const { return head.rows[0].item.origin; } -protected: - - // the pool I'm allocated on - Pool& pool; - private: struct Chunk { @@ -113,4 +105,5 @@ private: //disabled }; + #endif