--- parser3/src/include/pa_string.h 2001/01/29 15:56:03 1.10 +++ parser3/src/include/pa_string.h 2001/01/29 21:51:51 1.13 @@ -1,5 +1,5 @@ /* - $Id: pa_string.h,v 1.10 2001/01/29 15:56:03 paf Exp $ + $Id: pa_string.h,v 1.13 2001/01/29 21:51:51 paf Exp $ */ /* @@ -29,10 +29,10 @@ class Pool; #ifndef NO_STRING_ORIGIN -# define STRING_APPEND_PARAMS char *src, char *file, uint line +# define STRING_APPEND_PARAMS const char *src, char *file, uint line # define APPEND(src, file, line) real_append(src, file, line) #else -# define STRING_APPEND_PARAMS char *src +# define STRING_APPEND_PARAMS const char *src # define APPEND(src, file, line) real_append(src) #endif @@ -46,21 +46,23 @@ public: public: - void *operator new(size_t size, Pool *apool); - String(Pool *apool); + 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 *c_str(); + char *cstr(); String& real_append(STRING_APPEND_PARAMS); bool operator == (String& src); uint hash_code(); + const Origin& origin() const { return head.rows[0].item.origin; } + protected: // the pool I'm allocated on - Pool *pool; + Pool& pool; private: @@ -70,7 +72,7 @@ private: union Row { // chunk item struct { - char *ptr; // pointer to the start of string fragment + const char *ptr; // pointer to the start of string fragment size_t size; // length of the fragment Origin origin; // origin of this fragment } item; @@ -107,7 +109,7 @@ private: private: //disabled - String& operator = (String&) { return *this; } + String& operator = (const String&) { return *this; } };