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