mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-07 02:12:07 +03:00
176 lines
8.7 KiB
ReStructuredText
176 lines
8.7 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. DO NOT EDIT THIS FILE!!!
|
|
.. Generated automatically from Godot engine sources.
|
|
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
|
|
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/StringName.xml.
|
|
|
|
.. _class_StringName:
|
|
|
|
StringName
|
|
==========
|
|
|
|
An optimized string type for unique names.
|
|
|
|
Description
|
|
-----------
|
|
|
|
``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.
|
|
|
|
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"``.
|
|
|
|
See also :ref:`NodePath<class_NodePath>`, which is a similar concept specifically designed to store pre-parsed node paths.
|
|
|
|
Constructors
|
|
------------
|
|
|
|
+-------------------------------------+-----------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`StringName<class_StringName>` | :ref:`StringName<class_StringName_constructor_StringName>` **(** **)** |
|
|
+-------------------------------------+-----------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`StringName<class_StringName>` | :ref:`StringName<class_StringName_constructor_StringName>` **(** :ref:`StringName<class_StringName>` from **)** |
|
|
+-------------------------------------+-----------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`StringName<class_StringName>` | :ref:`StringName<class_StringName_constructor_StringName>` **(** :ref:`String<class_String>` from **)** |
|
|
+-------------------------------------+-----------------------------------------------------------------------------------------------------------------+
|
|
|
|
Methods
|
|
-------
|
|
|
|
+-----------------------+---------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`hash<class_StringName_method_hash>` **(** **)** |const| |
|
|
+-----------------------+---------------------------------------------------------------+
|
|
|
|
Operators
|
|
---------
|
|
|
|
+-------------------------+---------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`operator !=<class_StringName_operator_neq_bool>` **(** :ref:`String<class_String>` right **)** |
|
|
+-------------------------+---------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`operator !=<class_StringName_operator_neq_bool>` **(** :ref:`StringName<class_StringName>` right **)** |
|
|
+-------------------------+---------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`operator \<<class_StringName_operator_lt_bool>` **(** :ref:`StringName<class_StringName>` right **)** |
|
|
+-------------------------+---------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`operator \<=<class_StringName_operator_lte_bool>` **(** :ref:`StringName<class_StringName>` right **)** |
|
|
+-------------------------+---------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`operator ==<class_StringName_operator_eq_bool>` **(** :ref:`String<class_String>` right **)** |
|
|
+-------------------------+---------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`operator ==<class_StringName_operator_eq_bool>` **(** :ref:`StringName<class_StringName>` right **)** |
|
|
+-------------------------+---------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`operator ><class_StringName_operator_gt_bool>` **(** :ref:`StringName<class_StringName>` right **)** |
|
|
+-------------------------+---------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`operator >=<class_StringName_operator_gte_bool>` **(** :ref:`StringName<class_StringName>` right **)** |
|
|
+-------------------------+---------------------------------------------------------------------------------------------------------------+
|
|
|
|
Constructor Descriptions
|
|
------------------------
|
|
|
|
.. _class_StringName_constructor_StringName:
|
|
|
|
- :ref:`StringName<class_StringName>` **StringName** **(** **)**
|
|
|
|
Constructs an empty ``StringName``.
|
|
|
|
----
|
|
|
|
- :ref:`StringName<class_StringName>` **StringName** **(** :ref:`StringName<class_StringName>` from **)**
|
|
|
|
Constructs a ``StringName`` as a copy of the given ``StringName``.
|
|
|
|
----
|
|
|
|
- :ref:`StringName<class_StringName>` **StringName** **(** :ref:`String<class_String>` from **)**
|
|
|
|
Creates a new ``StringName`` from the given :ref:`String<class_String>`. ``StringName("example")`` is equivalent to ``&"example"``.
|
|
|
|
Method Descriptions
|
|
-------------------
|
|
|
|
.. _class_StringName_method_hash:
|
|
|
|
- :ref:`int<class_int>` **hash** **(** **)** |const|
|
|
|
|
Returns the 32-bit hash value representing the ``StringName``'s contents.
|
|
|
|
Operator Descriptions
|
|
---------------------
|
|
|
|
.. _class_StringName_operator_neq_bool:
|
|
|
|
- :ref:`bool<class_bool>` **operator !=** **(** :ref:`String<class_String>` right **)**
|
|
|
|
.. container:: contribute
|
|
|
|
There is currently no description for this operator. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
|
|
|
|
----
|
|
|
|
- :ref:`bool<class_bool>` **operator !=** **(** :ref:`StringName<class_StringName>` right **)**
|
|
|
|
.. container:: contribute
|
|
|
|
There is currently no description for this operator. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
|
|
|
|
----
|
|
|
|
.. _class_StringName_operator_lt_bool:
|
|
|
|
- :ref:`bool<class_bool>` **operator <** **(** :ref:`StringName<class_StringName>` right **)**
|
|
|
|
.. container:: contribute
|
|
|
|
There is currently no description for this operator. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
|
|
|
|
----
|
|
|
|
.. _class_StringName_operator_lte_bool:
|
|
|
|
- :ref:`bool<class_bool>` **operator <=** **(** :ref:`StringName<class_StringName>` right **)**
|
|
|
|
.. container:: contribute
|
|
|
|
There is currently no description for this operator. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
|
|
|
|
----
|
|
|
|
.. _class_StringName_operator_eq_bool:
|
|
|
|
- :ref:`bool<class_bool>` **operator ==** **(** :ref:`String<class_String>` right **)**
|
|
|
|
.. container:: contribute
|
|
|
|
There is currently no description for this operator. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
|
|
|
|
----
|
|
|
|
- :ref:`bool<class_bool>` **operator ==** **(** :ref:`StringName<class_StringName>` right **)**
|
|
|
|
.. container:: contribute
|
|
|
|
There is currently no description for this operator. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
|
|
|
|
----
|
|
|
|
.. _class_StringName_operator_gt_bool:
|
|
|
|
- :ref:`bool<class_bool>` **operator >** **(** :ref:`StringName<class_StringName>` right **)**
|
|
|
|
.. container:: contribute
|
|
|
|
There is currently no description for this operator. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
|
|
|
|
----
|
|
|
|
.. _class_StringName_operator_gte_bool:
|
|
|
|
- :ref:`bool<class_bool>` **operator >=** **(** :ref:`StringName<class_StringName>` right **)**
|
|
|
|
.. container:: contribute
|
|
|
|
There is currently no description for this operator. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
|
|
|
|
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
|
|
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
|
|
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
|
|
.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
|
|
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
|
|
.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
|