collections_glue.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*************************************************************************/
  2. /* collections_glue.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 COLLECTIONS_GLUE_H
  31. #define COLLECTIONS_GLUE_H
  32. #ifdef MONO_GLUE_ENABLED
  33. #include "core/array.h"
  34. #include "../mono_gd/gd_mono_marshal.h"
  35. // Array
  36. Array *godot_icall_Array_Ctor();
  37. void godot_icall_Array_Dtor(Array *ptr);
  38. MonoObject *godot_icall_Array_At(Array *ptr, int index);
  39. MonoObject *godot_icall_Array_At_Generic(Array *ptr, int index, uint32_t type_encoding, GDMonoClass *type_class);
  40. void godot_icall_Array_SetAt(Array *ptr, int index, MonoObject *value);
  41. int godot_icall_Array_Count(Array *ptr);
  42. void godot_icall_Array_Add(Array *ptr, MonoObject *item);
  43. void godot_icall_Array_Clear(Array *ptr);
  44. bool godot_icall_Array_Contains(Array *ptr, MonoObject *item);
  45. void godot_icall_Array_CopyTo(Array *ptr, MonoArray *array, int array_index);
  46. int godot_icall_Array_IndexOf(Array *ptr, MonoObject *item);
  47. void godot_icall_Array_Insert(Array *ptr, int index, MonoObject *item);
  48. bool godot_icall_Array_Remove(Array *ptr, MonoObject *item);
  49. void godot_icall_Array_RemoveAt(Array *ptr, int index);
  50. Error godot_icall_Array_Resize(Array *ptr, int new_size);
  51. void godot_icall_Array_Generic_GetElementTypeInfo(MonoReflectionType *refltype, uint32_t *type_encoding, GDMonoClass **type_class);
  52. // Dictionary
  53. Dictionary *godot_icall_Dictionary_Ctor();
  54. void godot_icall_Dictionary_Dtor(Dictionary *ptr);
  55. MonoObject *godot_icall_Dictionary_GetValue(Dictionary *ptr, MonoObject *key);
  56. MonoObject *godot_icall_Dictionary_GetValue_Generic(Dictionary *ptr, MonoObject *key, uint32_t type_encoding, GDMonoClass *type_class);
  57. void godot_icall_Dictionary_SetValue(Dictionary *ptr, MonoObject *key, MonoObject *value);
  58. Array *godot_icall_Dictionary_Keys(Dictionary *ptr);
  59. Array *godot_icall_Dictionary_Values(Dictionary *ptr);
  60. int godot_icall_Dictionary_Count(Dictionary *ptr);
  61. void godot_icall_Dictionary_Add(Dictionary *ptr, MonoObject *key, MonoObject *value);
  62. void godot_icall_Dictionary_Clear(Dictionary *ptr);
  63. bool godot_icall_Dictionary_Contains(Dictionary *ptr, MonoObject *key, MonoObject *value);
  64. bool godot_icall_Dictionary_ContainsKey(Dictionary *ptr, MonoObject *key);
  65. bool godot_icall_Dictionary_RemoveKey(Dictionary *ptr, MonoObject *key);
  66. bool godot_icall_Dictionary_Remove(Dictionary *ptr, MonoObject *key, MonoObject *value);
  67. bool godot_icall_Dictionary_TryGetValue(Dictionary *ptr, MonoObject *key, MonoObject **value);
  68. bool godot_icall_Dictionary_TryGetValue_Generic(Dictionary *ptr, MonoObject *key, MonoObject **value, uint32_t type_encoding, GDMonoClass *type_class);
  69. void godot_icall_Dictionary_Generic_GetValueTypeInfo(MonoReflectionType *refltype, uint32_t *type_encoding, GDMonoClass **type_class);
  70. // Register internal calls
  71. void godot_register_collections_icalls();
  72. #endif // MONO_GLUE_ENABLED
  73. #endif // COLLECTIONS_GLUE_H