ChipMaster's trial hacks on C++CMS starting with v1.2.1. Not sure I'll follow on with the v2 since it looks to be breaking and mostly frivolous.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

104 lines
2.1 KiB

  1. #ifndef _WORKER_THREAD_H_
  2. #define _WORKER_THREAD_H_
  3. #include <pthread.h>
  4. #include <sstream>
  5. #include <string>
  6. #include <cgicc/Cgicc.h>
  7. #include <cgicc/HTTPHTMLHeader.h>
  8. #include <cgicc/HTTPStatusHeader.h>
  9. #include <cgicc/HTMLClasses.h>
  10. #include "noncopyable.h"
  11. #include <memory>
  12. #include "signal0.h"
  13. #include "cppcms_error.h"
  14. #include "url_dispatcher.h"
  15. #include "cache_interface.h"
  16. #include "base_cache.h"
  17. #include "cgicc_connection.h"
  18. #include "transtext.h"
  19. #include "session_interface.h"
  20. namespace cppcms {
  21. class manager;
  22. class base_content;
  23. using namespace std;
  24. using cgicc::CgiEnvironment;
  25. using cgicc::Cgicc;
  26. using cgicc::HTTPHeader;
  27. class worker_thread: private util::noncopyable {
  28. int id;
  29. pthread_t pid;
  30. friend class cache_iface;
  31. friend class base_view;
  32. list<string> other_headers;
  33. base_cache *caching_module;
  34. bool user_io;
  35. bool gzip;
  36. bool gzip_done;
  37. stringbuf out_buf;
  38. transtext::trans const *gt;
  39. string lang;
  40. auto_ptr<HTTPHeader> response_header;
  41. string current_template;
  42. public:
  43. url_dispatcher url;
  44. manager const &app;
  45. Cgicc *cgi;
  46. CgiEnvironment const *env;
  47. cgicc_connection *cgi_conn;
  48. cache_iface cache;
  49. ostream cout;
  50. util::signal0 on_start;
  51. util::signal0 on_end;
  52. session_interface session;
  53. void set_header(HTTPHeader *h);
  54. void add_header(string s);
  55. void set_cookie(cgicc::HTTPCookie const &c);
  56. void set_user_io();
  57. void no_gzip();
  58. HTTPHeader &header();
  59. void set_lang();
  60. void set_lang(string const &s);
  61. inline void use_template(string s="") { current_template=s; };
  62. void render(string name,base_content &content);
  63. void render(string templ,string name,base_content &content);
  64. void render(string name,base_content &content,ostream &);
  65. void render(string templ,string name,base_content &content,ostream &);
  66. virtual void main();
  67. inline char const *gettext(char const *s) { return gt->gettext(s); };
  68. inline char const *ngettext(char const *s,char const *p,int n) { return gt->ngettext(s,p,n); };
  69. ostream &get_cout() { return cout; }
  70. transtext::trans const *domain_gettext(string const &domain);
  71. void run(cgicc_connection &);
  72. worker_thread(manager const &s);
  73. virtual ~worker_thread();
  74. };
  75. }
  76. #endif