class_stringname.rst 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/StringName.xml.
  6. .. _class_StringName:
  7. StringName
  8. ==========
  9. An optimized string type for unique names.
  10. Description
  11. -----------
  12. ``StringName``\ s are immutable strings designed for general-purpose representation of unique names (also called "string interning"). ``StringName`` ensures that only one instance of a given name exists (so two ``StringName``\ s with the same value are the same object). Comparing them is much faster than with regular :ref:`String<class_String>`\ s, because only the pointers are compared, not the whole strings.
  13. You will usually just pass a :ref:`String<class_String>` to methods expecting a ``StringName`` and it will be automatically converted, but you may occasionally want to construct a ``StringName`` ahead of time with ``StringName`` or the literal syntax ``&"example"``.
  14. See also :ref:`NodePath<class_NodePath>`, which is a similar concept specifically designed to store pre-parsed node paths.
  15. Constructors
  16. ------------
  17. +-------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  18. | :ref:`StringName<class_StringName>` | :ref:`StringName<class_StringName_constructor_StringName>` **(** **)** |
  19. +-------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  20. | :ref:`StringName<class_StringName>` | :ref:`StringName<class_StringName_constructor_StringName>` **(** :ref:`StringName<class_StringName>` from **)** |
  21. +-------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  22. | :ref:`StringName<class_StringName>` | :ref:`StringName<class_StringName_constructor_StringName>` **(** :ref:`String<class_String>` from **)** |
  23. +-------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  24. Methods
  25. -------
  26. +-----------------------+---------------------------------------------------------------+
  27. | :ref:`int<class_int>` | :ref:`hash<class_StringName_method_hash>` **(** **)** |const| |
  28. +-----------------------+---------------------------------------------------------------+
  29. Operators
  30. ---------
  31. +-------------------------+--------------------------------------------------------------------------------------------------------------+
  32. | :ref:`bool<class_bool>` | :ref:`operator !=<class_StringName_operator_neq_bool>` **(** :ref:`String<class_String>` right **)** |
  33. +-------------------------+--------------------------------------------------------------------------------------------------------------+
  34. | :ref:`bool<class_bool>` | :ref:`operator !=<class_StringName_operator_neq_bool>` **(** :ref:`StringName<class_StringName>` right **)** |
  35. +-------------------------+--------------------------------------------------------------------------------------------------------------+
  36. | :ref:`bool<class_bool>` | :ref:`operator <<class_StringName_operator_lt_bool>` **(** :ref:`StringName<class_StringName>` right **)** |
  37. +-------------------------+--------------------------------------------------------------------------------------------------------------+
  38. | :ref:`bool<class_bool>` | :ref:`operator <=<class_StringName_operator_lte_bool>` **(** :ref:`StringName<class_StringName>` right **)** |
  39. +-------------------------+--------------------------------------------------------------------------------------------------------------+
  40. | :ref:`bool<class_bool>` | :ref:`operator ==<class_StringName_operator_eq_bool>` **(** :ref:`String<class_String>` right **)** |
  41. +-------------------------+--------------------------------------------------------------------------------------------------------------+
  42. | :ref:`bool<class_bool>` | :ref:`operator ==<class_StringName_operator_eq_bool>` **(** :ref:`StringName<class_StringName>` right **)** |
  43. +-------------------------+--------------------------------------------------------------------------------------------------------------+
  44. | :ref:`bool<class_bool>` | :ref:`operator ><class_StringName_operator_gt_bool>` **(** :ref:`StringName<class_StringName>` right **)** |
  45. +-------------------------+--------------------------------------------------------------------------------------------------------------+
  46. | :ref:`bool<class_bool>` | :ref:`operator >=<class_StringName_operator_gte_bool>` **(** :ref:`StringName<class_StringName>` right **)** |
  47. +-------------------------+--------------------------------------------------------------------------------------------------------------+
  48. Constructor Descriptions
  49. ------------------------
  50. .. _class_StringName_constructor_StringName:
  51. - :ref:`StringName<class_StringName>` **StringName** **(** **)**
  52. Constructs an empty ``StringName``.
  53. ----
  54. - :ref:`StringName<class_StringName>` **StringName** **(** :ref:`StringName<class_StringName>` from **)**
  55. Constructs a ``StringName`` as a copy of the given ``StringName``.
  56. ----
  57. - :ref:`StringName<class_StringName>` **StringName** **(** :ref:`String<class_String>` from **)**
  58. Creates a new ``StringName`` from the given :ref:`String<class_String>`. ``StringName("example")`` is equivalent to ``&"example"``.
  59. Method Descriptions
  60. -------------------
  61. .. _class_StringName_method_hash:
  62. - :ref:`int<class_int>` **hash** **(** **)** |const|
  63. Returns the 32-bit hash value representing the ``StringName``'s contents.
  64. Operator Descriptions
  65. ---------------------
  66. .. _class_StringName_operator_neq_bool:
  67. - :ref:`bool<class_bool>` **operator !=** **(** :ref:`String<class_String>` right **)**
  68. ----
  69. - :ref:`bool<class_bool>` **operator !=** **(** :ref:`StringName<class_StringName>` right **)**
  70. ----
  71. .. _class_StringName_operator_lt_bool:
  72. - :ref:`bool<class_bool>` **operator <** **(** :ref:`StringName<class_StringName>` right **)**
  73. ----
  74. .. _class_StringName_operator_lte_bool:
  75. - :ref:`bool<class_bool>` **operator <=** **(** :ref:`StringName<class_StringName>` right **)**
  76. ----
  77. .. _class_StringName_operator_eq_bool:
  78. - :ref:`bool<class_bool>` **operator ==** **(** :ref:`String<class_String>` right **)**
  79. ----
  80. - :ref:`bool<class_bool>` **operator ==** **(** :ref:`StringName<class_StringName>` right **)**
  81. ----
  82. .. _class_StringName_operator_gt_bool:
  83. - :ref:`bool<class_bool>` **operator >** **(** :ref:`StringName<class_StringName>` right **)**
  84. ----
  85. .. _class_StringName_operator_gte_bool:
  86. - :ref:`bool<class_bool>` **operator >=** **(** :ref:`StringName<class_StringName>` right **)**
  87. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  88. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  89. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  90. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  91. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  92. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`