struct hiro::ResourceId
Overview
Unique identifier for every Resource object. More…
#include <ResourceId.h> struct ResourceId { // fields static const hiro::ResourceId INVALID; std::string name { "" }; std::string category { "" }; // construction ResourceId(); ResourceId(const std::string& name, const std::string& categ); ResourceId(const std::string& string_id); // methods std::string ToString() const; bool IsValid() const; void Invalidate(); std::string GetNameWithoutPath() const; std::string GetNamePath() const; bool operator==(const hiro::ResourceId& other) const; bool operator!=(const hiro::ResourceId& other) const; bool operator<(const hiro::ResourceId& other) const; };
Detailed Documentation
Unique identifier for every Resource object.
Name of identifier can be composed of a hierarchy, where each hierarchy object is separated by “/”. For example “group/subgroup/item”. Can be equivalently represented by an id string in format “category:name”.
Fields
static const hiro::ResourceId INVALID
Denotes invalid identifier.
std::string name { "" }
Name of a specific Resource.
std::string category { "" }
Unique identifier for each Resource class derivate.
Construction
ResourceId()
Creates an invalid identifier.
ResourceId(const std::string& name, const std::string& categ)
Creates an identifier with specified name and category.
ResourceId(const std::string& string_id)
Creates an identifier from id string.
Methods
std::string ToString() const
Converts this to id string.
bool IsValid() const
Checks if this is a valid identifier.
void Invalidate()
Makes this identifier invalid.
std::string GetNameWithoutPath() const
Returns name stripped of hierarchy.
For example, returns “item” when full name is “group/subgroup/item”.
std::string GetNamePath() const
Returns only hierarchy without a name.
For example, returns “group/subgroup” when full name is “group/subgroup/item”.
bool operator==(const hiro::ResourceId& other) const
Checks whether the provided identifier is equivalent.
bool operator!=(const hiro::ResourceId& other) const
Checks whether the provided identifier is different.
bool operator<(const hiro::ResourceId& other) const
Checks whether the provided identifier ordering rank is higher.