1 /*
2 * The Sciter Engine of Terra Informatica Software, Inc.
3 * http://sciter.com
4 *
5 * The code and information provided "as-is" without
6 * warranty of any kind, either expressed or implied.
7 *
8 * (C) Terra Informatica Software, Inc.
9 */
10
11 /*
12 * Sciter's get resource request object - represents requests made by Element/View.request() functions.
13 *
14 *
15 * C++ wrapper
16 */
17
18
19 #ifndef __sciter_request_hpp__
20 #define __sciter_request_hpp__
21
24
25 #if defined(__cplusplus) && !defined( PLAIN_API_ONLY )
26
28
30 {
31
33 {
36 }
37 inline VOID SC_CALLBACK _LPCSTR2STRING( LPCSTR str, UINT
str_length, LPVOID param )
38 {
41 }
42
43
44 /* struct writer
45 {
46 virtual bool write( aux::bytes data ) = 0; // redefine to do actual writing of data.start/data.length
47 static BOOL SCAPI image_write_function(LPVOID prm, const BYTE* data, UINT data_length)
48 {
49 writer* pw = (writer* )prm;
50 return pw->write( aux::bytes(data,data_length) );
51 }
52 }; */
53
54 class request
55 {
56 protected:
58
59 request(): hrq(0) { ; }
60
61 public:
62
64 request(
const request& im): hrq(im.hrq) {
if(hrq)
rapi()->
RequestUse(hrq); }
65 request& operator = (const request& im)
66 {
69 return *this;
70 }
71
72 bool is_valid() const { return hrq != 0; }
73
74 ~request() {
76 }
77
81 return rv;
82 }
83
87 return rv;
88 }
89
93 return rv;
94 }
95
96 void succeeded( UINT status,
LPCBYTE dataOrNull = NULL, UINT dataLength = 0 )
97 {
99 }
100
101 void failed( UINT status,
LPCBYTE dataOrNull = NULL, UINT dataLength = 0 )
102 {
104 }
105
106 void append_data(
LPCBYTE data, UINT dataLength)
107 {
109 }
110
111 };
112
113 }
114
115 #endif //defined(__cplusplus) && !defined( PLAIN_API_ONLY )
116
117
118 #endif
119
REQUEST_RESULT SCFN() RequestGetRequestedDataType(HREQUEST rq, SciterResourceType *pData)
REQUEST_RESULT SCFN() RequestUrl(HREQUEST rq, LPCSTR_RECEIVER *rcv, LPVOID rcv_param)
REQUEST_RESULT SCFN() RequestUse(HREQUEST rq)
size_t str_length(const TC *src)
REQUEST_RESULT SCFN() RequestSetSucceeded(HREQUEST rq, UINT status, LPCBYTE dataOrNull, UINT dataLength)
std::basic_string< char > astring
REQUEST_RESULT SCFN() RequestSetFailed(HREQUEST rq, UINT status, LPCBYTE dataOrNull, UINT dataLength)
REQUEST_RESULT SCFN() RequestUnUse(HREQUEST rq)
REQUEST_RESULT SCFN() RequestContentUrl(HREQUEST rq, LPCSTR_RECEIVER *rcv, LPVOID rcv_param)
VOID SC_CALLBACK _LPCWSTR2STRING(LPCWSTR str, UINT str_length, LPVOID param)
LPSciterRequestAPI rapi()
REQUEST_RESULT SCFN() RequestAppendDataChunk(HREQUEST rq, LPCBYTE data, UINT dataLength)
std::basic_string< WCHAR > string