class_poolbytearray.rst 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the PoolByteArray.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_PoolByteArray:
  5. PoolByteArray
  6. =============
  7. **Category:** Built-In Types
  8. Brief Description
  9. -----------------
  10. Raw byte array.
  11. Member Functions
  12. ----------------
  13. +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  14. | :ref:`PoolByteArray<class_poolbytearray>` | :ref:`PoolByteArray<class_PoolByteArray_PoolByteArray>` **(** :ref:`Array<class_array>` from **)** |
  15. +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  16. | void | :ref:`append<class_PoolByteArray_append>` **(** :ref:`int<class_int>` byte **)** |
  17. +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  18. | void | :ref:`append_array<class_PoolByteArray_append_array>` **(** :ref:`PoolByteArray<class_poolbytearray>` array **)** |
  19. +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`PoolByteArray<class_poolbytearray>` | :ref:`compress<class_PoolByteArray_compress>` **(** :ref:`int<class_int>` compression_mode=0 **)** |
  21. +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`PoolByteArray<class_poolbytearray>` | :ref:`decompress<class_PoolByteArray_decompress>` **(** :ref:`int<class_int>` buffer_size, :ref:`int<class_int>` compression_mode=0 **)** |
  23. +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`String<class_string>` | :ref:`get_string_from_ascii<class_PoolByteArray_get_string_from_ascii>` **(** **)** |
  25. +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`String<class_string>` | :ref:`get_string_from_utf8<class_PoolByteArray_get_string_from_utf8>` **(** **)** |
  27. +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`int<class_int>` | :ref:`insert<class_PoolByteArray_insert>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` byte **)** |
  29. +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  30. | void | :ref:`invert<class_PoolByteArray_invert>` **(** **)** |
  31. +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  32. | void | :ref:`push_back<class_PoolByteArray_push_back>` **(** :ref:`int<class_int>` byte **)** |
  33. +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  34. | void | :ref:`remove<class_PoolByteArray_remove>` **(** :ref:`int<class_int>` idx **)** |
  35. +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  36. | void | :ref:`resize<class_PoolByteArray_resize>` **(** :ref:`int<class_int>` idx **)** |
  37. +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  38. | void | :ref:`set<class_PoolByteArray_set>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` byte **)** |
  39. +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`int<class_int>` | :ref:`size<class_PoolByteArray_size>` **(** **)** |
  41. +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`PoolByteArray<class_poolbytearray>` | :ref:`subarray<class_PoolByteArray_subarray>` **(** :ref:`int<class_int>` from, :ref:`int<class_int>` to **)** |
  43. +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  44. Description
  45. -----------
  46. Raw byte array. Contains bytes. Optimized for memory usage, can't fragment the memory. Note that this type is passed by value and not by reference.
  47. Member Function Description
  48. ---------------------------
  49. .. _class_PoolByteArray_PoolByteArray:
  50. - :ref:`PoolByteArray<class_poolbytearray>` **PoolByteArray** **(** :ref:`Array<class_array>` from **)**
  51. Create from a generic array.
  52. .. _class_PoolByteArray_append:
  53. - void **append** **(** :ref:`int<class_int>` byte **)**
  54. Append an element at the end of the array (alias of :ref:`push_back<class_PoolByteArray_push_back>`).
  55. .. _class_PoolByteArray_append_array:
  56. - void **append_array** **(** :ref:`PoolByteArray<class_poolbytearray>` array **)**
  57. Append a ``PoolByteArray`` at the end of this array.
  58. .. _class_PoolByteArray_compress:
  59. - :ref:`PoolByteArray<class_poolbytearray>` **compress** **(** :ref:`int<class_int>` compression_mode=0 **)**
  60. Returns a new ``PoolByteArray`` with the data compressed. Set the compression mode using one of :ref:`File<class_file>`'s COMPRESS\_\* constants.
  61. .. _class_PoolByteArray_decompress:
  62. - :ref:`PoolByteArray<class_poolbytearray>` **decompress** **(** :ref:`int<class_int>` buffer_size, :ref:`int<class_int>` compression_mode=0 **)**
  63. Returns a new ``PoolByteArray`` with the data decompressed. Set buffer_size to the size of the uncompressed data. Set the compression mode using one of :ref:`File<class_file>`'s COMPRESS\_\* constants.
  64. .. _class_PoolByteArray_get_string_from_ascii:
  65. - :ref:`String<class_string>` **get_string_from_ascii** **(** **)**
  66. Returns a copy of the array's contents as :ref:`String<class_string>`. Fast alternative to :ref:`PoolByteArray.get_string_from_utf8<class_PoolByteArray_get_string_from_utf8>` if the content is ASCII-only. Unlike the UTF-8 function this function maps every byte to a character in the array. Multibyte sequences will not be interpreted correctly. For parsing user input always use :ref:`PoolByteArray.get_string_from_utf8<class_PoolByteArray_get_string_from_utf8>`.
  67. .. _class_PoolByteArray_get_string_from_utf8:
  68. - :ref:`String<class_string>` **get_string_from_utf8** **(** **)**
  69. Returns a copy of the array's contents as :ref:`String<class_string>`. Slower than :ref:`PoolByteArray.get_string_from_ascii<class_PoolByteArray_get_string_from_ascii>` but supports UTF-8 encoded data. Use this function if you are unsure about the source of the data. For user input this function should always be preferred.
  70. .. _class_PoolByteArray_insert:
  71. - :ref:`int<class_int>` **insert** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` byte **)**
  72. Insert a new element at a given position in the array. The position must be valid, or at the end of the array (pos==size()).
  73. .. _class_PoolByteArray_invert:
  74. - void **invert** **(** **)**
  75. Reverse the order of the elements in the array (so first element will now be the last).
  76. .. _class_PoolByteArray_push_back:
  77. - void **push_back** **(** :ref:`int<class_int>` byte **)**
  78. Append an element at the end of the array.
  79. .. _class_PoolByteArray_remove:
  80. - void **remove** **(** :ref:`int<class_int>` idx **)**
  81. Remove an element from the array by index.
  82. .. _class_PoolByteArray_resize:
  83. - void **resize** **(** :ref:`int<class_int>` idx **)**
  84. Set the size of the array. If the array is grown reserve elements at the end of the array. If the array is shrunk truncate the array to the new size.
  85. .. _class_PoolByteArray_set:
  86. - void **set** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` byte **)**
  87. Change the byte at the given index.
  88. .. _class_PoolByteArray_size:
  89. - :ref:`int<class_int>` **size** **(** **)**
  90. Return the size of the array.
  91. .. _class_PoolByteArray_subarray:
  92. - :ref:`PoolByteArray<class_poolbytearray>` **subarray** **(** :ref:`int<class_int>` from, :ref:`int<class_int>` to **)**
  93. Returns the slice of the ``PoolByteArray`` between indices (inclusive) as a new ``PoolByteArray``. Any negative index is considered to be from the end of the array.