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

#include <componentresourcepath.h>

Public Member Functions

 ComponentResourcePath ()=default
 
 ComponentResourcePath (const Entity &root)
 
const EntitygetRoot () const
 
void push (int childIndex)
 
void pop ()
 
void pushComponent (const std::string &component)
 
void popComponent ()
 
bool operator== (const ComponentResourcePath &other) const
 

Static Public Member Functions

static bool fromString (const Entity &root, const std::string &path, ComponentResourcePath &resolvedPath, utility::ErrorState &errorState)
 

Description

Represents a path to a component in an entity hierarchy.

Constructor & Destructor Documentation

◆ ComponentResourcePath() [1/2]

ComponentResourcePath ( )
default

◆ ComponentResourcePath() [2/2]

ComponentResourcePath ( const Entity root)

Member Function Documentation

◆ fromString()

static bool fromString ( const Entity root,
const std::string &  path,
ComponentResourcePath resolvedPath,
utility::ErrorState errorState 
)
static

Creates an EntityResourcePath from a root entity and a string.

Parameters
rootThe root entity that is used by path.
pathThe string containing the path from root to the component. This path includes the name of the component.
resolvedPathIf the function returns true, this parameter contains the created EntityResourcePath.
errorStatecontains error information on failure.
Returns
true on success, false on failure. If the function return false, check errorState for information.

◆ getRoot()

const Entity& getRoot ( ) const
Returns
the root entity in the hierarchy.

◆ operator==()

bool operator== ( const ComponentResourcePath other) const

Compares on EntityResourcePath to another.

Returns
True when equal, false otherwise.

◆ pop()

void pop ( )

Pops the last child entity from the path.

◆ popComponent()

void popComponent ( )

Pops the component from the path.

◆ push()

void push ( int  childIndex)

Pushes a child entity onto the path.

Parameters
childIndexThe absolute index of this child in the entity child array of the parent.

◆ pushComponent()

void pushComponent ( const std::string &  component)

Pushes the last item, the component, onto the path.

Parameters
componentID of the component to push onto the path.