--- parser3/src/include/pa_string.h 2009/10/15 01:07:20 1.196 +++ parser3/src/include/pa_string.h 2010/08/27 02:53:34 1.198 @@ -8,7 +8,7 @@ #ifndef PA_STRING_H #define PA_STRING_H -static const char * const IDENT_STRING_H="$Date: 2009/10/15 01:07:20 $"; +static const char * const IDENT_STRING_H="$Date: 2010/08/27 02:53:34 $"; // includes #include "pa_types.h" @@ -103,9 +103,10 @@ public: L_URI='U', ///< text in uri L_SQL='Q', ///< ^table:sql body L_JS='J', ///< JavaScript code - L_XML='X', ///< ^dom:set xml + L_XML='X', ///< ^xdoc:create xml L_HTML='H', ///< HTML code - L_REGEX='R', ///< RegEx expression + L_REGEX='R', ///< RegExp + L_JSON='S', ///< JSON code L_HTTP_COOKIE='C', ///< cookies encoded as %uXXXX for compartibility with js functions encode/decode L_FILE_POST='f', ///< temporary escaping zero-char L_PARSER_CODE='p', ///< ^process body @@ -363,7 +364,15 @@ public: CORD get_cord() const { return body; } uint get_hash_code() const; - const char* cstr() const { return CORD_to_const_char_star(body, length()); } + const char* cstr() const { +#ifdef STRING_LENGTH_CACHING + string_length = length(); + if(string_length) + return const_cast(this)->body=CORD_to_const_char_star(body, string_length); +#endif + return CORD_to_const_char_star(body, length()); + } + char* cstrm() const { return CORD_to_char_star(body, length()); } #ifdef STRING_LENGTH_CACHING