1 // Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following disclaimer
11 // in the documentation and/or other materials provided with the
13 // * Neither the name of Google Inc. nor the name Chromium Embedded
14 // Framework nor the names of its contributors may be used to endorse
15 // or promote products derived from this software without specific prior
16 // written permission.
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 // ---------------------------------------------------------------------------
32 // This file was generated by the CEF translator tool and should not edited
33 // by hand. See the translator.README.txt file in the tools directory for
37 #ifndef CEF_INCLUDE_CAPI_CEF_VALUES_CAPI_H_
38 #define CEF_INCLUDE_CAPI_CEF_VALUES_CAPI_H_
41 #include "include/capi/cef_base_capi.h"
47 struct _cef_binary_value_t;
48 struct _cef_dictionary_value_t;
49 struct _cef_list_value_t;
52 // Structure that wraps other data value types. Complex types (binary,
53 // dictionary and list) will be referenced but not owned by this object. Can be
54 // used on any process and thread.
56 typedef struct _cef_value_t {
63 // Returns true (1) if the underlying data is valid. This will always be true
64 // (1) for simple types. For complex types (binary, dictionary and list) the
65 // underlying data may become invalid if owned by another object (e.g. list or
66 // dictionary) and that other object is then modified or destroyed. This value
67 // object can be re-used by calling Set*() even if the underlying data is
70 int (CEF_CALLBACK *is_valid)(struct _cef_value_t* self);
73 // Returns true (1) if the underlying data is owned by another object.
75 int (CEF_CALLBACK *is_owned)(struct _cef_value_t* self);
78 // Returns true (1) if the underlying data is read-only. Some APIs may expose
81 int (CEF_CALLBACK *is_read_only)(struct _cef_value_t* self);
84 // Returns true (1) if this object and |that| object have the same underlying
85 // data. If true (1) modifications to this object will also affect |that|
86 // object and vice-versa.
88 int (CEF_CALLBACK *is_same)(struct _cef_value_t* self,
89 struct _cef_value_t* that);
92 // Returns true (1) if this object and |that| object have an equivalent
93 // underlying value but are not necessarily the same object.
95 int (CEF_CALLBACK *is_equal)(struct _cef_value_t* self,
96 struct _cef_value_t* that);
99 // Returns a copy of this object. The underlying data will also be copied.
101 struct _cef_value_t* (CEF_CALLBACK *copy)(struct _cef_value_t* self);
104 // Returns the underlying value type.
106 cef_value_type_t (CEF_CALLBACK *get_type)(struct _cef_value_t* self);
109 // Returns the underlying value as type bool.
111 int (CEF_CALLBACK *get_bool)(struct _cef_value_t* self);
114 // Returns the underlying value as type int.
116 int (CEF_CALLBACK *get_int)(struct _cef_value_t* self);
119 // Returns the underlying value as type double.
121 double (CEF_CALLBACK *get_double)(struct _cef_value_t* self);
124 // Returns the underlying value as type string.
126 // The resulting string must be freed by calling cef_string_userfree_free().
127 cef_string_userfree_t (CEF_CALLBACK *get_string)(struct _cef_value_t* self);
130 // Returns the underlying value as type binary. The returned reference may
131 // become invalid if the value is owned by another object or if ownership is
132 // transferred to another object in the future. To maintain a reference to the
133 // value after assigning ownership to a dictionary or list pass this object to
134 // the set_value() function instead of passing the returned reference to
137 struct _cef_binary_value_t* (CEF_CALLBACK *get_binary)(
138 struct _cef_value_t* self);
141 // Returns the underlying value as type dictionary. The returned reference may
142 // become invalid if the value is owned by another object or if ownership is
143 // transferred to another object in the future. To maintain a reference to the
144 // value after assigning ownership to a dictionary or list pass this object to
145 // the set_value() function instead of passing the returned reference to
148 struct _cef_dictionary_value_t* (CEF_CALLBACK *get_dictionary)(
149 struct _cef_value_t* self);
152 // Returns the underlying value as type list. The returned reference may
153 // become invalid if the value is owned by another object or if ownership is
154 // transferred to another object in the future. To maintain a reference to the
155 // value after assigning ownership to a dictionary or list pass this object to
156 // the set_value() function instead of passing the returned reference to
159 struct _cef_list_value_t* (CEF_CALLBACK *get_list)(struct _cef_value_t* self);
162 // Sets the underlying value as type null. Returns true (1) if the value was
165 int (CEF_CALLBACK *set_null)(struct _cef_value_t* self);
168 // Sets the underlying value as type bool. Returns true (1) if the value was
171 int (CEF_CALLBACK *set_bool)(struct _cef_value_t* self, int value);
174 // Sets the underlying value as type int. Returns true (1) if the value was
177 int (CEF_CALLBACK *set_int)(struct _cef_value_t* self, int value);
180 // Sets the underlying value as type double. Returns true (1) if the value was
183 int (CEF_CALLBACK *set_double)(struct _cef_value_t* self, double value);
186 // Sets the underlying value as type string. Returns true (1) if the value was
189 int (CEF_CALLBACK *set_string)(struct _cef_value_t* self,
190 const cef_string_t* value);
193 // Sets the underlying value as type binary. Returns true (1) if the value was
194 // set successfully. This object keeps a reference to |value| and ownership of
195 // the underlying data remains unchanged.
197 int (CEF_CALLBACK *set_binary)(struct _cef_value_t* self,
198 struct _cef_binary_value_t* value);
201 // Sets the underlying value as type dict. Returns true (1) if the value was
202 // set successfully. This object keeps a reference to |value| and ownership of
203 // the underlying data remains unchanged.
205 int (CEF_CALLBACK *set_dictionary)(struct _cef_value_t* self,
206 struct _cef_dictionary_value_t* value);
209 // Sets the underlying value as type list. Returns true (1) if the value was
210 // set successfully. This object keeps a reference to |value| and ownership of
211 // the underlying data remains unchanged.
213 int (CEF_CALLBACK *set_list)(struct _cef_value_t* self,
214 struct _cef_list_value_t* value);
219 // Creates a new object.
221 CEF_EXPORT cef_value_t* cef_value_create();
225 // Structure representing a binary value. Can be used on any process and thread.
227 typedef struct _cef_binary_value_t {
234 // Returns true (1) if this object is valid. This object may become invalid if
235 // the underlying data is owned by another object (e.g. list or dictionary)
236 // and that other object is then modified or destroyed. Do not call any other
237 // functions if this function returns false (0).
239 int (CEF_CALLBACK *is_valid)(struct _cef_binary_value_t* self);
242 // Returns true (1) if this object is currently owned by another object.
244 int (CEF_CALLBACK *is_owned)(struct _cef_binary_value_t* self);
247 // Returns true (1) if this object and |that| object have the same underlying
250 int (CEF_CALLBACK *is_same)(struct _cef_binary_value_t* self,
251 struct _cef_binary_value_t* that);
254 // Returns true (1) if this object and |that| object have an equivalent
255 // underlying value but are not necessarily the same object.
257 int (CEF_CALLBACK *is_equal)(struct _cef_binary_value_t* self,
258 struct _cef_binary_value_t* that);
261 // Returns a copy of this object. The data in this object will also be copied.
263 struct _cef_binary_value_t* (CEF_CALLBACK *copy)(
264 struct _cef_binary_value_t* self);
267 // Returns the data size.
269 size_t (CEF_CALLBACK *get_size)(struct _cef_binary_value_t* self);
272 // Read up to |buffer_size| number of bytes into |buffer|. Reading begins at
273 // the specified byte |data_offset|. Returns the number of bytes read.
275 size_t (CEF_CALLBACK *get_data)(struct _cef_binary_value_t* self,
276 void* buffer, size_t buffer_size, size_t data_offset);
277 } cef_binary_value_t;
281 // Creates a new object that is not owned by any other object. The specified
282 // |data| will be copied.
284 CEF_EXPORT cef_binary_value_t* cef_binary_value_create(const void* data,
289 // Structure representing a dictionary value. Can be used on any process and
292 typedef struct _cef_dictionary_value_t {
299 // Returns true (1) if this object is valid. This object may become invalid if
300 // the underlying data is owned by another object (e.g. list or dictionary)
301 // and that other object is then modified or destroyed. Do not call any other
302 // functions if this function returns false (0).
304 int (CEF_CALLBACK *is_valid)(struct _cef_dictionary_value_t* self);
307 // Returns true (1) if this object is currently owned by another object.
309 int (CEF_CALLBACK *is_owned)(struct _cef_dictionary_value_t* self);
312 // Returns true (1) if the values of this object are read-only. Some APIs may
313 // expose read-only objects.
315 int (CEF_CALLBACK *is_read_only)(struct _cef_dictionary_value_t* self);
318 // Returns true (1) if this object and |that| object have the same underlying
319 // data. If true (1) modifications to this object will also affect |that|
320 // object and vice-versa.
322 int (CEF_CALLBACK *is_same)(struct _cef_dictionary_value_t* self,
323 struct _cef_dictionary_value_t* that);
326 // Returns true (1) if this object and |that| object have an equivalent
327 // underlying value but are not necessarily the same object.
329 int (CEF_CALLBACK *is_equal)(struct _cef_dictionary_value_t* self,
330 struct _cef_dictionary_value_t* that);
333 // Returns a writable copy of this object. If |exclude_NULL_children| is true
334 // (1) any NULL dictionaries or lists will be excluded from the copy.
336 struct _cef_dictionary_value_t* (CEF_CALLBACK *copy)(
337 struct _cef_dictionary_value_t* self, int exclude_empty_children);
340 // Returns the number of values.
342 size_t (CEF_CALLBACK *get_size)(struct _cef_dictionary_value_t* self);
345 // Removes all values. Returns true (1) on success.
347 int (CEF_CALLBACK *clear)(struct _cef_dictionary_value_t* self);
350 // Returns true (1) if the current dictionary has a value for the given key.
352 int (CEF_CALLBACK *has_key)(struct _cef_dictionary_value_t* self,
353 const cef_string_t* key);
356 // Reads all keys for this dictionary into the specified vector.
358 int (CEF_CALLBACK *get_keys)(struct _cef_dictionary_value_t* self,
359 cef_string_list_t keys);
362 // Removes the value at the specified key. Returns true (1) is the value was
363 // removed successfully.
365 int (CEF_CALLBACK *remove)(struct _cef_dictionary_value_t* self,
366 const cef_string_t* key);
369 // Returns the value type for the specified key.
371 cef_value_type_t (CEF_CALLBACK *get_type)(
372 struct _cef_dictionary_value_t* self, const cef_string_t* key);
375 // Returns the value at the specified key. For simple types the returned value
376 // will copy existing data and modifications to the value will not modify this
377 // object. For complex types (binary, dictionary and list) the returned value
378 // will reference existing data and modifications to the value will modify
381 struct _cef_value_t* (CEF_CALLBACK *get_value)(
382 struct _cef_dictionary_value_t* self, const cef_string_t* key);
385 // Returns the value at the specified key as type bool.
387 int (CEF_CALLBACK *get_bool)(struct _cef_dictionary_value_t* self,
388 const cef_string_t* key);
391 // Returns the value at the specified key as type int.
393 int (CEF_CALLBACK *get_int)(struct _cef_dictionary_value_t* self,
394 const cef_string_t* key);
397 // Returns the value at the specified key as type double.
399 double (CEF_CALLBACK *get_double)(struct _cef_dictionary_value_t* self,
400 const cef_string_t* key);
403 // Returns the value at the specified key as type string.
405 // The resulting string must be freed by calling cef_string_userfree_free().
406 cef_string_userfree_t (CEF_CALLBACK *get_string)(
407 struct _cef_dictionary_value_t* self, const cef_string_t* key);
410 // Returns the value at the specified key as type binary. The returned value
411 // will reference existing data.
413 struct _cef_binary_value_t* (CEF_CALLBACK *get_binary)(
414 struct _cef_dictionary_value_t* self, const cef_string_t* key);
417 // Returns the value at the specified key as type dictionary. The returned
418 // value will reference existing data and modifications to the value will
419 // modify this object.
421 struct _cef_dictionary_value_t* (CEF_CALLBACK *get_dictionary)(
422 struct _cef_dictionary_value_t* self, const cef_string_t* key);
425 // Returns the value at the specified key as type list. The returned value
426 // will reference existing data and modifications to the value will modify
429 struct _cef_list_value_t* (CEF_CALLBACK *get_list)(
430 struct _cef_dictionary_value_t* self, const cef_string_t* key);
433 // Sets the value at the specified key. Returns true (1) if the value was set
434 // successfully. If |value| represents simple data then the underlying data
435 // will be copied and modifications to |value| will not modify this object. If
436 // |value| represents complex data (binary, dictionary or list) then the
437 // underlying data will be referenced and modifications to |value| will modify
440 int (CEF_CALLBACK *set_value)(struct _cef_dictionary_value_t* self,
441 const cef_string_t* key, struct _cef_value_t* value);
444 // Sets the value at the specified key as type null. Returns true (1) if the
445 // value was set successfully.
447 int (CEF_CALLBACK *set_null)(struct _cef_dictionary_value_t* self,
448 const cef_string_t* key);
451 // Sets the value at the specified key as type bool. Returns true (1) if the
452 // value was set successfully.
454 int (CEF_CALLBACK *set_bool)(struct _cef_dictionary_value_t* self,
455 const cef_string_t* key, int value);
458 // Sets the value at the specified key as type int. Returns true (1) if the
459 // value was set successfully.
461 int (CEF_CALLBACK *set_int)(struct _cef_dictionary_value_t* self,
462 const cef_string_t* key, int value);
465 // Sets the value at the specified key as type double. Returns true (1) if the
466 // value was set successfully.
468 int (CEF_CALLBACK *set_double)(struct _cef_dictionary_value_t* self,
469 const cef_string_t* key, double value);
472 // Sets the value at the specified key as type string. Returns true (1) if the
473 // value was set successfully.
475 int (CEF_CALLBACK *set_string)(struct _cef_dictionary_value_t* self,
476 const cef_string_t* key, const cef_string_t* value);
479 // Sets the value at the specified key as type binary. Returns true (1) if the
480 // value was set successfully. If |value| is currently owned by another object
481 // then the value will be copied and the |value| reference will not change.
482 // Otherwise, ownership will be transferred to this object and the |value|
483 // reference will be invalidated.
485 int (CEF_CALLBACK *set_binary)(struct _cef_dictionary_value_t* self,
486 const cef_string_t* key, struct _cef_binary_value_t* value);
489 // Sets the value at the specified key as type dict. Returns true (1) if the
490 // value was set successfully. If |value| is currently owned by another object
491 // then the value will be copied and the |value| reference will not change.
492 // Otherwise, ownership will be transferred to this object and the |value|
493 // reference will be invalidated.
495 int (CEF_CALLBACK *set_dictionary)(struct _cef_dictionary_value_t* self,
496 const cef_string_t* key, struct _cef_dictionary_value_t* value);
499 // Sets the value at the specified key as type list. Returns true (1) if the
500 // value was set successfully. If |value| is currently owned by another object
501 // then the value will be copied and the |value| reference will not change.
502 // Otherwise, ownership will be transferred to this object and the |value|
503 // reference will be invalidated.
505 int (CEF_CALLBACK *set_list)(struct _cef_dictionary_value_t* self,
506 const cef_string_t* key, struct _cef_list_value_t* value);
507 } cef_dictionary_value_t;
511 // Creates a new object that is not owned by any other object.
513 CEF_EXPORT cef_dictionary_value_t* cef_dictionary_value_create();
517 // Structure representing a list value. Can be used on any process and thread.
519 typedef struct _cef_list_value_t {
526 // Returns true (1) if this object is valid. This object may become invalid if
527 // the underlying data is owned by another object (e.g. list or dictionary)
528 // and that other object is then modified or destroyed. Do not call any other
529 // functions if this function returns false (0).
531 int (CEF_CALLBACK *is_valid)(struct _cef_list_value_t* self);
534 // Returns true (1) if this object is currently owned by another object.
536 int (CEF_CALLBACK *is_owned)(struct _cef_list_value_t* self);
539 // Returns true (1) if the values of this object are read-only. Some APIs may
540 // expose read-only objects.
542 int (CEF_CALLBACK *is_read_only)(struct _cef_list_value_t* self);
545 // Returns true (1) if this object and |that| object have the same underlying
546 // data. If true (1) modifications to this object will also affect |that|
547 // object and vice-versa.
549 int (CEF_CALLBACK *is_same)(struct _cef_list_value_t* self,
550 struct _cef_list_value_t* that);
553 // Returns true (1) if this object and |that| object have an equivalent
554 // underlying value but are not necessarily the same object.
556 int (CEF_CALLBACK *is_equal)(struct _cef_list_value_t* self,
557 struct _cef_list_value_t* that);
560 // Returns a writable copy of this object.
562 struct _cef_list_value_t* (CEF_CALLBACK *copy)(
563 struct _cef_list_value_t* self);
566 // Sets the number of values. If the number of values is expanded all new
567 // value slots will default to type null. Returns true (1) on success.
569 int (CEF_CALLBACK *set_size)(struct _cef_list_value_t* self, size_t size);
572 // Returns the number of values.
574 size_t (CEF_CALLBACK *get_size)(struct _cef_list_value_t* self);
577 // Removes all values. Returns true (1) on success.
579 int (CEF_CALLBACK *clear)(struct _cef_list_value_t* self);
582 // Removes the value at the specified index.
584 int (CEF_CALLBACK *remove)(struct _cef_list_value_t* self, int index);
587 // Returns the value type at the specified index.
589 cef_value_type_t (CEF_CALLBACK *get_type)(struct _cef_list_value_t* self,
593 // Returns the value at the specified index. For simple types the returned
594 // value will copy existing data and modifications to the value will not
595 // modify this object. For complex types (binary, dictionary and list) the
596 // returned value will reference existing data and modifications to the value
597 // will modify this object.
599 struct _cef_value_t* (CEF_CALLBACK *get_value)(struct _cef_list_value_t* self,
603 // Returns the value at the specified index as type bool.
605 int (CEF_CALLBACK *get_bool)(struct _cef_list_value_t* self, int index);
608 // Returns the value at the specified index as type int.
610 int (CEF_CALLBACK *get_int)(struct _cef_list_value_t* self, int index);
613 // Returns the value at the specified index as type double.
615 double (CEF_CALLBACK *get_double)(struct _cef_list_value_t* self, int index);
618 // Returns the value at the specified index as type string.
620 // The resulting string must be freed by calling cef_string_userfree_free().
621 cef_string_userfree_t (CEF_CALLBACK *get_string)(
622 struct _cef_list_value_t* self, int index);
625 // Returns the value at the specified index as type binary. The returned value
626 // will reference existing data.
628 struct _cef_binary_value_t* (CEF_CALLBACK *get_binary)(
629 struct _cef_list_value_t* self, int index);
632 // Returns the value at the specified index as type dictionary. The returned
633 // value will reference existing data and modifications to the value will
634 // modify this object.
636 struct _cef_dictionary_value_t* (CEF_CALLBACK *get_dictionary)(
637 struct _cef_list_value_t* self, int index);
640 // Returns the value at the specified index as type list. The returned value
641 // will reference existing data and modifications to the value will modify
644 struct _cef_list_value_t* (CEF_CALLBACK *get_list)(
645 struct _cef_list_value_t* self, int index);
648 // Sets the value at the specified index. Returns true (1) if the value was
649 // set successfully. If |value| represents simple data then the underlying
650 // data will be copied and modifications to |value| will not modify this
651 // object. If |value| represents complex data (binary, dictionary or list)
652 // then the underlying data will be referenced and modifications to |value|
653 // will modify this object.
655 int (CEF_CALLBACK *set_value)(struct _cef_list_value_t* self, int index,
656 struct _cef_value_t* value);
659 // Sets the value at the specified index as type null. Returns true (1) if the
660 // value was set successfully.
662 int (CEF_CALLBACK *set_null)(struct _cef_list_value_t* self, int index);
665 // Sets the value at the specified index as type bool. Returns true (1) if the
666 // value was set successfully.
668 int (CEF_CALLBACK *set_bool)(struct _cef_list_value_t* self, int index,
672 // Sets the value at the specified index as type int. Returns true (1) if the
673 // value was set successfully.
675 int (CEF_CALLBACK *set_int)(struct _cef_list_value_t* self, int index,
679 // Sets the value at the specified index as type double. Returns true (1) if
680 // the value was set successfully.
682 int (CEF_CALLBACK *set_double)(struct _cef_list_value_t* self, int index,
686 // Sets the value at the specified index as type string. Returns true (1) if
687 // the value was set successfully.
689 int (CEF_CALLBACK *set_string)(struct _cef_list_value_t* self, int index,
690 const cef_string_t* value);
693 // Sets the value at the specified index as type binary. Returns true (1) if
694 // the value was set successfully. If |value| is currently owned by another
695 // object then the value will be copied and the |value| reference will not
696 // change. Otherwise, ownership will be transferred to this object and the
697 // |value| reference will be invalidated.
699 int (CEF_CALLBACK *set_binary)(struct _cef_list_value_t* self, int index,
700 struct _cef_binary_value_t* value);
703 // Sets the value at the specified index as type dict. Returns true (1) if the
704 // value was set successfully. If |value| is currently owned by another object
705 // then the value will be copied and the |value| reference will not change.
706 // Otherwise, ownership will be transferred to this object and the |value|
707 // reference will be invalidated.
709 int (CEF_CALLBACK *set_dictionary)(struct _cef_list_value_t* self, int index,
710 struct _cef_dictionary_value_t* value);
713 // Sets the value at the specified index as type list. Returns true (1) if the
714 // value was set successfully. If |value| is currently owned by another object
715 // then the value will be copied and the |value| reference will not change.
716 // Otherwise, ownership will be transferred to this object and the |value|
717 // reference will be invalidated.
719 int (CEF_CALLBACK *set_list)(struct _cef_list_value_t* self, int index,
720 struct _cef_list_value_t* value);
725 // Creates a new object that is not owned by any other object.
727 CEF_EXPORT cef_list_value_t* cef_list_value_create();
734 #endif // CEF_INCLUDE_CAPI_CEF_VALUES_CAPI_H_