Selaa lähdekoodia

doc: multi meta type support

skypjack 4 päivää sitten
vanhempi
commit
880cb4c6d7
2 muutettua tiedostoa jossa 18 lisäystä ja 6 poistoa
  1. 0 1
      TODO
  2. 18 5
      docs/md/meta.md

+ 0 - 1
TODO

@@ -32,5 +32,4 @@ TODO:
 * make meta_any buffer size configurable (propagate to any)
 * make meta_any buffer size configurable (propagate to any)
 * test trivially_destructible optimization
 * test trivially_destructible optimization
 * try to fully support uint16_t for entity types
 * try to fully support uint16_t for entity types
-* document new meta multi support (md)
 * finish the imgui viewer/editor!
 * finish the imgui viewer/editor!

+ 18 - 5
docs/md/meta.md

@@ -77,18 +77,31 @@ type.
 
 
 By default, a meta type is associated with the identifier returned by the
 By default, a meta type is associated with the identifier returned by the
 runtime type identification system built-in in `EnTT`.<br/>
 runtime type identification system built-in in `EnTT`.<br/>
-However, it is also possible to assign custom identifiers to meta types:
+However, it is also possible to assign custom identifiers upon registration to
+meta types:
+
+```cpp
+entt::meta_factory<my_type>{"reflected_type"_hs};
+```
+
+By doing this, the type based lookup no longer finds the specified meta type.
+Instead, only the identifier based lookup returns with success.<br/>
+For the same reason, it is also possible to create multiple meta types for the
+same C++ type.
+
+In addition to identifiers, users can assign _aliases_ to meta types. An alias
+must be unique and not conflict with existing identifiers.<br/>
+Meta type lookup attempts to resolve identifiers via _aliases_ if there is no
+matching key:
 
 
 ```cpp
 ```cpp
 entt::meta_factory<my_type>{}.type("reflected_type"_hs);
 entt::meta_factory<my_type>{}.type("reflected_type"_hs);
 ```
 ```
 
 
-Identifiers are used instead of the type to _retrieve_ meta types at runtime, if
-necessary.<br/>
 However, users can be interested in adding features to a reflected type so that
 However, users can be interested in adding features to a reflected type so that
 the reflection system can use it correctly under the hood, while they do not
 the reflection system can use it correctly under the hood, while they do not
-want to also make the type _searchable_. In this case, it is sufficient not to
-invoke `type`.
+want to also make the type _searchable_.<br/>
+In this case, it is sufficient not to invoke `type`.
 
 
 A factory is such that all its member functions return the factory itself. It is
 A factory is such that all its member functions return the factory itself. It is
 generally used to create the following:
 generally used to create the following: