Class endstone::Object¶
Base class providing runtime type identification and safe casting. More...
#include <endstone/object.h>
Inherited by the following classes: endstone::ItemMeta, endstone::Permissible
Public Functions¶
| Type | Name |
|---|---|
| T * | as () Attempts to cast this object to the given type T. |
| const T * | as () const Attempts to cast this object to the given type T. |
| virtual const std::type_info & | getClassTypeId () const = 0 |
| bool | is () const Checks if this object is an instance of the given type T (or a subclass of T). |
| virtual bool | isInstanceOf (const std::type_info & target) const = 0 |
| virtual | ~Object () = default |
Detailed Description¶
All endstone types that support runtime type narrowing (e.g., Permissible, ItemMeta) inherit from Object. Subclasses implement getClassTypeId() and isInstanceOf(), and the type hierarchy is registered with entt::meta at startup.
Public Functions Documentation¶
function as [½]¶
Attempts to cast this object to the given type T.
Returns nullptr if this object is not an instance of T (or a subclass of T).
Template parameters:
TTarget type to cast to (must derive from Object)
Returns:
Pointer to this as T, or nullptr if the cast is invalid
function as [2/2]¶
Attempts to cast this object to the given type T.
Returns nullptr if this object is not an instance of T (or a subclass of T).
Template parameters:
TTarget type to cast to (must derive from Object)
Returns:
Pointer to this as T, or nullptr if the cast is invalid
function getClassTypeId¶
function is¶
Checks if this object is an instance of the given type T (or a subclass of T).
Template parameters:
TType to check against (must derive from Object)
Returns:
True if this object is an instance of T
function isInstanceOf¶
function ~Object¶
The documentation for this class was generated from the following file include/endstone/object.h