Repository navigation
Expand file tree
/
Copy pathworker_thread.h
More file actions
104 lines (77 loc) · 2.17 KB
/
Copy pathworker_thread.h
File metadata and controls
104 lines (77 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#ifndef _WORKER_THREAD_H_
#define _WORKER_THREAD_H_
#include <pthread.h>
#include <sstream>
#include <string>
#include <cgicc/Cgicc.h>
#include <cgicc/HTTPHTMLHeader.h>
#include <cgicc/HTTPStatusHeader.h>
#include <cgicc/HTMLClasses.h>
#include <boost/noncopyable.hpp>
#include <memory>
#include <boost/signal.hpp>
#include "cppcms_error.h"
#include "url.h"
#include "cache_interface.h"
#include "base_cache.h"
#include "cgicc_connection.h"
#include "transtext.h"
#include "session_interface.h"
namespace cppcms {
class manager;
class base_content;
using namespace std;
using cgicc::CgiEnvironment;
using cgicc::Cgicc;
using cgicc::HTTPHeader;
class worker_thread: private boost::noncopyable {
int id;
pthread_t pid;
friend class url_parser;
friend class cache_iface;
friend class base_view;
list<string> other_headers;
base_cache *caching_module;
bool user_io;
bool gzip;
bool gzip_done;
stringbuf out_buf;
transtext::trans const *gt;
string lang;
auto_ptr<HTTPHeader> response_header;
string current_template;
public:
url_parser url;
manager const &app;
Cgicc *cgi;
CgiEnvironment const *env;
cgicc_connection *cgi_conn;
cache_iface cache;
ostream cout;
boost::signal<void()> on_start;
boost::signal<void()> on_end;
session_interface session;
void set_header(HTTPHeader *h);
void add_header(string s);
void set_cookie(cgicc::HTTPCookie const &c);
void set_user_io();
void no_gzip();
HTTPHeader &header();
void set_lang();
void set_lang(string const &s);
inline void use_template(string s="") { current_template=s; };
void render(string name,base_content &content);
void render(string templ,string name,base_content &content);
void render(string name,base_content &content,ostream &);
void render(string templ,string name,base_content &content,ostream &);
virtual void main();
inline char const *gettext(char const *s) { return gt->gettext(s); };
inline char const *ngettext(char const *s,char const *p,int n) { return gt->ngettext(s,p,n); };
ostream &get_cout() { return cout; }
transtext::trans const *domain_gettext(string const &domain);
void run(cgicc_connection &);
worker_thread(manager const &s);
virtual ~worker_thread();
};
}
#endif