|
|
| version 1.213, 2013/09/30 19:40:57 | version 1.221, 2015/10/26 01:21:56 |
|---|---|
| Line 1 | Line 1 |
| /** @file | /** @file |
| Parser: request class decl. | Parser: request class decl. |
| Copyright (c) 2001-2012 Art. Lebedev Studio (http://www.artlebedev.com) | Copyright (c) 2001-2015 Art. Lebedev Studio (http://www.artlebedev.com) |
| Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) | Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) |
| */ | */ |
| Line 18 | Line 18 |
| #include "pa_request_info.h" | #include "pa_request_info.h" |
| #include "pa_request_charsets.h" | #include "pa_request_charsets.h" |
| #include "pa_sapi.h" | #include "pa_sapi.h" |
| #include "pa_vconsole.h" | |
| // consts | // consts |
| Line 35 class VForm; | Line 34 class VForm; |
| class VResponse; | class VResponse; |
| class VCookie; | class VCookie; |
| class VStateless_class; | class VStateless_class; |
| class VConsole; | |
| /// Main workhorse. | /// Main workhorse. |
| class Request: public PA_Object { | class Request: public PA_Object { |
| friend class Temp_lang; | friend class Temp_lang; |
| friend class Temp_connection; | friend class Temp_connection; |
| friend class Request_context_saver; | |
| friend class Temp_request_self; | friend class Temp_request_self; |
| friend class Temp_value_element; | |
| friend class Request_context_saver; | |
| friend class Exception_trace; | friend class Exception_trace; |
| public: | public: |
| Line 51 public: | Line 52 public: |
| public: | public: |
| Trace(): fname(0) {} | Trace(): fname(0) {} |
| void clear() { fname=0; } | void clear() { fname=0; } |
| operator bool() const { return fname!=0; } | |
| Trace(const String* aname, const Operation::Origin aorigin): | Trace(const String* aname, const Operation::Origin aorigin): |
| fname(aname), forigin(aorigin) {} | fname(aname), forigin(aorigin) {} |
| Line 107 private: | Line 107 private: |
| bool is_empty() { | bool is_empty() { |
| return fused==fbottom; | return fused==fbottom; |
| } | } |
| const element_type extract_origin(const String*& problem_source); | |
| }; | }; |
| ///@{ core data | ///@{ core data |
| Line 157 public: | Line 155 public: |
| uint register_file(String::Body file_spec); | uint register_file(String::Body file_spec); |
| struct Exception_details { | struct Exception_details { |
| const Trace trace; | const Operation::Origin origin; |
| const String* problem_source; | const String* problem_source; |
| VHash& vhash; | VHash& vhash; |
| Exception_details(const Operation::Origin aorigin, const String* aproblem_source, VHash& avhash): origin(aorigin), problem_source(aproblem_source), vhash(avhash) {} | |
| Exception_details( | |
| const Trace atrace, | |
| const String* aproblem_source, | |
| VHash& avhash): trace(atrace), problem_source(aproblem_source), vhash(avhash) {} | |
| }; | }; |
| Exception_details get_details(const Exception& e); | Exception_details get_details(const Exception& e); |
| const char* get_exception_cstr(const Exception& e, Exception_details& details); | const char* get_exception_cstr(const Exception& e, Exception_details& details); |
| Line 225 public: | Line 219 public: |
| bool fail_on_file_absence=true); | bool fail_on_file_absence=true); |
| /// 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. |
| void use_file(VStateless_class& aclass, | void use_file(VStateless_class& aclass, const String& file_name, const String* use_filespec); |
| const String& file_name, | void use_file(VStateless_class& aclass, const String& file_name, const String* use_filespec, Operation::Origin origin); |
| const String* use_filespec); | |
| /// compiles a @a source buffer | /// compiles a @a source buffer |
| void use_buf(VStateless_class& aclass, | void use_buf(VStateless_class& aclass, |
| Line 262 public: | Line 255 public: |
| /// appending, sure of clean string inside | /// appending, sure of clean string inside |
| void write_no_lang(const String& astring) { | void write_no_lang(const String& astring) { |
| wcontext->write(astring, | wcontext->write(astring, |
| (String::Language)(String::L_CLEAN | flang&String::L_OPTIMIZE_BIT)); | (String::Language)(String::L_CLEAN | (flang & String::L_OPTIMIZE_BIT) )); |
| } | } |
| /// appending sure value, that would be converted to clean string | /// appending sure value, that would be converted to clean string |
| void write_no_lang(Value& avalue) { | void write_no_lang(Value& avalue) { |
| Line 270 public: | Line 263 public: |
| wcontext->write(avalue); | wcontext->write(avalue); |
| else | else |
| wcontext->write(avalue, | wcontext->write(avalue, |
| (String::Language)(String::L_CLEAN | flang&String::L_OPTIMIZE_BIT)); | (String::Language)(String::L_CLEAN | (flang & String::L_OPTIMIZE_BIT) )); |
| } | } |
| /// appending string, passing language built into string being written | /// appending string, passing language built into string being written |
| Line 420 private: // compile.C | Line 413 private: // compile.C |
| private: // execute.C | private: // execute.C |
| Value& get_element(Value& ncontext, const String& name); | Value& get_element(Value& ncontext, const String& name); |
| #ifdef FEATURE_GET_ELEMENT4CALL | |
| Value& get_element4call(Value& ncontext, const String& name); | |
| #endif | |
| private: // defaults | private: // defaults |
| Line 551 public: | Line 547 public: |
| } | } |
| }; | }; |
| /// Auto-object used for temporarily substituting/removing elements | |
| class Temp_value_element { | |
| Request& frequest; | |
| Value& fwhere; | |
| const String& fname; | |
| Value* saved; | |
| public: | |
| Temp_value_element(Request& arequest, Value& awhere, const String& aname, Value* awhat); | |
| ~Temp_value_element(); | |
| }; | |
| // defines for externs | // defines for externs |
| #define EXCEPTION_HANDLED_PART_NAME "handled" | #define EXCEPTION_HANDLED_PART_NAME "handled" |
| Line 560 public: | Line 567 public: |
| extern const String main_method_name; | extern const String main_method_name; |
| extern const String auto_method_name; | extern const String auto_method_name; |
| extern const String body_name; | |
| extern const String exception_type_part_name; | extern const String exception_type_part_name; |
| extern const String exception_source_part_name; | extern const String exception_source_part_name; |