Array.hpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #ifndef ARRAY_H
  2. #define ARRAY_H
  3. #if defined(_WIN32)
  4. # ifdef _GD_CPP_CORE_API_IMPL
  5. # define GD_CPP_CORE_API __declspec(dllexport)
  6. # else
  7. # define GD_CPP_CORE_API __declspec(dllimport)
  8. # endif
  9. #else
  10. # define GD_CPP_CORE_API
  11. #endif
  12. #include <godot/godot_array.h>
  13. #include "String.hpp"
  14. namespace godot {
  15. class Variant;
  16. class PoolByteArray;
  17. class PoolIntArray;
  18. class PoolRealArray;
  19. class PoolStringArray;
  20. class PoolVector2Array;
  21. class PoolVector3Array;
  22. class PoolColorArray;
  23. class Object;
  24. class GD_CPP_CORE_API Array {
  25. godot_array _godot_array;
  26. public:
  27. Array();
  28. Array(const PoolByteArray& a);
  29. Array(const PoolIntArray& a);
  30. Array(const PoolRealArray& a);
  31. Array(const PoolStringArray& a);
  32. Array(const PoolVector2Array& a);
  33. Array(const PoolVector3Array& a);
  34. Array(const PoolColorArray& a);
  35. Variant& operator [](const int idx);
  36. Variant operator [](const int idx) const;
  37. void append(const Variant& v);
  38. void clear();
  39. int count(const Variant& v);
  40. bool empty() const;
  41. void erase(const Variant& v);
  42. Variant front() const;
  43. Variant back() const;
  44. int find(const Variant& what, const int from = 0);
  45. int find_last(const Variant& what);
  46. bool has(const Variant& what) const;
  47. uint32_t hash() const;
  48. void insert(const int pos, const Variant& value);
  49. void invert();
  50. bool is_shared() const;
  51. Variant pop_back();
  52. Variant pop_front();
  53. void push_back(const Variant& v);
  54. void push_front(const Variant& v);
  55. void remove(const int idx);
  56. int size() const;
  57. void resize(const int size);
  58. int rfind(const Variant& what, const int from = -1);
  59. void sort();
  60. void sort_custom(Object *obj, const String& func);
  61. ~Array();
  62. };
  63. }
  64. #endif // ARRAY_H