--- parser3/src/include/pa_string.h 2001/02/11 11:27:24 1.15 +++ parser3/src/include/pa_string.h 2001/02/22 08:16:09 1.25 @@ -1,17 +1,17 @@ /* - $Id: pa_string.h,v 1.15 2001/02/11 11:27:24 paf Exp $ + $Id: pa_string.h,v 1.25 2001/02/22 08:16:09 paf Exp $ */ /* String Chunk0 ====== ======== - head--------->[ptr, size] - append_here-------->[ptr, size] - link_row ........ - . . - . [ptr, size] - ...........>[link to the next chunk] + head--------------->[ptr, size, ...] + append_here-------->[ptr, size, ...] + . + . + [ptr, size, ...] + link_row----------->[link to the next chunk] */ @@ -28,12 +28,13 @@ #include "pa_types.h" #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) +# define STRING_APPEND_PARAMS const char *src, size_t size, char *file, uint line +# define APPEND(src, size, file, line) real_append(src, size, file, line) #else -# define STRING_APPEND_PARAMS const char *src -# define APPEND(src, file, line) real_append(src) +# define STRING_APPEND_PARAMS const char *src, size_t size +# define APPEND(src, size, file, line) real_append(src, size) #endif +#define APPEND_CONST(src) APPEND(src, 0, 0, 0) class String : public Pooled { public: @@ -51,6 +52,8 @@ public: char *cstr() const; String& real_append(STRING_APPEND_PARAMS); bool operator == (const String& src) const; + bool operator == (char* src) const; + String& operator += (const String& src); uint hash_code() const; @@ -83,8 +86,8 @@ private: Chunk::Row *link_row; private: - // last chank allocated count - int curr_chunk_rows; + // last chunk + Chunk *last_chunk; // string size size_t fsize; @@ -105,5 +108,4 @@ private: //disabled }; - #endif