--- parser3/src/include/pa_string.h 2004/05/24 12:21:18 1.162 +++ parser3/src/include/pa_string.h 2007/04/20 10:19:12 1.168 @@ -1,17 +1,16 @@ /** @file Parser: string class decl. - Copyright (c) 2001-2004 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001-2005 ArtLebedev Group (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ #ifndef PA_STRING_H #define PA_STRING_H -static const char * const IDENT_STRING_H="$Date: 2004/05/24 12:21:18 $"; +static const char * const IDENT_STRING_H="$Date: 2007/04/20 10:19:12 $"; // includes - #include "pa_types.h" #include "pa_array.h" @@ -20,6 +19,8 @@ extern "C" { // cord's author forgot to #include "cord.h" }; +// defines + // cord extension /* Returns true if x does contain */ /* char not_c at positions i..i+n. Value i,i+n must be < CORD_len(x). */ @@ -90,11 +91,11 @@ public: L_HTTP_HEADER='h', ///< text in HTTP response header L_MAIL_HEADER='m', ///< text in mail header L_URI='U', ///< text in uri - L_TABLE='L', ///< ^table:set body L_SQL='Q', ///< ^table:sql body L_JS='J', ///< JavaScript code L_XML='X', ///< ^dom:set xml - L_HTML='H', ///< HTML code (for editing) + L_HTML='H', ///< HTML code + L_REGEX='R', ///< RegEx expression // READ WARNING ABOVE BEFORE ADDING ANYTHING L_OPTIMIZE_BIT = 0x80 ///< flag, requiring cstr whitespace optimization }; @@ -153,6 +154,7 @@ public: public: const char* v() const; + void dump() const; Languages(): langs(0) {} Languages(Language alang) { @@ -241,7 +243,7 @@ public: callback(opt.lang, get_length(current), info); } - bool invariant(size_t current_length) { + bool invariant(size_t current_length) const { if(!langs) return current_length==0; if(opt.is_not_just_lang) @@ -257,6 +259,7 @@ public: public: const char* v() const; + void dump() const; Body(): body(CORD_EMPTY) {} Body(CORD abody): body(abody) { @@ -374,9 +377,9 @@ private: Languages langs; ///< string characters lang const char* v() const; - -#define ASSERT_STRING_INVARIANT(string) \ - assert((string).langs.invariant((string).body.length())) + void dump() const; + #define ASSERT_STRING_INVARIANT(string) \ + assert((string).langs.invariant((string).body.length())) public: @@ -498,7 +501,7 @@ public: const String& regexp, const String* options, Row_action row_action, void *info, - bool& just_matched) const; + int& matches_count) const; enum Change_case_kind { CC_UPPER, CC_LOWER @@ -509,6 +512,7 @@ public: const String& trim(Trim_kind kind=TRIM_BOTH, const char* chars=0) const; double as_double() const { return pa_atod(cstr(), this); } int as_int() const { return pa_atoi(cstr(), this); } + bool as_bool() const { return as_int()!=0; } private: //disabled