Dictionary.hpp 1001 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #ifndef DICTIONARY_H
  2. #define DICTIONARY_H
  3. #include "Variant.hpp"
  4. #include "Array.hpp"
  5. #include <gdnative/dictionary.h>
  6. namespace godot {
  7. class Dictionary {
  8. godot_dictionary _godot_dictionary;
  9. friend Variant::operator Dictionary() const;
  10. inline explicit Dictionary(const godot_dictionary &other) {
  11. _godot_dictionary = other;
  12. }
  13. public:
  14. Dictionary();
  15. Dictionary(const Dictionary &other);
  16. Dictionary &operator=(const Dictionary &other);
  17. template <class... Args>
  18. static Dictionary make(Args... args) {
  19. return helpers::add_all(Dictionary(), args...);
  20. }
  21. void clear();
  22. bool empty() const;
  23. void erase(const Variant &key);
  24. bool has(const Variant &key) const;
  25. bool has_all(const Array &keys) const;
  26. uint32_t hash() const;
  27. Array keys() const;
  28. Variant &operator[](const Variant &key);
  29. const Variant &operator[](const Variant &key) const;
  30. int size() const;
  31. String to_json() const;
  32. Array values() const;
  33. ~Dictionary();
  34. };
  35. } // namespace godot
  36. #endif // DICTIONARY_H