array.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /*************************************************************************/
  2. /* array.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2019 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. #ifndef GODOT_ARRAY_H
  31. #define GODOT_ARRAY_H
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. #include <stdint.h>
  36. #define GODOT_ARRAY_SIZE sizeof(void *)
  37. #ifndef GODOT_CORE_API_GODOT_ARRAY_TYPE_DEFINED
  38. #define GODOT_CORE_API_GODOT_ARRAY_TYPE_DEFINED
  39. typedef struct {
  40. uint8_t _dont_touch_that[GODOT_ARRAY_SIZE];
  41. } godot_array;
  42. #endif
  43. // reduce extern "C" nesting for VS2013
  44. #ifdef __cplusplus
  45. }
  46. #endif
  47. #include <gdnative/pool_arrays.h>
  48. #include <gdnative/variant.h>
  49. #include <gdnative/gdnative.h>
  50. #ifdef __cplusplus
  51. extern "C" {
  52. #endif
  53. void GDAPI godot_array_new(godot_array *r_dest);
  54. void GDAPI godot_array_new_copy(godot_array *r_dest, const godot_array *p_src);
  55. void GDAPI godot_array_new_pool_color_array(godot_array *r_dest, const godot_pool_color_array *p_pca);
  56. void GDAPI godot_array_new_pool_vector3_array(godot_array *r_dest, const godot_pool_vector3_array *p_pv3a);
  57. void GDAPI godot_array_new_pool_vector2_array(godot_array *r_dest, const godot_pool_vector2_array *p_pv2a);
  58. void GDAPI godot_array_new_pool_string_array(godot_array *r_dest, const godot_pool_string_array *p_psa);
  59. void GDAPI godot_array_new_pool_real_array(godot_array *r_dest, const godot_pool_real_array *p_pra);
  60. void GDAPI godot_array_new_pool_int_array(godot_array *r_dest, const godot_pool_int_array *p_pia);
  61. void GDAPI godot_array_new_pool_byte_array(godot_array *r_dest, const godot_pool_byte_array *p_pba);
  62. void GDAPI godot_array_set(godot_array *p_self, const godot_int p_idx, const godot_variant *p_value);
  63. godot_variant GDAPI godot_array_get(const godot_array *p_self, const godot_int p_idx);
  64. godot_variant GDAPI *godot_array_operator_index(godot_array *p_self, const godot_int p_idx);
  65. const godot_variant GDAPI *godot_array_operator_index_const(const godot_array *p_self, const godot_int p_idx);
  66. void GDAPI godot_array_append(godot_array *p_self, const godot_variant *p_value);
  67. void GDAPI godot_array_clear(godot_array *p_self);
  68. godot_int GDAPI godot_array_count(const godot_array *p_self, const godot_variant *p_value);
  69. godot_bool GDAPI godot_array_empty(const godot_array *p_self);
  70. void GDAPI godot_array_erase(godot_array *p_self, const godot_variant *p_value);
  71. godot_variant GDAPI godot_array_front(const godot_array *p_self);
  72. godot_variant GDAPI godot_array_back(const godot_array *p_self);
  73. godot_int GDAPI godot_array_find(const godot_array *p_self, const godot_variant *p_what, const godot_int p_from);
  74. godot_int GDAPI godot_array_find_last(const godot_array *p_self, const godot_variant *p_what);
  75. godot_bool GDAPI godot_array_has(const godot_array *p_self, const godot_variant *p_value);
  76. godot_int GDAPI godot_array_hash(const godot_array *p_self);
  77. void GDAPI godot_array_insert(godot_array *p_self, const godot_int p_pos, const godot_variant *p_value);
  78. void GDAPI godot_array_invert(godot_array *p_self);
  79. godot_variant GDAPI godot_array_pop_back(godot_array *p_self);
  80. godot_variant GDAPI godot_array_pop_front(godot_array *p_self);
  81. void GDAPI godot_array_push_back(godot_array *p_self, const godot_variant *p_value);
  82. void GDAPI godot_array_push_front(godot_array *p_self, const godot_variant *p_value);
  83. void GDAPI godot_array_remove(godot_array *p_self, const godot_int p_idx);
  84. void GDAPI godot_array_resize(godot_array *p_self, const godot_int p_size);
  85. godot_int GDAPI godot_array_rfind(const godot_array *p_self, const godot_variant *p_what, const godot_int p_from);
  86. godot_int GDAPI godot_array_size(const godot_array *p_self);
  87. void GDAPI godot_array_sort(godot_array *p_self);
  88. void GDAPI godot_array_sort_custom(godot_array *p_self, godot_object *p_obj, const godot_string *p_func);
  89. godot_int GDAPI godot_array_bsearch(godot_array *p_self, const godot_variant *p_value, const godot_bool p_before);
  90. godot_int GDAPI godot_array_bsearch_custom(godot_array *p_self, const godot_variant *p_value, godot_object *p_obj, const godot_string *p_func, const godot_bool p_before);
  91. void GDAPI godot_array_destroy(godot_array *p_self);
  92. godot_array GDAPI godot_array_duplicate(const godot_array *p_self, const godot_bool p_deep);
  93. godot_variant GDAPI godot_array_max(const godot_array *p_self);
  94. godot_variant GDAPI godot_array_min(const godot_array *p_self);
  95. void GDAPI godot_array_shuffle(godot_array *p_self);
  96. #ifdef __cplusplus
  97. }
  98. #endif
  99. #endif // GODOT_ARRAY_H