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=70eeeda85eb67d546066854051f2f921fadcca18$
13 //
14
15 #include "libcef_dll/ctocpp/print_settings_ctocpp.h"
16 #include <algorithm>
17 #include "libcef_dll/shutdown_checker.h"
18
19 // STATIC METHODS - Body may be edited by hand.
20
21 NO_SANITIZE("cfi-icall")
Create()22 CefRefPtr<CefPrintSettings> CefPrintSettings::Create() {
23 shutdown_checker::AssertNotShutdown();
24
25 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26
27 // Execute
28 cef_print_settings_t* _retval = cef_print_settings_create();
29
30 // Return type: refptr_same
31 return CefPrintSettingsCToCpp::Wrap(_retval);
32 }
33
34 // VIRTUAL METHODS - Body may be edited by hand.
35
IsValid()36 NO_SANITIZE("cfi-icall") bool CefPrintSettingsCToCpp::IsValid() {
37 shutdown_checker::AssertNotShutdown();
38
39 cef_print_settings_t* _struct = GetStruct();
40 if (CEF_MEMBER_MISSING(_struct, is_valid))
41 return false;
42
43 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
44
45 // Execute
46 int _retval = _struct->is_valid(_struct);
47
48 // Return type: bool
49 return _retval ? true : false;
50 }
51
IsReadOnly()52 NO_SANITIZE("cfi-icall") bool CefPrintSettingsCToCpp::IsReadOnly() {
53 shutdown_checker::AssertNotShutdown();
54
55 cef_print_settings_t* _struct = GetStruct();
56 if (CEF_MEMBER_MISSING(_struct, is_read_only))
57 return false;
58
59 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
60
61 // Execute
62 int _retval = _struct->is_read_only(_struct);
63
64 // Return type: bool
65 return _retval ? true : false;
66 }
67
68 NO_SANITIZE("cfi-icall")
SetOrientation(bool landscape)69 void CefPrintSettingsCToCpp::SetOrientation(bool landscape) {
70 shutdown_checker::AssertNotShutdown();
71
72 cef_print_settings_t* _struct = GetStruct();
73 if (CEF_MEMBER_MISSING(_struct, set_orientation))
74 return;
75
76 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
77
78 // Execute
79 _struct->set_orientation(_struct, landscape);
80 }
81
IsLandscape()82 NO_SANITIZE("cfi-icall") bool CefPrintSettingsCToCpp::IsLandscape() {
83 shutdown_checker::AssertNotShutdown();
84
85 cef_print_settings_t* _struct = GetStruct();
86 if (CEF_MEMBER_MISSING(_struct, is_landscape))
87 return false;
88
89 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
90
91 // Execute
92 int _retval = _struct->is_landscape(_struct);
93
94 // Return type: bool
95 return _retval ? true : false;
96 }
97
98 NO_SANITIZE("cfi-icall")
SetPrinterPrintableArea(const CefSize & physical_size_device_units,const CefRect & printable_area_device_units,bool landscape_needs_flip)99 void CefPrintSettingsCToCpp::SetPrinterPrintableArea(
100 const CefSize& physical_size_device_units,
101 const CefRect& printable_area_device_units,
102 bool landscape_needs_flip) {
103 shutdown_checker::AssertNotShutdown();
104
105 cef_print_settings_t* _struct = GetStruct();
106 if (CEF_MEMBER_MISSING(_struct, set_printer_printable_area))
107 return;
108
109 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
110
111 // Execute
112 _struct->set_printer_printable_area(_struct, &physical_size_device_units,
113 &printable_area_device_units,
114 landscape_needs_flip);
115 }
116
117 NO_SANITIZE("cfi-icall")
SetDeviceName(const CefString & name)118 void CefPrintSettingsCToCpp::SetDeviceName(const CefString& name) {
119 shutdown_checker::AssertNotShutdown();
120
121 cef_print_settings_t* _struct = GetStruct();
122 if (CEF_MEMBER_MISSING(_struct, set_device_name))
123 return;
124
125 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
126
127 // Unverified params: name
128
129 // Execute
130 _struct->set_device_name(_struct, name.GetStruct());
131 }
132
GetDeviceName()133 NO_SANITIZE("cfi-icall") CefString CefPrintSettingsCToCpp::GetDeviceName() {
134 shutdown_checker::AssertNotShutdown();
135
136 cef_print_settings_t* _struct = GetStruct();
137 if (CEF_MEMBER_MISSING(_struct, get_device_name))
138 return CefString();
139
140 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
141
142 // Execute
143 cef_string_userfree_t _retval = _struct->get_device_name(_struct);
144
145 // Return type: string
146 CefString _retvalStr;
147 _retvalStr.AttachToUserFree(_retval);
148 return _retvalStr;
149 }
150
SetDPI(int dpi)151 NO_SANITIZE("cfi-icall") void CefPrintSettingsCToCpp::SetDPI(int dpi) {
152 shutdown_checker::AssertNotShutdown();
153
154 cef_print_settings_t* _struct = GetStruct();
155 if (CEF_MEMBER_MISSING(_struct, set_dpi))
156 return;
157
158 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
159
160 // Execute
161 _struct->set_dpi(_struct, dpi);
162 }
163
GetDPI()164 NO_SANITIZE("cfi-icall") int CefPrintSettingsCToCpp::GetDPI() {
165 shutdown_checker::AssertNotShutdown();
166
167 cef_print_settings_t* _struct = GetStruct();
168 if (CEF_MEMBER_MISSING(_struct, get_dpi))
169 return 0;
170
171 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
172
173 // Execute
174 int _retval = _struct->get_dpi(_struct);
175
176 // Return type: simple
177 return _retval;
178 }
179
180 NO_SANITIZE("cfi-icall")
SetPageRanges(const PageRangeList & ranges)181 void CefPrintSettingsCToCpp::SetPageRanges(const PageRangeList& ranges) {
182 shutdown_checker::AssertNotShutdown();
183
184 cef_print_settings_t* _struct = GetStruct();
185 if (CEF_MEMBER_MISSING(_struct, set_page_ranges))
186 return;
187
188 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
189
190 // Translate param: ranges; type: simple_vec_byref_const
191 const size_t rangesCount = ranges.size();
192 cef_range_t* rangesList = NULL;
193 if (rangesCount > 0) {
194 rangesList = new cef_range_t[rangesCount];
195 DCHECK(rangesList);
196 if (rangesList) {
197 for (size_t i = 0; i < rangesCount; ++i) {
198 rangesList[i] = ranges[i];
199 }
200 }
201 }
202
203 // Execute
204 _struct->set_page_ranges(_struct, rangesCount, rangesList);
205
206 // Restore param:ranges; type: simple_vec_byref_const
207 if (rangesList)
208 delete[] rangesList;
209 }
210
GetPageRangesCount()211 NO_SANITIZE("cfi-icall") size_t CefPrintSettingsCToCpp::GetPageRangesCount() {
212 shutdown_checker::AssertNotShutdown();
213
214 cef_print_settings_t* _struct = GetStruct();
215 if (CEF_MEMBER_MISSING(_struct, get_page_ranges_count))
216 return 0;
217
218 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
219
220 // Execute
221 size_t _retval = _struct->get_page_ranges_count(_struct);
222
223 // Return type: simple
224 return _retval;
225 }
226
227 NO_SANITIZE("cfi-icall")
GetPageRanges(PageRangeList & ranges)228 void CefPrintSettingsCToCpp::GetPageRanges(PageRangeList& ranges) {
229 shutdown_checker::AssertNotShutdown();
230
231 cef_print_settings_t* _struct = GetStruct();
232 if (CEF_MEMBER_MISSING(_struct, get_page_ranges))
233 return;
234
235 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
236
237 // Translate param: ranges; type: simple_vec_byref
238 size_t rangesSize = ranges.size();
239 size_t rangesCount = std::max(GetPageRangesCount(), rangesSize);
240 cef_range_t* rangesList = NULL;
241 if (rangesCount > 0) {
242 rangesList = new cef_range_t[rangesCount];
243 DCHECK(rangesList);
244 if (rangesList) {
245 memset(rangesList, 0, sizeof(cef_range_t) * rangesCount);
246 }
247 if (rangesList && rangesSize > 0) {
248 for (size_t i = 0; i < rangesSize; ++i) {
249 rangesList[i] = ranges[i];
250 }
251 }
252 }
253
254 // Execute
255 _struct->get_page_ranges(_struct, &rangesCount, rangesList);
256
257 // Restore param:ranges; type: simple_vec_byref
258 ranges.clear();
259 if (rangesCount > 0 && rangesList) {
260 for (size_t i = 0; i < rangesCount; ++i) {
261 ranges.push_back(rangesList[i]);
262 }
263 delete[] rangesList;
264 }
265 }
266
267 NO_SANITIZE("cfi-icall")
SetSelectionOnly(bool selection_only)268 void CefPrintSettingsCToCpp::SetSelectionOnly(bool selection_only) {
269 shutdown_checker::AssertNotShutdown();
270
271 cef_print_settings_t* _struct = GetStruct();
272 if (CEF_MEMBER_MISSING(_struct, set_selection_only))
273 return;
274
275 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
276
277 // Execute
278 _struct->set_selection_only(_struct, selection_only);
279 }
280
IsSelectionOnly()281 NO_SANITIZE("cfi-icall") bool CefPrintSettingsCToCpp::IsSelectionOnly() {
282 shutdown_checker::AssertNotShutdown();
283
284 cef_print_settings_t* _struct = GetStruct();
285 if (CEF_MEMBER_MISSING(_struct, is_selection_only))
286 return false;
287
288 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
289
290 // Execute
291 int _retval = _struct->is_selection_only(_struct);
292
293 // Return type: bool
294 return _retval ? true : false;
295 }
296
SetCollate(bool collate)297 NO_SANITIZE("cfi-icall") void CefPrintSettingsCToCpp::SetCollate(bool collate) {
298 shutdown_checker::AssertNotShutdown();
299
300 cef_print_settings_t* _struct = GetStruct();
301 if (CEF_MEMBER_MISSING(_struct, set_collate))
302 return;
303
304 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
305
306 // Execute
307 _struct->set_collate(_struct, collate);
308 }
309
WillCollate()310 NO_SANITIZE("cfi-icall") bool CefPrintSettingsCToCpp::WillCollate() {
311 shutdown_checker::AssertNotShutdown();
312
313 cef_print_settings_t* _struct = GetStruct();
314 if (CEF_MEMBER_MISSING(_struct, will_collate))
315 return false;
316
317 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
318
319 // Execute
320 int _retval = _struct->will_collate(_struct);
321
322 // Return type: bool
323 return _retval ? true : false;
324 }
325
326 NO_SANITIZE("cfi-icall")
SetColorModel(ColorModel model)327 void CefPrintSettingsCToCpp::SetColorModel(ColorModel model) {
328 shutdown_checker::AssertNotShutdown();
329
330 cef_print_settings_t* _struct = GetStruct();
331 if (CEF_MEMBER_MISSING(_struct, set_color_model))
332 return;
333
334 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
335
336 // Execute
337 _struct->set_color_model(_struct, model);
338 }
339
340 NO_SANITIZE("cfi-icall")
GetColorModel()341 CefPrintSettings::ColorModel CefPrintSettingsCToCpp::GetColorModel() {
342 shutdown_checker::AssertNotShutdown();
343
344 cef_print_settings_t* _struct = GetStruct();
345 if (CEF_MEMBER_MISSING(_struct, get_color_model))
346 return COLOR_MODEL_UNKNOWN;
347
348 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
349
350 // Execute
351 cef_color_model_t _retval = _struct->get_color_model(_struct);
352
353 // Return type: simple
354 return _retval;
355 }
356
SetCopies(int copies)357 NO_SANITIZE("cfi-icall") void CefPrintSettingsCToCpp::SetCopies(int copies) {
358 shutdown_checker::AssertNotShutdown();
359
360 cef_print_settings_t* _struct = GetStruct();
361 if (CEF_MEMBER_MISSING(_struct, set_copies))
362 return;
363
364 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
365
366 // Execute
367 _struct->set_copies(_struct, copies);
368 }
369
GetCopies()370 NO_SANITIZE("cfi-icall") int CefPrintSettingsCToCpp::GetCopies() {
371 shutdown_checker::AssertNotShutdown();
372
373 cef_print_settings_t* _struct = GetStruct();
374 if (CEF_MEMBER_MISSING(_struct, get_copies))
375 return 0;
376
377 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
378
379 // Execute
380 int _retval = _struct->get_copies(_struct);
381
382 // Return type: simple
383 return _retval;
384 }
385
386 NO_SANITIZE("cfi-icall")
SetDuplexMode(DuplexMode mode)387 void CefPrintSettingsCToCpp::SetDuplexMode(DuplexMode mode) {
388 shutdown_checker::AssertNotShutdown();
389
390 cef_print_settings_t* _struct = GetStruct();
391 if (CEF_MEMBER_MISSING(_struct, set_duplex_mode))
392 return;
393
394 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
395
396 // Execute
397 _struct->set_duplex_mode(_struct, mode);
398 }
399
400 NO_SANITIZE("cfi-icall")
GetDuplexMode()401 CefPrintSettings::DuplexMode CefPrintSettingsCToCpp::GetDuplexMode() {
402 shutdown_checker::AssertNotShutdown();
403
404 cef_print_settings_t* _struct = GetStruct();
405 if (CEF_MEMBER_MISSING(_struct, get_duplex_mode))
406 return DUPLEX_MODE_UNKNOWN;
407
408 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
409
410 // Execute
411 cef_duplex_mode_t _retval = _struct->get_duplex_mode(_struct);
412
413 // Return type: simple
414 return _retval;
415 }
416
417 // CONSTRUCTOR - Do not edit by hand.
418
CefPrintSettingsCToCpp()419 CefPrintSettingsCToCpp::CefPrintSettingsCToCpp() {}
420
421 // DESTRUCTOR - Do not edit by hand.
422
~CefPrintSettingsCToCpp()423 CefPrintSettingsCToCpp::~CefPrintSettingsCToCpp() {
424 shutdown_checker::AssertNotShutdown();
425 }
426
427 template <>
428 cef_print_settings_t*
429 CefCToCppRefCounted<CefPrintSettingsCToCpp,
430 CefPrintSettings,
UnwrapDerived(CefWrapperType type,CefPrintSettings * c)431 cef_print_settings_t>::UnwrapDerived(CefWrapperType type,
432 CefPrintSettings* c) {
433 NOTREACHED() << "Unexpected class type: " << type;
434 return nullptr;
435 }
436
437 template <>
438 CefWrapperType CefCToCppRefCounted<CefPrintSettingsCToCpp,
439 CefPrintSettings,
440 cef_print_settings_t>::kWrapperType =
441 WT_PRINT_SETTINGS;
442