Diff for /parser3/src/include/pa_string.h between versions 1.224 and 1.232

version 1.224, 2017/12/05 22:59:58 version 1.232, 2024/03/14 03:17:01
Line 1 Line 1
 /** @file  /** @file
         Parser: string class decl.          Parser: string class decl.
   
         Copyright (c) 2001-2017 Art. Lebedev Studio (http://www.artlebedev.com)          Copyright (c) 2001-2023 Art. Lebedev Studio (http://www.artlebedev.com)
         Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)          Authors: Konstantin Morshnev <moko@design.ru>, Alexandr Petrosian <paf@design.ru>
 */  */
   
 #ifndef PA_STRING_H  #ifndef PA_STRING_H
Line 47  class SQL_Connection; Line 47  class SQL_Connection;
 class Dictionary;  class Dictionary;
 class Request_charsets;  class Request_charsets;
 class String;  class String;
 typedef Array<const String*> ArrayString;  
 class VRegex;  class VRegex;
   
   #ifdef NDEBUG
   typedef Array<const String*> ArrayString;
   #else
   class ArrayString : public Array<const String*> {
   public:
           inline ArrayString(size_t initial=0) : Array(initial){
           }
           inline Array& operator+=(element_type src) {
                   assert(src != NULL);
                   return Array::operator+=(src);
           }
   
           inline element_type get(size_t index) const {
                   element_type result=Array::get(index);
                   assert(result != NULL);
                   return result;
           }
   };
   #endif
   
 // generally useful  // generally useful
   
 int pa_atoi(const char* str, const String* problem_source=0);  double pa_atod(const char* str, const String* problem_source);
 double pa_atod(const char* str, const String* problem_source=0);  int pa_atoi(const char* str, int base=10, const String* problem_source=0);
 unsigned int pa_atoui(const char *str, int base, const String* problem_source=0);  unsigned int pa_atoui(const char *str, int base=10, const String* problem_source=0);
 unsigned long long int pa_atoul(const char *str, int base, const String* problem_source=0);  uint64_t pa_atoul(const char *str, int base=10, const String* problem_source=0);
   
 /// this is result of pos functions which mean that substr were not found  /// this is result of pos functions which mean that substr were not found
 #define STRING_NOT_FOUND ((size_t)-1)  #define STRING_NOT_FOUND ((size_t)-1)
Line 90  public: Line 109  public:
   
                 WARNING WARNING WARNING WARNING WARNING WARNING                   WARNING WARNING WARNING WARNING WARNING WARNING 
         */          */
   
   #if _MSC_VER >= 1900
           /// required for VS2015+ to make sizeof(Languages::opt) == sizeof(CORD), will be 16 byte under x64 without it
           enum Language : size_t {
   #else
         enum Language {          enum Language {
                 L_UNSPECIFIED=0, ///< no real string has parts of this lange: it's just convinient to check when string's empty  #endif
                   L_UNSPECIFIED=0,        ///< no real string has parts of this lange: it's just convinient to check when string's empty
                 // these two must go before others, there are checks for >L_AS_IS                  // these two must go before others, there are checks for >L_AS_IS
                 L_CLEAN='0',    ///< clean  WARNING: read above warning before changing                  L_CLEAN='0',            ///< clean  WARNING: read above warning before changing
                 L_AS_IS='A',    ///< leave all characters intact  WARNING: read above warning before changing                  L_AS_IS='A',            ///< leave all characters intact  WARNING: read above warning before changing
   
                 L_TAINTED='T',  ///< tainted, untaint lang as assigned later                   L_TAINTED='T',          ///< tainted, untaint lang as assigned later
                 // untaint langs. assigned by ^untaint[lang]{...}                  // untaint langs. assigned by ^untaint[lang]{...}
                 L_FILE_SPEC='F',        ///< file specification                  L_FILE_SPEC='F',        ///< file specification
                 L_HTTP_HEADER='h',      ///< text in HTTP response header                  L_HTTP_HEADER='h',      ///< text in HTTP response header
                 L_MAIL_HEADER='m',      ///< text in mail header                  L_MAIL_HEADER='m',      ///< text in mail header
                 L_URI='U',                      ///< text in uri                  L_URI='U',              ///< text in uri
                 L_SQL='Q',                      ///< ^table:sql body                  L_SQL='Q',              ///< ^table:sql body
                 L_JS='J',                       ///< JavaScript code                  L_JS='J',               ///< JavaScript code
                 L_XML='X',                      ///< ^xdoc:create xml                  L_XML='X',              ///< ^xdoc:create xml
                 L_HTML='H',                     ///< HTML code                  L_HTML='H',             ///< HTML code
                 L_REGEX='R',            ///< RegExp                  L_REGEX='R',            ///< RegExp
                 L_JSON='S',                     ///< JSON code                  L_JSON='S',             ///< JSON code
                 L_HTTP_COOKIE='C',      ///< cookies encoded as %uXXXX for compartibility with js functions encode/decode                  L_HTTP_COOKIE='C',      ///< cookies encoded as %uXXXX for compartibility with js functions encode/decode
                 L_PARSER_CODE='p',      ///< ^process body                  L_PARSER_CODE='p',      ///< ^process body
                 // READ WARNING ABOVE BEFORE ADDING ANYTHING                  // READ WARNING ABOVE BEFORE ADDING ANYTHING
Line 677  public: Line 702  public:
         const String& replace(const Dictionary& dict) const;          const String& replace(const Dictionary& dict) const;
         const String& trim(Trim_kind kind=TRIM_BOTH, const char* chars=0, Charset* source_charset=0) const;          const String& trim(Trim_kind kind=TRIM_BOTH, const char* chars=0, Charset* source_charset=0) const;
         double as_double() const { return pa_atod(cstr(), this); }          double as_double() const { return pa_atod(cstr(), this); }
         int as_int() const { return pa_atoi(cstr(), this); }          int as_int() const { return pa_atoi(cstr(), 0, this); }
         bool as_bool() const { return as_int()!=0; }          bool as_bool() const { return as_int()!=0; }
         const String& escape(Charset& source_charset) const;          const String& escape(Charset& source_charset) const;
   

Removed from v.1.224  
changed lines
  Added in v.1.232


E-mail: