1 /*************************************************************************/
2 /*  dictionary.h                                                         */
3 /*************************************************************************/
4 /*                       This file is part of:                           */
5 /*                           GODOT ENGINE                                */
6 /*                      https://godotengine.org                          */
7 /*************************************************************************/
8 /* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur.                 */
9 /* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md).   */
10 /*                                                                       */
11 /* Permission is hereby granted, free of charge, to any person obtaining */
12 /* a copy of this software and associated documentation files (the       */
13 /* "Software"), to deal in the Software without restriction, including   */
14 /* without limitation the rights to use, copy, modify, merge, publish,   */
15 /* distribute, sublicense, and/or sell copies of the Software, and to    */
16 /* permit persons to whom the Software is furnished to do so, subject to */
17 /* the following conditions:                                             */
18 /*                                                                       */
19 /* The above copyright notice and this permission notice shall be        */
20 /* included in all copies or substantial portions of the Software.       */
21 /*                                                                       */
22 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
23 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
24 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
25 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
26 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
27 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
28 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
29 /*************************************************************************/
30 
31 #ifndef GODOT_DICTIONARY_H
32 #define GODOT_DICTIONARY_H
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 #include <stdint.h>
39 
40 #define GODOT_DICTIONARY_SIZE sizeof(void *)
41 
42 #ifndef GODOT_CORE_API_GODOT_DICTIONARY_TYPE_DEFINED
43 #define GODOT_CORE_API_GODOT_DICTIONARY_TYPE_DEFINED
44 typedef struct {
45 	uint8_t _dont_touch_that[GODOT_DICTIONARY_SIZE];
46 } godot_dictionary;
47 #endif
48 
49 // reduce extern "C" nesting for VS2013
50 #ifdef __cplusplus
51 }
52 #endif
53 
54 #include <gdnative/array.h>
55 #include <gdnative/gdnative.h>
56 #include <gdnative/variant.h>
57 
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61 
62 void GDAPI godot_dictionary_new(godot_dictionary *r_dest);
63 void GDAPI godot_dictionary_new_copy(godot_dictionary *r_dest, const godot_dictionary *p_src);
64 void GDAPI godot_dictionary_destroy(godot_dictionary *p_self);
65 
66 godot_dictionary GDAPI godot_dictionary_duplicate(const godot_dictionary *p_self, const godot_bool p_deep);
67 
68 godot_int GDAPI godot_dictionary_size(const godot_dictionary *p_self);
69 
70 godot_bool GDAPI godot_dictionary_empty(const godot_dictionary *p_self);
71 
72 void GDAPI godot_dictionary_clear(godot_dictionary *p_self);
73 
74 godot_bool GDAPI godot_dictionary_has(const godot_dictionary *p_self, const godot_variant *p_key);
75 
76 godot_bool GDAPI godot_dictionary_has_all(const godot_dictionary *p_self, const godot_array *p_keys);
77 
78 void GDAPI godot_dictionary_erase(godot_dictionary *p_self, const godot_variant *p_key);
79 
80 godot_int GDAPI godot_dictionary_hash(const godot_dictionary *p_self);
81 
82 godot_array GDAPI godot_dictionary_keys(const godot_dictionary *p_self);
83 
84 godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_self);
85 
86 godot_variant GDAPI godot_dictionary_get(const godot_dictionary *p_self, const godot_variant *p_key);
87 void GDAPI godot_dictionary_set(godot_dictionary *p_self, const godot_variant *p_key, const godot_variant *p_value);
88 
89 godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_self, const godot_variant *p_key);
90 
91 const godot_variant GDAPI *godot_dictionary_operator_index_const(const godot_dictionary *p_self, const godot_variant *p_key);
92 
93 godot_variant GDAPI *godot_dictionary_next(const godot_dictionary *p_self, const godot_variant *p_key);
94 
95 godot_bool GDAPI godot_dictionary_operator_equal(const godot_dictionary *p_self, const godot_dictionary *p_b);
96 
97 godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_self);
98 
99 // GDNative core 1.1
100 
101 godot_bool GDAPI godot_dictionary_erase_with_return(godot_dictionary *p_self, const godot_variant *p_key);
102 
103 godot_variant GDAPI godot_dictionary_get_with_default(const godot_dictionary *p_self, const godot_variant *p_key, const godot_variant *p_default);
104 
105 #ifdef __cplusplus
106 }
107 #endif
108 
109 #endif // GODOT_DICTIONARY_H
110