1 // Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
2 // reserved. Use of this source code is governed by a BSD-style license that
3 // can be found in the LICENSE file.
4 //
5 // ---------------------------------------------------------------------------
6 //
7 // This file was generated by the CEF translator tool. If making changes by
8 // hand only do so within the body of existing method and function
9 // implementations. See the translator.README.txt file in the tools directory
10 // for more information.
11 //
12 // $hash=1dc0f59d37e6979ba3f431463671f0feefc45c31$
13 //
14
15 #include "libcef_dll/cpptoc/response_cpptoc.h"
16 #include "libcef_dll/transfer_util.h"
17
18 // GLOBAL FUNCTIONS - Body may be edited by hand.
19
cef_response_create()20 CEF_EXPORT cef_response_t* cef_response_create() {
21 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
22
23 // Execute
24 CefRefPtr<CefResponse> _retval = CefResponse::Create();
25
26 // Return type: refptr_same
27 return CefResponseCppToC::Wrap(_retval);
28 }
29
30 namespace {
31
32 // MEMBER FUNCTIONS - Body may be edited by hand.
33
response_is_read_only(struct _cef_response_t * self)34 int CEF_CALLBACK response_is_read_only(struct _cef_response_t* self) {
35 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
36
37 DCHECK(self);
38 if (!self)
39 return 0;
40
41 // Execute
42 bool _retval = CefResponseCppToC::Get(self)->IsReadOnly();
43
44 // Return type: bool
45 return _retval;
46 }
47
response_get_error(struct _cef_response_t * self)48 cef_errorcode_t CEF_CALLBACK response_get_error(struct _cef_response_t* self) {
49 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
50
51 DCHECK(self);
52 if (!self)
53 return ERR_NONE;
54
55 // Execute
56 cef_errorcode_t _retval = CefResponseCppToC::Get(self)->GetError();
57
58 // Return type: simple
59 return _retval;
60 }
61
response_set_error(struct _cef_response_t * self,cef_errorcode_t error)62 void CEF_CALLBACK response_set_error(struct _cef_response_t* self,
63 cef_errorcode_t error) {
64 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
65
66 DCHECK(self);
67 if (!self)
68 return;
69
70 // Execute
71 CefResponseCppToC::Get(self)->SetError(error);
72 }
73
response_get_status(struct _cef_response_t * self)74 int CEF_CALLBACK response_get_status(struct _cef_response_t* self) {
75 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
76
77 DCHECK(self);
78 if (!self)
79 return 0;
80
81 // Execute
82 int _retval = CefResponseCppToC::Get(self)->GetStatus();
83
84 // Return type: simple
85 return _retval;
86 }
87
response_set_status(struct _cef_response_t * self,int status)88 void CEF_CALLBACK response_set_status(struct _cef_response_t* self,
89 int status) {
90 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
91
92 DCHECK(self);
93 if (!self)
94 return;
95
96 // Execute
97 CefResponseCppToC::Get(self)->SetStatus(status);
98 }
99
100 cef_string_userfree_t CEF_CALLBACK
response_get_status_text(struct _cef_response_t * self)101 response_get_status_text(struct _cef_response_t* self) {
102 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
103
104 DCHECK(self);
105 if (!self)
106 return NULL;
107
108 // Execute
109 CefString _retval = CefResponseCppToC::Get(self)->GetStatusText();
110
111 // Return type: string
112 return _retval.DetachToUserFree();
113 }
114
response_set_status_text(struct _cef_response_t * self,const cef_string_t * statusText)115 void CEF_CALLBACK response_set_status_text(struct _cef_response_t* self,
116 const cef_string_t* statusText) {
117 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
118
119 DCHECK(self);
120 if (!self)
121 return;
122 // Unverified params: statusText
123
124 // Execute
125 CefResponseCppToC::Get(self)->SetStatusText(CefString(statusText));
126 }
127
128 cef_string_userfree_t CEF_CALLBACK
response_get_mime_type(struct _cef_response_t * self)129 response_get_mime_type(struct _cef_response_t* self) {
130 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
131
132 DCHECK(self);
133 if (!self)
134 return NULL;
135
136 // Execute
137 CefString _retval = CefResponseCppToC::Get(self)->GetMimeType();
138
139 // Return type: string
140 return _retval.DetachToUserFree();
141 }
142
response_set_mime_type(struct _cef_response_t * self,const cef_string_t * mimeType)143 void CEF_CALLBACK response_set_mime_type(struct _cef_response_t* self,
144 const cef_string_t* mimeType) {
145 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
146
147 DCHECK(self);
148 if (!self)
149 return;
150 // Unverified params: mimeType
151
152 // Execute
153 CefResponseCppToC::Get(self)->SetMimeType(CefString(mimeType));
154 }
155
156 cef_string_userfree_t CEF_CALLBACK
response_get_charset(struct _cef_response_t * self)157 response_get_charset(struct _cef_response_t* self) {
158 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
159
160 DCHECK(self);
161 if (!self)
162 return NULL;
163
164 // Execute
165 CefString _retval = CefResponseCppToC::Get(self)->GetCharset();
166
167 // Return type: string
168 return _retval.DetachToUserFree();
169 }
170
response_set_charset(struct _cef_response_t * self,const cef_string_t * charset)171 void CEF_CALLBACK response_set_charset(struct _cef_response_t* self,
172 const cef_string_t* charset) {
173 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
174
175 DCHECK(self);
176 if (!self)
177 return;
178 // Unverified params: charset
179
180 // Execute
181 CefResponseCppToC::Get(self)->SetCharset(CefString(charset));
182 }
183
184 cef_string_userfree_t CEF_CALLBACK
response_get_header_by_name(struct _cef_response_t * self,const cef_string_t * name)185 response_get_header_by_name(struct _cef_response_t* self,
186 const cef_string_t* name) {
187 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
188
189 DCHECK(self);
190 if (!self)
191 return NULL;
192 // Verify param: name; type: string_byref_const
193 DCHECK(name);
194 if (!name)
195 return NULL;
196
197 // Execute
198 CefString _retval =
199 CefResponseCppToC::Get(self)->GetHeaderByName(CefString(name));
200
201 // Return type: string
202 return _retval.DetachToUserFree();
203 }
204
response_set_header_by_name(struct _cef_response_t * self,const cef_string_t * name,const cef_string_t * value,int overwrite)205 void CEF_CALLBACK response_set_header_by_name(struct _cef_response_t* self,
206 const cef_string_t* name,
207 const cef_string_t* value,
208 int overwrite) {
209 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
210
211 DCHECK(self);
212 if (!self)
213 return;
214 // Verify param: name; type: string_byref_const
215 DCHECK(name);
216 if (!name)
217 return;
218 // Unverified params: value
219
220 // Execute
221 CefResponseCppToC::Get(self)->SetHeaderByName(
222 CefString(name), CefString(value), overwrite ? true : false);
223 }
224
response_get_header_map(struct _cef_response_t * self,cef_string_multimap_t headerMap)225 void CEF_CALLBACK response_get_header_map(struct _cef_response_t* self,
226 cef_string_multimap_t headerMap) {
227 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
228
229 DCHECK(self);
230 if (!self)
231 return;
232 // Verify param: headerMap; type: string_map_multi_byref
233 DCHECK(headerMap);
234 if (!headerMap)
235 return;
236
237 // Translate param: headerMap; type: string_map_multi_byref
238 std::multimap<CefString, CefString> headerMapMultimap;
239 transfer_string_multimap_contents(headerMap, headerMapMultimap);
240
241 // Execute
242 CefResponseCppToC::Get(self)->GetHeaderMap(headerMapMultimap);
243
244 // Restore param: headerMap; type: string_map_multi_byref
245 cef_string_multimap_clear(headerMap);
246 transfer_string_multimap_contents(headerMapMultimap, headerMap);
247 }
248
response_set_header_map(struct _cef_response_t * self,cef_string_multimap_t headerMap)249 void CEF_CALLBACK response_set_header_map(struct _cef_response_t* self,
250 cef_string_multimap_t headerMap) {
251 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
252
253 DCHECK(self);
254 if (!self)
255 return;
256 // Verify param: headerMap; type: string_map_multi_byref_const
257 DCHECK(headerMap);
258 if (!headerMap)
259 return;
260
261 // Translate param: headerMap; type: string_map_multi_byref_const
262 std::multimap<CefString, CefString> headerMapMultimap;
263 transfer_string_multimap_contents(headerMap, headerMapMultimap);
264
265 // Execute
266 CefResponseCppToC::Get(self)->SetHeaderMap(headerMapMultimap);
267 }
268
269 cef_string_userfree_t CEF_CALLBACK
response_get_url(struct _cef_response_t * self)270 response_get_url(struct _cef_response_t* self) {
271 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
272
273 DCHECK(self);
274 if (!self)
275 return NULL;
276
277 // Execute
278 CefString _retval = CefResponseCppToC::Get(self)->GetURL();
279
280 // Return type: string
281 return _retval.DetachToUserFree();
282 }
283
response_set_url(struct _cef_response_t * self,const cef_string_t * url)284 void CEF_CALLBACK response_set_url(struct _cef_response_t* self,
285 const cef_string_t* url) {
286 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
287
288 DCHECK(self);
289 if (!self)
290 return;
291 // Unverified params: url
292
293 // Execute
294 CefResponseCppToC::Get(self)->SetURL(CefString(url));
295 }
296
297 } // namespace
298
299 // CONSTRUCTOR - Do not edit by hand.
300
CefResponseCppToC()301 CefResponseCppToC::CefResponseCppToC() {
302 GetStruct()->is_read_only = response_is_read_only;
303 GetStruct()->get_error = response_get_error;
304 GetStruct()->set_error = response_set_error;
305 GetStruct()->get_status = response_get_status;
306 GetStruct()->set_status = response_set_status;
307 GetStruct()->get_status_text = response_get_status_text;
308 GetStruct()->set_status_text = response_set_status_text;
309 GetStruct()->get_mime_type = response_get_mime_type;
310 GetStruct()->set_mime_type = response_set_mime_type;
311 GetStruct()->get_charset = response_get_charset;
312 GetStruct()->set_charset = response_set_charset;
313 GetStruct()->get_header_by_name = response_get_header_by_name;
314 GetStruct()->set_header_by_name = response_set_header_by_name;
315 GetStruct()->get_header_map = response_get_header_map;
316 GetStruct()->set_header_map = response_set_header_map;
317 GetStruct()->get_url = response_get_url;
318 GetStruct()->set_url = response_set_url;
319 }
320
321 // DESTRUCTOR - Do not edit by hand.
322
~CefResponseCppToC()323 CefResponseCppToC::~CefResponseCppToC() {}
324
325 template <>
326 CefRefPtr<CefResponse>
327 CefCppToCRefCounted<CefResponseCppToC, CefResponse, cef_response_t>::
UnwrapDerived(CefWrapperType type,cef_response_t * s)328 UnwrapDerived(CefWrapperType type, cef_response_t* s) {
329 NOTREACHED() << "Unexpected class type: " << type;
330 return nullptr;
331 }
332
333 template <>
334 CefWrapperType CefCppToCRefCounted<CefResponseCppToC,
335 CefResponse,
336 cef_response_t>::kWrapperType = WT_RESPONSE;
337