--- parser3/src/include/pa_string.h 2003/01/24 11:33:02 1.144.2.5 +++ parser3/src/include/pa_string.h 2003/01/27 15:07:47 1.144.2.7 @@ -8,7 +8,7 @@ #ifndef PA_STRING_H #define PA_STRING_H -static const char* IDENT_STRING_H="$Date: 2003/01/24 11:33:02 $"; +static const char* IDENT_STRING_H="$Date: 2003/01/27 15:07:47 $"; #include "pa_pool.h" #include "pa_types.h" @@ -22,8 +22,8 @@ typedef object_ptr StringPtr; typedef object_ptr ConstStringPtr; const ConstStringPtr ConstStringPtrZero(0); -class Table; -typedef object_ptr TablePtr; +//class Table; +//typedef object_ptr
TablePtr; class SQL_Connection; class Dictionary; @@ -32,7 +32,7 @@ class Dictionary; #ifndef NO_STRING_ORIGIN # define STRING_APPEND_PARAMS \ const char *src, size_t size, \ - uchar lang, \ + String_UL lang, \ const char *file, uint line /// appends piece to String @see String::real_append # define APPEND(src, size, lang, file, line) \ @@ -41,7 +41,7 @@ class Dictionary; # define STRING_APPEND_PARAMS \ const char *src, \ size_t size, \ - uchar lang + String_UL lang /// appends piece to String @see String::real_append # define APPEND(src, size, lang, file, line) \ real_append(src, size, lang) @@ -58,8 +58,10 @@ class Dictionary; /// handy: appends const char* piece to String @see String::real_append #define APPEND_CONST(src) APPEND_AS_IS(src, 0, 0, 0) +typedef uint String_UL; + struct String_fragment { - uchar/*Untaint_lang*/ lang; ///< untaint flag, later untaint language + String_UL/*Untaint_lang*/ lang; ///< untaint flag, later untaint language const char *ptr; ///< pointer to the start size_t size; ///< length @@ -111,14 +113,14 @@ public: UL_JS, ///< JavaScript code UL_XML, ///< ^dom:set xml UL_HTML, ///< HTML code (for editing) - UL_OPTIMIZE_BIT = 0x80 ///< flag, requiring cstr whitespace optimization + UL_OPTIMIZE_BIT = 0x8000 ///< flag, requiring cstr whitespace optimization }; public: static const ConstStringPtr undefined_origin; //static String& OnPool(Pool& apool, const char *local_src=0, size_t src_size=0, bool tainted=false); - String(const char *src=0, size_t src_size=0, bool tainted=false); + explicit String(const char *src=0, size_t src_size=0, bool tainted=false); String(const String& src); bool is_empty() const { return !size(); } size_t size() const { return fsize; } @@ -186,7 +188,7 @@ public: String& operator << (const String& src) { return append(src, UL_PASS_APPENDED); } String& operator << (const char *src) { return APPEND_CONST(src); } - /// simple hash code of string. used by Hash + /// simple hash code of string uint hash_code() const; /// extracts first char of a string, if any @@ -213,10 +215,10 @@ public: const String& delim, Untaint_lang lang=UL_UNSPECIFIED, int limit=-1) const; - typedef void (*Row_action)(Table& table, Array *row, +/* typedef void (*Row_action)(Table& table, Array *row, int prestart, int prefinish, int poststart, int postfinish, - void *info); + void *info);*/ /** @return table of found items, if any. table format is defined and fixed[can be used by others]: @@ -224,12 +226,12 @@ public: prematch/match/postmatch/1/2/3/... @endverbatim */ - TablePtr match(Charset& source_charset, +/* TablePtr match(Charset& source_charset, ConstStringPtr aorigin, const String& regexp, ConstStringPtr options, Row_action row_action, void *info, - bool *was_global=0) const; + bool *was_global=0) const;*/ enum Change_case_kind { CC_UPPER, CC_LOWER @@ -247,10 +249,6 @@ public: const String_fragment::Origin& origin() const; #endif -private: - - Untaint_lang lang_of(size_t offset) const; - size_t cstr_bufsize(Untaint_lang lang=UL_UNSPECIFIED, SQL_Connection *connection=0, Charset *buf_charset=0) const; @@ -270,6 +268,15 @@ private: //disabled }; +/// simple hash code of string. used by Hash +inline uint hash_code(const String& self) { + return self.hash_code(); +} +/// simple hash code of string. used by Hash +inline uint hash_code(ConstStringPtr self) { + return self->hash_code(); +} + // statics const ConstStringPtr String::undefined_origin=ConstStringPtr(0);