Diff for /parser3/src/include/pa_request.h between versions 1.78 and 1.97

version 1.78, 2001/04/06 10:32:18 version 1.97, 2001/09/24 14:34:25
Line 11 Line 11
 #ifndef PA_REQUEST_H  #ifndef PA_REQUEST_H
 #define PA_REQUEST_H  #define PA_REQUEST_H
   
   #include "pa_config_includes.h"
 #include "pa_pool.h"  #include "pa_pool.h"
 #include "pa_hash.h"  #include "pa_hash.h"
 #include "pa_wcontext.h"  #include "pa_wcontext.h"
Line 20 Line 21
 #include "pa_vobject.h"  #include "pa_vobject.h"
 #include "pa_venv.h"  #include "pa_venv.h"
 #include "pa_vform.h"  #include "pa_vform.h"
   #include "pa_vmath.h"
 #include "pa_vrequest.h"  #include "pa_vrequest.h"
 #include "pa_vresponse.h"  #include "pa_vresponse.h"
 #include "pa_vcookie.h"  #include "pa_vcookie.h"
Line 43 Line 45
 #endif  #endif
   
 class Temp_lang;  class Temp_lang;
   class Methoded;
   
 /// Main workhorse.  /// Main workhorse.
 class Request : public Pooled {  class Request : public Pooled {
Line 78  public: Line 81  public:
                 BEWARE: may throw exception to you: catch it!                  BEWARE: may throw exception to you: catch it!
         */          */
         void core(          void core(
                 const char *root_auto_path, ///< path to system auto.p file                  const char *root_config_filespec, ///< system config filespec
                 bool root_auto_fail, ///< fail if system auto.p file not found                  bool root_config_fail_on_read_problem, ///< fail if system config file not found
                 const char *site_auto_path, ///< path to site auto.p file                  const char *site_config_filespec, ///< site config filespec
                 bool site_auto_fail, ///< fail if site auto.p file not found                  bool site_config_fail_on_read_problem, ///< fail if site config file not found
                 bool header_only);                  bool header_only);
   
         /// executes ops          /// executes ops
         void execute(const Array& ops);          void execute(const Array& ops); // execute.C
   
         /// compiles the file, maybe forcing it's class @a name and @a base_class.          /// compiles the file, maybe forcing it's class @a name and @a base_class.
         VStateless_class *use_file(          VStateless_class *use_file(
                 const String& file_spec, bool fail_on_read_problem=true,                  const String& file_name, 
                   bool ignore_class_path=false, bool fail_on_read_problem=true,
                 const String *name=0,                   const String *name=0, 
                 VStateless_class *base_class=0); // core.C                  VStateless_class *base_class=0); // core.C
         /// compiles a @a source buffer          /// compiles a @a source buffer
Line 128  public: Line 132  public:
                 wcontext->write(avalue);                   wcontext->write(avalue); 
         }          }
   
         /// handy is-value-a-junction ensurer  
         void fail_if_junction_(bool is, Value& value,   
                 const String& method_name, const char *msg);  
   
         /// returns relative to @a path  path to @a file           /// returns relative to @a path  path to @a file 
         const String& relative(const char *apath, const String& relative_name);          const String& relative(const char *apath, const String& relative_name);
   
         /// returns an absolute @a path to relative @a name          /// returns an absolute @a path to relative @a name
         const String& absolute(const String& relative_name);          const String& absolute(const String& relative_name);
   
           /// returns the mime type of 'user_file_name_cstr'
           const String& mime_type_of(const char *user_file_name_cstr);
   
 public:  public:
                   
         /// info from web server          /// info from web server
         Info& info;          Info& info;
           /// user's post data
           char *post_data;  size_t post_size;
   
         /// operators are methods of this class          /// operators are methods of this class
         VClass OP;          Methoded& OP;
         /// $env:fields here          /// $env:fields
         VEnv env;          VEnv env;
         /// $form:elements here          /// $form:elements
         VForm form;          VForm form;
         /// $request:elements here          /// $math:constants
           VMath math;
           /// $request:elements
         VRequest request;          VRequest request;
         /// $response:          /// $response:elements
         VResponse response;          VResponse response;
         /// $cookie:          /// $cookie:elements
         VCookie cookie;          VCookie cookie;
   
         /// $MAIN:MIME-TYPES  
         Table *mime_types;  
   
         /// contexts          /// contexts
         Value *self, *root, *rcontext;          Value *self, *root, *rcontext;
         /// contexts          /// contexts
         WContext *wcontext;          WContext *wcontext;
   
           /// 'MAIN' class conglomerat
           VStateless_class *main_class;
   
         /// connection          /// connection
         SQL_Connection *connection;          SQL_Connection *connection;
         /// table of protocol's libraries. read from $SQL:drivers          /// PCRE character tables
         Table *protocol2library;          unsigned char *pcre_tables;
   
           /// classes configured data
           Hash classes_conf;
   
   
 private: // core data  private: // core data
   
         // classes          /// classes
         Hash fclasses;          Hash fclasses;
   
         // already used files to avoid cyclic uses          /// already used files to avoid cyclic uses
         Hash used_files;          Hash used_files;
   
         // execution stack          /// execution stack
         Stack stack;          Stack stack;
   
           /**     endless execute(execute(... preventing counter 
                   @see ANTI_ENDLESS_EXECUTE_RECOURSION
           */
           uint anti_endless_execute_recoursion;
   
 private: // compile.C  private: // compile.C
   
         VStateless_class& real_compile(COMPILE_PARAMS);          VStateless_class& real_compile(COMPILE_PARAMS);
   
 private: // execute.C  private: // execute.C
   
         const String *execute_method(Value& aself, const Method& method,           const String *execute_method(Value& aself, 
                 bool return_cstr=true);                  const Method& method, bool return_cstr=true);
         const String *execute_method(Value& aself, const String& method_name,           const String *execute_virtual_method(Value& aself, 
                 bool return_cstr=true);                  const String& method_name, bool return_cstr=true);
           const String *execute_nonvirtual_method(VStateless_class& aclass, 
                   const String& method_name, bool return_cstr=true);
   
         Value *get_element();          Value *get_element();
   
Line 202  private: // defaults Line 220  private: // defaults
         const String::Untaint_lang fdefault_lang;          const String::Untaint_lang fdefault_lang;
         Value *default_content_type;          Value *default_content_type;
   
   private: // mime types
   
           /// $MAIN:MIME-TYPES
           Table *mime_types;
   
 private: // lang manipulation  private: // lang manipulation
   
         String::Untaint_lang set_lang(String::Untaint_lang alang) {          String::Untaint_lang set_lang(String::Untaint_lang alang) {
Line 232  public: Line 255  public:
         }          }
 };  };
   
   /**
           @b method parameters passed in this array.
           contains handy typecast ad junction/not junction ensurers
   
   */
   class MethodParams : public Array {
   public:
           MethodParams(Pool& pool, const String& amethod_name) : Array(pool),
                   fmethod_name(amethod_name) {
           }
   
           /// handy typecast. I long for templates
           Value& get(int index) { 
                   return *static_cast<Value *>(Array::get(index)); 
           }
           /// handy is-value-a-junction ensurer
           Value& as_junction(int index, const char *msg) { 
                   return get_as(index, true, msg); 
           }
           /// handy value-is-not-a-junction ensurer
           Value& as_no_junction(int index, const char *msg) { 
                   return get_as(index, false, msg); 
           }
           /// handy expression auto-processing to double
           double as_double(int index, Request& r) { 
                   return get_processed(index, r).as_double(); 
           }
           /// handy expression auto-processing to int
           int as_int(int index, Request& r) { 
                   return get_processed(index, r).as_int(); 
           }
           /// handy string ensurer
           const String& as_string(int index, const char *msg) { 
                   return as_no_junction(index, msg).as_string(); 
           }
   
   private:
   
           /// handy value-is/not-a-junction ensurer
           Value& get_as(int index, bool as_junction, const char *msg) { 
                   Value& result=get(index);
                   if((result.get_junction()!=0) ^ as_junction)
                           THROW(0, 0,
                                   &fmethod_name,
                                   "%s (parameter #%d)", msg, 1+index);
                   return result;
           }
   
           Value& get_processed(int index, Request& r) {
                   return r.process(get(index),
                           0/*no name*/,
                           false/*don't intercept string*/);
           }
   
   private:
   
           const String& fmethod_name;
   
   };
   
 #endif  #endif

Removed from v.1.78  
changed lines
  Added in v.1.97


E-mail: