NAP
Public Member Functions | Static Public Member Functions | List of all members
EntityPtr Class Reference

#include <entityptr.h>

Public Member Functions

 EntityPtr ()=default
 
 EntityPtr (Entity *entity)
 
const std::string & getInstancePath () const
 
std::string toString () const
 
EntitytoObject () const
 
void assign (const std::string &targetPath, rtti::Object *targetObject)
 
Entityget () const
 
Entityget ()
 
const Entityoperator* () const
 
Entityoperator* ()
 
const Entityoperator-> () const
 
Entityoperator-> ()
 
bool operator== (const EntityPtr &other) const
 
bool operator== (std::nullptr_t) const
 
bool operator!= (const EntityPtr &other) const
 
bool operator!= (std::nullptr_t) const
 
bool operator< (const EntityPtr &other) const
 
bool operator> (const EntityPtr &other) const
 
bool operator<= (const EntityPtr &other) const
 
bool operator>= (const EntityPtr &other) const
 

Static Public Member Functions

static std::string translateTargetID (const std::string &targetID)
 

Description

Stores the path and the pointer to the target entity.

Constructor & Destructor Documentation

◆ EntityPtr() [1/2]

EntityPtr ( )
default

◆ EntityPtr() [2/2]

EntityPtr ( Entity entity)

Member Function Documentation

◆ assign()

void assign ( const std::string &  targetPath,
rtti::Object targetObject 
)

Assign the path to the entity (including ID) and object to this pointer. Used for pointer resolving by the ResourceManager. Should not be called manually (is only public so that we can register it in RTTI)

Parameters
targetPathThe path including ID to the target entity, empty to clear
targetObjectThe entity to assign, nullptr to clear

◆ get() [1/2]

Entity* get ( )
Returns
the (raw) pointer of the target entity

◆ get() [2/2]

Entity* get ( ) const
Returns
the (raw) pointer to the target entity

◆ getInstancePath()

const std::string& getInstancePath ( ) const
Returns
Path to the entity

◆ operator!=() [1/2]

bool operator!= ( const EntityPtr other) const

◆ operator!=() [2/2]

bool operator!= ( std::nullptr_t  ) const

◆ operator*() [1/2]

Entity& operator* ( )

◆ operator*() [2/2]

const Entity& operator* ( ) const

◆ operator->() [1/2]

Entity* operator-> ( )

◆ operator->() [2/2]

const Entity* operator-> ( ) const

◆ operator<()

bool operator< ( const EntityPtr other) const

◆ operator<=()

bool operator<= ( const EntityPtr other) const

◆ operator==() [1/2]

bool operator== ( const EntityPtr other) const

◆ operator==() [2/2]

bool operator== ( std::nullptr_t  ) const

◆ operator>()

bool operator> ( const EntityPtr other) const

◆ operator>=()

bool operator>= ( const EntityPtr other) const

◆ toObject()

Entity* toObject ( ) const

Returns the assigned entity

Returns
The rtti object, nullptr if it doesn't exist

◆ toString()

std::string toString ( ) const

Convert the pointer to a string for serialization

Returns
The string representation of this object

◆ translateTargetID()

static std::string translateTargetID ( const std::string &  targetID)
static

Convert the full target ID as specified to an ID that can be resolved to an object

Parameters
targetIDThe target ID to translate
Returns
The translated ID