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=680adcc74e385af7d83fa8b28b36b2215bc20f2b$
13 //
14
15 #include "libcef_dll/cpptoc/value_cpptoc.h"
16 #include "libcef_dll/cpptoc/binary_value_cpptoc.h"
17 #include "libcef_dll/cpptoc/dictionary_value_cpptoc.h"
18 #include "libcef_dll/cpptoc/list_value_cpptoc.h"
19 #include "libcef_dll/shutdown_checker.h"
20
21 // GLOBAL FUNCTIONS - Body may be edited by hand.
22
cef_value_create()23 CEF_EXPORT cef_value_t* cef_value_create() {
24 shutdown_checker::AssertNotShutdown();
25
26 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27
28 // Execute
29 CefRefPtr<CefValue> _retval = CefValue::Create();
30
31 // Return type: refptr_same
32 return CefValueCppToC::Wrap(_retval);
33 }
34
35 namespace {
36
37 // MEMBER FUNCTIONS - Body may be edited by hand.
38
value_is_valid(struct _cef_value_t * self)39 int CEF_CALLBACK value_is_valid(struct _cef_value_t* self) {
40 shutdown_checker::AssertNotShutdown();
41
42 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
43
44 DCHECK(self);
45 if (!self)
46 return 0;
47
48 // Execute
49 bool _retval = CefValueCppToC::Get(self)->IsValid();
50
51 // Return type: bool
52 return _retval;
53 }
54
value_is_owned(struct _cef_value_t * self)55 int CEF_CALLBACK value_is_owned(struct _cef_value_t* self) {
56 shutdown_checker::AssertNotShutdown();
57
58 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
59
60 DCHECK(self);
61 if (!self)
62 return 0;
63
64 // Execute
65 bool _retval = CefValueCppToC::Get(self)->IsOwned();
66
67 // Return type: bool
68 return _retval;
69 }
70
value_is_read_only(struct _cef_value_t * self)71 int CEF_CALLBACK value_is_read_only(struct _cef_value_t* self) {
72 shutdown_checker::AssertNotShutdown();
73
74 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
75
76 DCHECK(self);
77 if (!self)
78 return 0;
79
80 // Execute
81 bool _retval = CefValueCppToC::Get(self)->IsReadOnly();
82
83 // Return type: bool
84 return _retval;
85 }
86
value_is_same(struct _cef_value_t * self,struct _cef_value_t * that)87 int CEF_CALLBACK value_is_same(struct _cef_value_t* self,
88 struct _cef_value_t* that) {
89 shutdown_checker::AssertNotShutdown();
90
91 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
92
93 DCHECK(self);
94 if (!self)
95 return 0;
96 // Verify param: that; type: refptr_same
97 DCHECK(that);
98 if (!that)
99 return 0;
100
101 // Execute
102 bool _retval =
103 CefValueCppToC::Get(self)->IsSame(CefValueCppToC::Unwrap(that));
104
105 // Return type: bool
106 return _retval;
107 }
108
value_is_equal(struct _cef_value_t * self,struct _cef_value_t * that)109 int CEF_CALLBACK value_is_equal(struct _cef_value_t* self,
110 struct _cef_value_t* that) {
111 shutdown_checker::AssertNotShutdown();
112
113 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
114
115 DCHECK(self);
116 if (!self)
117 return 0;
118 // Verify param: that; type: refptr_same
119 DCHECK(that);
120 if (!that)
121 return 0;
122
123 // Execute
124 bool _retval =
125 CefValueCppToC::Get(self)->IsEqual(CefValueCppToC::Unwrap(that));
126
127 // Return type: bool
128 return _retval;
129 }
130
value_copy(struct _cef_value_t * self)131 struct _cef_value_t* CEF_CALLBACK value_copy(struct _cef_value_t* self) {
132 shutdown_checker::AssertNotShutdown();
133
134 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
135
136 DCHECK(self);
137 if (!self)
138 return NULL;
139
140 // Execute
141 CefRefPtr<CefValue> _retval = CefValueCppToC::Get(self)->Copy();
142
143 // Return type: refptr_same
144 return CefValueCppToC::Wrap(_retval);
145 }
146
value_get_type(struct _cef_value_t * self)147 cef_value_type_t CEF_CALLBACK value_get_type(struct _cef_value_t* self) {
148 shutdown_checker::AssertNotShutdown();
149
150 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
151
152 DCHECK(self);
153 if (!self)
154 return VTYPE_INVALID;
155
156 // Execute
157 cef_value_type_t _retval = CefValueCppToC::Get(self)->GetType();
158
159 // Return type: simple
160 return _retval;
161 }
162
value_get_bool(struct _cef_value_t * self)163 int CEF_CALLBACK value_get_bool(struct _cef_value_t* self) {
164 shutdown_checker::AssertNotShutdown();
165
166 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
167
168 DCHECK(self);
169 if (!self)
170 return 0;
171
172 // Execute
173 bool _retval = CefValueCppToC::Get(self)->GetBool();
174
175 // Return type: bool
176 return _retval;
177 }
178
value_get_int(struct _cef_value_t * self)179 int CEF_CALLBACK value_get_int(struct _cef_value_t* self) {
180 shutdown_checker::AssertNotShutdown();
181
182 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
183
184 DCHECK(self);
185 if (!self)
186 return 0;
187
188 // Execute
189 int _retval = CefValueCppToC::Get(self)->GetInt();
190
191 // Return type: simple
192 return _retval;
193 }
194
value_get_double(struct _cef_value_t * self)195 double CEF_CALLBACK value_get_double(struct _cef_value_t* self) {
196 shutdown_checker::AssertNotShutdown();
197
198 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
199
200 DCHECK(self);
201 if (!self)
202 return 0;
203
204 // Execute
205 double _retval = CefValueCppToC::Get(self)->GetDouble();
206
207 // Return type: simple
208 return _retval;
209 }
210
value_get_string(struct _cef_value_t * self)211 cef_string_userfree_t CEF_CALLBACK value_get_string(struct _cef_value_t* self) {
212 shutdown_checker::AssertNotShutdown();
213
214 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
215
216 DCHECK(self);
217 if (!self)
218 return NULL;
219
220 // Execute
221 CefString _retval = CefValueCppToC::Get(self)->GetString();
222
223 // Return type: string
224 return _retval.DetachToUserFree();
225 }
226
227 struct _cef_binary_value_t* CEF_CALLBACK
value_get_binary(struct _cef_value_t * self)228 value_get_binary(struct _cef_value_t* self) {
229 shutdown_checker::AssertNotShutdown();
230
231 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
232
233 DCHECK(self);
234 if (!self)
235 return NULL;
236
237 // Execute
238 CefRefPtr<CefBinaryValue> _retval = CefValueCppToC::Get(self)->GetBinary();
239
240 // Return type: refptr_same
241 return CefBinaryValueCppToC::Wrap(_retval);
242 }
243
244 struct _cef_dictionary_value_t* CEF_CALLBACK
value_get_dictionary(struct _cef_value_t * self)245 value_get_dictionary(struct _cef_value_t* self) {
246 shutdown_checker::AssertNotShutdown();
247
248 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
249
250 DCHECK(self);
251 if (!self)
252 return NULL;
253
254 // Execute
255 CefRefPtr<CefDictionaryValue> _retval =
256 CefValueCppToC::Get(self)->GetDictionary();
257
258 // Return type: refptr_same
259 return CefDictionaryValueCppToC::Wrap(_retval);
260 }
261
262 struct _cef_list_value_t* CEF_CALLBACK
value_get_list(struct _cef_value_t * self)263 value_get_list(struct _cef_value_t* self) {
264 shutdown_checker::AssertNotShutdown();
265
266 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
267
268 DCHECK(self);
269 if (!self)
270 return NULL;
271
272 // Execute
273 CefRefPtr<CefListValue> _retval = CefValueCppToC::Get(self)->GetList();
274
275 // Return type: refptr_same
276 return CefListValueCppToC::Wrap(_retval);
277 }
278
value_set_null(struct _cef_value_t * self)279 int CEF_CALLBACK value_set_null(struct _cef_value_t* self) {
280 shutdown_checker::AssertNotShutdown();
281
282 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
283
284 DCHECK(self);
285 if (!self)
286 return 0;
287
288 // Execute
289 bool _retval = CefValueCppToC::Get(self)->SetNull();
290
291 // Return type: bool
292 return _retval;
293 }
294
value_set_bool(struct _cef_value_t * self,int value)295 int CEF_CALLBACK value_set_bool(struct _cef_value_t* self, int value) {
296 shutdown_checker::AssertNotShutdown();
297
298 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
299
300 DCHECK(self);
301 if (!self)
302 return 0;
303
304 // Execute
305 bool _retval = CefValueCppToC::Get(self)->SetBool(value ? true : false);
306
307 // Return type: bool
308 return _retval;
309 }
310
value_set_int(struct _cef_value_t * self,int value)311 int CEF_CALLBACK value_set_int(struct _cef_value_t* self, int value) {
312 shutdown_checker::AssertNotShutdown();
313
314 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
315
316 DCHECK(self);
317 if (!self)
318 return 0;
319
320 // Execute
321 bool _retval = CefValueCppToC::Get(self)->SetInt(value);
322
323 // Return type: bool
324 return _retval;
325 }
326
value_set_double(struct _cef_value_t * self,double value)327 int CEF_CALLBACK value_set_double(struct _cef_value_t* self, double value) {
328 shutdown_checker::AssertNotShutdown();
329
330 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
331
332 DCHECK(self);
333 if (!self)
334 return 0;
335
336 // Execute
337 bool _retval = CefValueCppToC::Get(self)->SetDouble(value);
338
339 // Return type: bool
340 return _retval;
341 }
342
value_set_string(struct _cef_value_t * self,const cef_string_t * value)343 int CEF_CALLBACK value_set_string(struct _cef_value_t* self,
344 const cef_string_t* value) {
345 shutdown_checker::AssertNotShutdown();
346
347 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
348
349 DCHECK(self);
350 if (!self)
351 return 0;
352 // Unverified params: value
353
354 // Execute
355 bool _retval = CefValueCppToC::Get(self)->SetString(CefString(value));
356
357 // Return type: bool
358 return _retval;
359 }
360
value_set_binary(struct _cef_value_t * self,struct _cef_binary_value_t * value)361 int CEF_CALLBACK value_set_binary(struct _cef_value_t* self,
362 struct _cef_binary_value_t* value) {
363 shutdown_checker::AssertNotShutdown();
364
365 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
366
367 DCHECK(self);
368 if (!self)
369 return 0;
370 // Verify param: value; type: refptr_same
371 DCHECK(value);
372 if (!value)
373 return 0;
374
375 // Execute
376 bool _retval =
377 CefValueCppToC::Get(self)->SetBinary(CefBinaryValueCppToC::Unwrap(value));
378
379 // Return type: bool
380 return _retval;
381 }
382
value_set_dictionary(struct _cef_value_t * self,struct _cef_dictionary_value_t * value)383 int CEF_CALLBACK value_set_dictionary(struct _cef_value_t* self,
384 struct _cef_dictionary_value_t* value) {
385 shutdown_checker::AssertNotShutdown();
386
387 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
388
389 DCHECK(self);
390 if (!self)
391 return 0;
392 // Verify param: value; type: refptr_same
393 DCHECK(value);
394 if (!value)
395 return 0;
396
397 // Execute
398 bool _retval = CefValueCppToC::Get(self)->SetDictionary(
399 CefDictionaryValueCppToC::Unwrap(value));
400
401 // Return type: bool
402 return _retval;
403 }
404
value_set_list(struct _cef_value_t * self,struct _cef_list_value_t * value)405 int CEF_CALLBACK value_set_list(struct _cef_value_t* self,
406 struct _cef_list_value_t* value) {
407 shutdown_checker::AssertNotShutdown();
408
409 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
410
411 DCHECK(self);
412 if (!self)
413 return 0;
414 // Verify param: value; type: refptr_same
415 DCHECK(value);
416 if (!value)
417 return 0;
418
419 // Execute
420 bool _retval =
421 CefValueCppToC::Get(self)->SetList(CefListValueCppToC::Unwrap(value));
422
423 // Return type: bool
424 return _retval;
425 }
426
427 } // namespace
428
429 // CONSTRUCTOR - Do not edit by hand.
430
CefValueCppToC()431 CefValueCppToC::CefValueCppToC() {
432 GetStruct()->is_valid = value_is_valid;
433 GetStruct()->is_owned = value_is_owned;
434 GetStruct()->is_read_only = value_is_read_only;
435 GetStruct()->is_same = value_is_same;
436 GetStruct()->is_equal = value_is_equal;
437 GetStruct()->copy = value_copy;
438 GetStruct()->get_type = value_get_type;
439 GetStruct()->get_bool = value_get_bool;
440 GetStruct()->get_int = value_get_int;
441 GetStruct()->get_double = value_get_double;
442 GetStruct()->get_string = value_get_string;
443 GetStruct()->get_binary = value_get_binary;
444 GetStruct()->get_dictionary = value_get_dictionary;
445 GetStruct()->get_list = value_get_list;
446 GetStruct()->set_null = value_set_null;
447 GetStruct()->set_bool = value_set_bool;
448 GetStruct()->set_int = value_set_int;
449 GetStruct()->set_double = value_set_double;
450 GetStruct()->set_string = value_set_string;
451 GetStruct()->set_binary = value_set_binary;
452 GetStruct()->set_dictionary = value_set_dictionary;
453 GetStruct()->set_list = value_set_list;
454 }
455
456 // DESTRUCTOR - Do not edit by hand.
457
~CefValueCppToC()458 CefValueCppToC::~CefValueCppToC() {
459 shutdown_checker::AssertNotShutdown();
460 }
461
462 template <>
463 CefRefPtr<CefValue>
UnwrapDerived(CefWrapperType type,cef_value_t * s)464 CefCppToCRefCounted<CefValueCppToC, CefValue, cef_value_t>::UnwrapDerived(
465 CefWrapperType type,
466 cef_value_t* s) {
467 NOTREACHED() << "Unexpected class type: " << type;
468 return nullptr;
469 }
470
471 template <>
472 CefWrapperType
473 CefCppToCRefCounted<CefValueCppToC, CefValue, cef_value_t>::kWrapperType =
474 WT_VALUE;
475