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=cc3c62b07c8e4d6f019637a0338673ac21ffa017$
13 //
14
15 #include "libcef_dll/ctocpp/command_line_ctocpp.h"
16 #include "include/cef_api_hash.h"
17 #include "libcef_dll/transfer_util.h"
18
19 // STATIC METHODS - Body may be edited by hand.
20
21 NO_SANITIZE("cfi-icall")
CreateCommandLine()22 CefRefPtr<CefCommandLine> CefCommandLine::CreateCommandLine() {
23 const char* api_hash = cef_api_hash(0);
24 if (strcmp(api_hash, CEF_API_HASH_PLATFORM)) {
25 // The libcef API hash does not match the current header API hash.
26 NOTREACHED();
27 return nullptr;
28 }
29
30 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31
32 // Execute
33 cef_command_line_t* _retval = cef_command_line_create();
34
35 // Return type: refptr_same
36 return CefCommandLineCToCpp::Wrap(_retval);
37 }
38
39 NO_SANITIZE("cfi-icall")
GetGlobalCommandLine()40 CefRefPtr<CefCommandLine> CefCommandLine::GetGlobalCommandLine() {
41 const char* api_hash = cef_api_hash(0);
42 if (strcmp(api_hash, CEF_API_HASH_PLATFORM)) {
43 // The libcef API hash does not match the current header API hash.
44 NOTREACHED();
45 return nullptr;
46 }
47
48 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
49
50 // Execute
51 cef_command_line_t* _retval = cef_command_line_get_global();
52
53 // Return type: refptr_same
54 return CefCommandLineCToCpp::Wrap(_retval);
55 }
56
57 // VIRTUAL METHODS - Body may be edited by hand.
58
IsValid()59 NO_SANITIZE("cfi-icall") bool CefCommandLineCToCpp::IsValid() {
60 cef_command_line_t* _struct = GetStruct();
61 if (CEF_MEMBER_MISSING(_struct, is_valid))
62 return false;
63
64 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
65
66 // Execute
67 int _retval = _struct->is_valid(_struct);
68
69 // Return type: bool
70 return _retval ? true : false;
71 }
72
IsReadOnly()73 NO_SANITIZE("cfi-icall") bool CefCommandLineCToCpp::IsReadOnly() {
74 cef_command_line_t* _struct = GetStruct();
75 if (CEF_MEMBER_MISSING(_struct, is_read_only))
76 return false;
77
78 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
79
80 // Execute
81 int _retval = _struct->is_read_only(_struct);
82
83 // Return type: bool
84 return _retval ? true : false;
85 }
86
87 NO_SANITIZE("cfi-icall")
Copy()88 CefRefPtr<CefCommandLine> CefCommandLineCToCpp::Copy() {
89 cef_command_line_t* _struct = GetStruct();
90 if (CEF_MEMBER_MISSING(_struct, copy))
91 return nullptr;
92
93 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
94
95 // Execute
96 cef_command_line_t* _retval = _struct->copy(_struct);
97
98 // Return type: refptr_same
99 return CefCommandLineCToCpp::Wrap(_retval);
100 }
101
102 NO_SANITIZE("cfi-icall")
InitFromArgv(int argc,const char * const * argv)103 void CefCommandLineCToCpp::InitFromArgv(int argc, const char* const* argv) {
104 cef_command_line_t* _struct = GetStruct();
105 if (CEF_MEMBER_MISSING(_struct, init_from_argv))
106 return;
107
108 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
109
110 // Verify param: argv; type: simple_byaddr
111 DCHECK(argv);
112 if (!argv)
113 return;
114
115 // Execute
116 _struct->init_from_argv(_struct, argc, argv);
117 }
118
119 NO_SANITIZE("cfi-icall")
InitFromString(const CefString & command_line)120 void CefCommandLineCToCpp::InitFromString(const CefString& command_line) {
121 cef_command_line_t* _struct = GetStruct();
122 if (CEF_MEMBER_MISSING(_struct, init_from_string))
123 return;
124
125 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
126
127 // Verify param: command_line; type: string_byref_const
128 DCHECK(!command_line.empty());
129 if (command_line.empty())
130 return;
131
132 // Execute
133 _struct->init_from_string(_struct, command_line.GetStruct());
134 }
135
Reset()136 NO_SANITIZE("cfi-icall") void CefCommandLineCToCpp::Reset() {
137 cef_command_line_t* _struct = GetStruct();
138 if (CEF_MEMBER_MISSING(_struct, reset))
139 return;
140
141 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
142
143 // Execute
144 _struct->reset(_struct);
145 }
146
147 NO_SANITIZE("cfi-icall")
GetArgv(std::vector<CefString> & argv)148 void CefCommandLineCToCpp::GetArgv(std::vector<CefString>& argv) {
149 cef_command_line_t* _struct = GetStruct();
150 if (CEF_MEMBER_MISSING(_struct, get_argv))
151 return;
152
153 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
154
155 // Translate param: argv; type: string_vec_byref
156 cef_string_list_t argvList = cef_string_list_alloc();
157 DCHECK(argvList);
158 if (argvList)
159 transfer_string_list_contents(argv, argvList);
160
161 // Execute
162 _struct->get_argv(_struct, argvList);
163
164 // Restore param:argv; type: string_vec_byref
165 if (argvList) {
166 argv.clear();
167 transfer_string_list_contents(argvList, argv);
168 cef_string_list_free(argvList);
169 }
170 }
171
172 NO_SANITIZE("cfi-icall")
GetCommandLineString()173 CefString CefCommandLineCToCpp::GetCommandLineString() {
174 cef_command_line_t* _struct = GetStruct();
175 if (CEF_MEMBER_MISSING(_struct, get_command_line_string))
176 return CefString();
177
178 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
179
180 // Execute
181 cef_string_userfree_t _retval = _struct->get_command_line_string(_struct);
182
183 // Return type: string
184 CefString _retvalStr;
185 _retvalStr.AttachToUserFree(_retval);
186 return _retvalStr;
187 }
188
GetProgram()189 NO_SANITIZE("cfi-icall") CefString CefCommandLineCToCpp::GetProgram() {
190 cef_command_line_t* _struct = GetStruct();
191 if (CEF_MEMBER_MISSING(_struct, get_program))
192 return CefString();
193
194 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
195
196 // Execute
197 cef_string_userfree_t _retval = _struct->get_program(_struct);
198
199 // Return type: string
200 CefString _retvalStr;
201 _retvalStr.AttachToUserFree(_retval);
202 return _retvalStr;
203 }
204
205 NO_SANITIZE("cfi-icall")
SetProgram(const CefString & program)206 void CefCommandLineCToCpp::SetProgram(const CefString& program) {
207 cef_command_line_t* _struct = GetStruct();
208 if (CEF_MEMBER_MISSING(_struct, set_program))
209 return;
210
211 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
212
213 // Verify param: program; type: string_byref_const
214 DCHECK(!program.empty());
215 if (program.empty())
216 return;
217
218 // Execute
219 _struct->set_program(_struct, program.GetStruct());
220 }
221
HasSwitches()222 NO_SANITIZE("cfi-icall") bool CefCommandLineCToCpp::HasSwitches() {
223 cef_command_line_t* _struct = GetStruct();
224 if (CEF_MEMBER_MISSING(_struct, has_switches))
225 return false;
226
227 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
228
229 // Execute
230 int _retval = _struct->has_switches(_struct);
231
232 // Return type: bool
233 return _retval ? true : false;
234 }
235
236 NO_SANITIZE("cfi-icall")
HasSwitch(const CefString & name)237 bool CefCommandLineCToCpp::HasSwitch(const CefString& name) {
238 cef_command_line_t* _struct = GetStruct();
239 if (CEF_MEMBER_MISSING(_struct, has_switch))
240 return false;
241
242 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
243
244 // Verify param: name; type: string_byref_const
245 DCHECK(!name.empty());
246 if (name.empty())
247 return false;
248
249 // Execute
250 int _retval = _struct->has_switch(_struct, name.GetStruct());
251
252 // Return type: bool
253 return _retval ? true : false;
254 }
255
256 NO_SANITIZE("cfi-icall")
GetSwitchValue(const CefString & name)257 CefString CefCommandLineCToCpp::GetSwitchValue(const CefString& name) {
258 cef_command_line_t* _struct = GetStruct();
259 if (CEF_MEMBER_MISSING(_struct, get_switch_value))
260 return CefString();
261
262 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
263
264 // Verify param: name; type: string_byref_const
265 DCHECK(!name.empty());
266 if (name.empty())
267 return CefString();
268
269 // Execute
270 cef_string_userfree_t _retval =
271 _struct->get_switch_value(_struct, name.GetStruct());
272
273 // Return type: string
274 CefString _retvalStr;
275 _retvalStr.AttachToUserFree(_retval);
276 return _retvalStr;
277 }
278
279 NO_SANITIZE("cfi-icall")
GetSwitches(SwitchMap & switches)280 void CefCommandLineCToCpp::GetSwitches(SwitchMap& switches) {
281 cef_command_line_t* _struct = GetStruct();
282 if (CEF_MEMBER_MISSING(_struct, get_switches))
283 return;
284
285 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
286
287 // Translate param: switches; type: string_map_single_byref
288 cef_string_map_t switchesMap = cef_string_map_alloc();
289 DCHECK(switchesMap);
290 if (switchesMap)
291 transfer_string_map_contents(switches, switchesMap);
292
293 // Execute
294 _struct->get_switches(_struct, switchesMap);
295
296 // Restore param:switches; type: string_map_single_byref
297 if (switchesMap) {
298 switches.clear();
299 transfer_string_map_contents(switchesMap, switches);
300 cef_string_map_free(switchesMap);
301 }
302 }
303
304 NO_SANITIZE("cfi-icall")
AppendSwitch(const CefString & name)305 void CefCommandLineCToCpp::AppendSwitch(const CefString& name) {
306 cef_command_line_t* _struct = GetStruct();
307 if (CEF_MEMBER_MISSING(_struct, append_switch))
308 return;
309
310 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
311
312 // Verify param: name; type: string_byref_const
313 DCHECK(!name.empty());
314 if (name.empty())
315 return;
316
317 // Execute
318 _struct->append_switch(_struct, name.GetStruct());
319 }
320
321 NO_SANITIZE("cfi-icall")
AppendSwitchWithValue(const CefString & name,const CefString & value)322 void CefCommandLineCToCpp::AppendSwitchWithValue(const CefString& name,
323 const CefString& value) {
324 cef_command_line_t* _struct = GetStruct();
325 if (CEF_MEMBER_MISSING(_struct, append_switch_with_value))
326 return;
327
328 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
329
330 // Verify param: name; type: string_byref_const
331 DCHECK(!name.empty());
332 if (name.empty())
333 return;
334 // Verify param: value; type: string_byref_const
335 DCHECK(!value.empty());
336 if (value.empty())
337 return;
338
339 // Execute
340 _struct->append_switch_with_value(_struct, name.GetStruct(),
341 value.GetStruct());
342 }
343
HasArguments()344 NO_SANITIZE("cfi-icall") bool CefCommandLineCToCpp::HasArguments() {
345 cef_command_line_t* _struct = GetStruct();
346 if (CEF_MEMBER_MISSING(_struct, has_arguments))
347 return false;
348
349 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
350
351 // Execute
352 int _retval = _struct->has_arguments(_struct);
353
354 // Return type: bool
355 return _retval ? true : false;
356 }
357
358 NO_SANITIZE("cfi-icall")
GetArguments(ArgumentList & arguments)359 void CefCommandLineCToCpp::GetArguments(ArgumentList& arguments) {
360 cef_command_line_t* _struct = GetStruct();
361 if (CEF_MEMBER_MISSING(_struct, get_arguments))
362 return;
363
364 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
365
366 // Translate param: arguments; type: string_vec_byref
367 cef_string_list_t argumentsList = cef_string_list_alloc();
368 DCHECK(argumentsList);
369 if (argumentsList)
370 transfer_string_list_contents(arguments, argumentsList);
371
372 // Execute
373 _struct->get_arguments(_struct, argumentsList);
374
375 // Restore param:arguments; type: string_vec_byref
376 if (argumentsList) {
377 arguments.clear();
378 transfer_string_list_contents(argumentsList, arguments);
379 cef_string_list_free(argumentsList);
380 }
381 }
382
383 NO_SANITIZE("cfi-icall")
AppendArgument(const CefString & argument)384 void CefCommandLineCToCpp::AppendArgument(const CefString& argument) {
385 cef_command_line_t* _struct = GetStruct();
386 if (CEF_MEMBER_MISSING(_struct, append_argument))
387 return;
388
389 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
390
391 // Verify param: argument; type: string_byref_const
392 DCHECK(!argument.empty());
393 if (argument.empty())
394 return;
395
396 // Execute
397 _struct->append_argument(_struct, argument.GetStruct());
398 }
399
400 NO_SANITIZE("cfi-icall")
PrependWrapper(const CefString & wrapper)401 void CefCommandLineCToCpp::PrependWrapper(const CefString& wrapper) {
402 cef_command_line_t* _struct = GetStruct();
403 if (CEF_MEMBER_MISSING(_struct, prepend_wrapper))
404 return;
405
406 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
407
408 // Verify param: wrapper; type: string_byref_const
409 DCHECK(!wrapper.empty());
410 if (wrapper.empty())
411 return;
412
413 // Execute
414 _struct->prepend_wrapper(_struct, wrapper.GetStruct());
415 }
416
417 // CONSTRUCTOR - Do not edit by hand.
418
CefCommandLineCToCpp()419 CefCommandLineCToCpp::CefCommandLineCToCpp() {}
420
421 // DESTRUCTOR - Do not edit by hand.
422
~CefCommandLineCToCpp()423 CefCommandLineCToCpp::~CefCommandLineCToCpp() {}
424
425 template <>
426 cef_command_line_t*
427 CefCToCppRefCounted<CefCommandLineCToCpp, CefCommandLine, cef_command_line_t>::
UnwrapDerived(CefWrapperType type,CefCommandLine * c)428 UnwrapDerived(CefWrapperType type, CefCommandLine* c) {
429 NOTREACHED() << "Unexpected class type: " << type;
430 return nullptr;
431 }
432
433 template <>
434 CefWrapperType CefCToCppRefCounted<CefCommandLineCToCpp,
435 CefCommandLine,
436 cef_command_line_t>::kWrapperType =
437 WT_COMMAND_LINE;
438