summaryrefslogtreecommitdiffstats
path: root/include/godot_cpp/core/Dictionary.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/godot_cpp/core/Dictionary.cpp')
-rw-r--r--include/godot_cpp/core/Dictionary.cpp91
1 files changed, 91 insertions, 0 deletions
diff --git a/include/godot_cpp/core/Dictionary.cpp b/include/godot_cpp/core/Dictionary.cpp
new file mode 100644
index 0000000..c2d828a
--- /dev/null
+++ b/include/godot_cpp/core/Dictionary.cpp
@@ -0,0 +1,91 @@
+#include "Dictionary.h"
+
+#include "Variant.h"
+
+#include "Array.h"
+
+#include <godot/godot_dictionary.h>
+
+namespace godot {
+
+Dictionary::Dictionary()
+{
+ godot_dictionary_new(&_godot_dictionary);
+}
+
+void Dictionary::clear()
+{
+ godot_dictionary_clear(&_godot_dictionary);
+}
+
+bool Dictionary::empty() const
+{
+ return godot_dictionary_empty(&_godot_dictionary);
+}
+
+void Dictionary::erase(const Variant& key)
+{
+ godot_dictionary_erase(&_godot_dictionary, (godot_variant *) &key);
+}
+
+bool Dictionary::has(const Variant& key) const
+{
+ return godot_dictionary_has(&_godot_dictionary, (godot_variant *) &key);
+}
+
+bool Dictionary::has_all(const Array& keys) const
+{
+ return godot_dictionary_has_all(&_godot_dictionary, (godot_array *) &keys);
+}
+
+uint32_t Dictionary::hash() const
+{
+ return godot_dictionary_hash(&_godot_dictionary);
+}
+
+Array Dictionary::keys() const
+{
+ godot_array a = godot_dictionary_keys(&_godot_dictionary);
+ return *(Array *) &a;
+}
+
+int Dictionary::parse_json(const String& json)
+{
+ return godot_dictionary_parse_json(&_godot_dictionary, (godot_string *) &json);
+}
+
+Variant &Dictionary::operator [](const Variant& key)
+{
+ return *(Variant *) godot_dictionary_operator_index(&_godot_dictionary, (godot_variant *) &key);
+}
+
+const Variant &Dictionary::operator [](const Variant& key) const
+{
+ // oops I did it again
+ return *(Variant *) godot_dictionary_operator_index((godot_dictionary *) &_godot_dictionary, (godot_variant *) &key);
+}
+
+int Dictionary::size() const
+{
+ return godot_dictionary_size(&_godot_dictionary);
+}
+
+String Dictionary::to_json() const
+{
+ godot_string s = godot_dictionary_to_json(&_godot_dictionary);
+ return *(String *) &s;
+}
+
+Array Dictionary::values() const
+{
+ godot_array a = godot_dictionary_values(&_godot_dictionary);
+ return *(Array *) &a;
+}
+
+Dictionary::~Dictionary()
+{
+ godot_dictionary_destroy(&_godot_dictionary);
+}
+
+
+}