class_dictionary.rst 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
  3. .. _class_Dictionary:
  4. Dictionary
  5. ==========
  6. **Category:** Built-In Types
  7. Brief Description
  8. -----------------
  9. Dictionary type.
  10. Member Functions
  11. ----------------
  12. +------------------------------+-----------------------------------------------------------------------------------------------+
  13. | void | :ref:`clear<class_Dictionary_clear>` **(** **)** |
  14. +------------------------------+-----------------------------------------------------------------------------------------------+
  15. | :ref:`bool<class_bool>` | :ref:`empty<class_Dictionary_empty>` **(** **)** |
  16. +------------------------------+-----------------------------------------------------------------------------------------------+
  17. | void | :ref:`erase<class_Dictionary_erase>` **(** var key **)** |
  18. +------------------------------+-----------------------------------------------------------------------------------------------+
  19. | :ref:`bool<class_bool>` | :ref:`has<class_Dictionary_has>` **(** var key **)** |
  20. +------------------------------+-----------------------------------------------------------------------------------------------+
  21. | :ref:`bool<class_bool>` | :ref:`has_all<class_Dictionary_has_all>` **(** :ref:`Array<class_array>` keys **)** |
  22. +------------------------------+-----------------------------------------------------------------------------------------------+
  23. | :ref:`int<class_int>` | :ref:`hash<class_Dictionary_hash>` **(** **)** |
  24. +------------------------------+-----------------------------------------------------------------------------------------------+
  25. | :ref:`Array<class_array>` | :ref:`keys<class_Dictionary_keys>` **(** **)** |
  26. +------------------------------+-----------------------------------------------------------------------------------------------+
  27. | :ref:`int<class_int>` | :ref:`parse_json<class_Dictionary_parse_json>` **(** :ref:`String<class_string>` json **)** |
  28. +------------------------------+-----------------------------------------------------------------------------------------------+
  29. | :ref:`int<class_int>` | :ref:`size<class_Dictionary_size>` **(** **)** |
  30. +------------------------------+-----------------------------------------------------------------------------------------------+
  31. | :ref:`String<class_string>` | :ref:`to_json<class_Dictionary_to_json>` **(** **)** |
  32. +------------------------------+-----------------------------------------------------------------------------------------------+
  33. | :ref:`Array<class_array>` | :ref:`values<class_Dictionary_values>` **(** **)** |
  34. +------------------------------+-----------------------------------------------------------------------------------------------+
  35. Description
  36. -----------
  37. Dictionary type. Associative container which contains values referenced by unique keys. Dictionaries are always passed by reference.
  38. Member Function Description
  39. ---------------------------
  40. .. _class_Dictionary_clear:
  41. - void **clear** **(** **)**
  42. Clear the dictionary, removing all key/value pairs.
  43. .. _class_Dictionary_empty:
  44. - :ref:`bool<class_bool>` **empty** **(** **)**
  45. Return true if the dictionary is empty.
  46. .. _class_Dictionary_erase:
  47. - void **erase** **(** var key **)**
  48. Erase a dictionary key/value pair by key.
  49. .. _class_Dictionary_has:
  50. - :ref:`bool<class_bool>` **has** **(** var key **)**
  51. Return true if the dictionary has a given key.
  52. .. _class_Dictionary_has_all:
  53. - :ref:`bool<class_bool>` **has_all** **(** :ref:`Array<class_array>` keys **)**
  54. Return true if the dictionary has all of the keys in the given array.
  55. .. _class_Dictionary_hash:
  56. - :ref:`int<class_int>` **hash** **(** **)**
  57. Return a hashed integer value representing the dictionary contents.
  58. .. _class_Dictionary_keys:
  59. - :ref:`Array<class_array>` **keys** **(** **)**
  60. Return the list of keys in the :ref:`Dictionary<class_dictionary>`.
  61. .. _class_Dictionary_parse_json:
  62. - :ref:`int<class_int>` **parse_json** **(** :ref:`String<class_string>` json **)**
  63. Parse JSON text to the dictionary. Return OK when successed or the error code when failed.
  64. Be aware that the JSON specification does not define integer or float types, but only a number type. Therefore, parsing a JSON text will convert every numerical values to :ref:`float<class_float>` types.
  65. .. _class_Dictionary_size:
  66. - :ref:`int<class_int>` **size** **(** **)**
  67. Return the size of the dictionary (in pairs).
  68. .. _class_Dictionary_to_json:
  69. - :ref:`String<class_string>` **to_json** **(** **)**
  70. Return the dictionary as json text.
  71. .. _class_Dictionary_values:
  72. - :ref:`Array<class_array>` **values** **(** **)**
  73. Return the list of values in the :ref:`Dictionary<class_dictionary>`.