.. index:: pair: class; EE::UI::CSS::IdNameMap .. _doxid-class_e_e_1_1_u_i_1_1_c_s_s_1_1_id_name_map: template class EE::UI::CSS::IdNameMap ===================================== .. toctree:: :hidden: Overview ~~~~~~~~ Maps dense process-local IDs to canonical names and back. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include template class IdNameMap { public: // methods bool :ref:`addBuiltin`(:ref:`Id` id, const std::string& canonicalName); bool :ref:`addAlias`(const std::string& alias, :ref:`Id` target, bool couldBeDuplicate = false); bool :ref:`finalizeBuiltins`(); :ref:`Id` :ref:`getId`(std::string_view name) const; :ref:`Id` :target:`getId`(const std::string& name) const; :ref:`Id` :target:`getId`(const char* name) const; const std::string& :ref:`getName`(:ref:`Id` id) const; :ref:`Id` :ref:`getOrCreateId`(const std::string& canonicalName); bool :target:`contains`(:ref:`Id` id) const; bool :target:`contains`(std::string_view name) const; bool :target:`contains`(const std::string& name) const; bool :target:`contains`(const char* name) const; std::size_t :target:`size`() const; }; .. _details-class_e_e_1_1_u_i_1_1_c_s_s_1_1_id_name_map: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Maps dense process-local IDs to canonical names and back. The map is the full-string reverse lookup for a dense ID space. It owns no definitions: it only tracks which ID belongs to which canonical (or alias) name. Built-in IDs must be registered with :ref:`addBuiltin() ` before :ref:`finalizeBuiltins() ` seals the built-in range; runtime names then receive IDs via :ref:`getOrCreateId() `. Numeric IDs are unstable internal identifiers. Names are the stable external representation. All names passed into the map are expected to already be lowercase and trimmed; the map performs no hidden normalization and no hash-only equality. Methods ------- .. index:: pair: function; addBuiltin .. _doxid-class_e_e_1_1_u_i_1_1_c_s_s_1_1_id_name_map_1a766b5db42c938aef1495b4cdff6b1c2a: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool addBuiltin(:ref:`Id` id, const std::string& canonicalName) Registers a built-in ID with its canonical name. Valid only before custom allocation begins. Rejects Invalid, IDs at or beyond MaxIds, duplicate names, and assigning a different name to an occupied ID. .. rubric:: Returns: true on success. .. index:: pair: function; addAlias .. _doxid-class_e_e_1_1_u_i_1_1_c_s_s_1_1_id_name_map_1a8765b7edd05a05dea7be181d1f960074: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool addAlias(const std::string& alias, :ref:`Id` target, bool couldBeDuplicate = false) Adds an alias that resolves to an existing ID. Only the reverse entry is added; no ID is occupied and the canonical name is never replaced. .. index:: pair: function; finalizeBuiltins .. _doxid-class_e_e_1_1_u_i_1_1_c_s_s_1_1_id_name_map_1ab66d057885ee6231dbb80d2fb0857f49: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool finalizeBuiltins() Seals the built-in range and enables runtime ID allocation. Verifies every slot in [1, FirstCustomId) is populated. After this call :ref:`addBuiltin() ` is permanently rejected. .. rubric:: Returns: true when all built-in slots are populated. .. index:: pair: function; getId .. _doxid-class_e_e_1_1_u_i_1_1_c_s_s_1_1_id_name_map_1a012b907ccf7518f7ba1333ce19165afa: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Id` getId(std::string_view name) const Returns the ID for a canonical or alias name. .. rubric:: Returns: Invalid when the name is unknown. .. index:: pair: function; getName .. _doxid-class_e_e_1_1_u_i_1_1_c_s_s_1_1_id_name_map_1ab101bdcf90bed177f05897dc17bb94d6: .. ref-code-block:: cpp :class: doxyrest-title-code-block const std::string& getName(:ref:`Id` id) const Returns the canonical name for an ID. .. rubric:: Returns: The empty invalid name for invalid, out-of-range, or unassigned IDs. .. index:: pair: function; getOrCreateId .. _doxid-class_e_e_1_1_u_i_1_1_c_s_s_1_1_id_name_map_1aaa299a3f31f5a5897554270751ee34f8: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Id` getOrCreateId(const std::string& canonicalName) Returns the existing ID for a canonical name, or allocates a new custom ID. Only valid after :ref:`finalizeBuiltins() `. Reaching the capacity returns Invalid and logs a clear error containing the rejected name.