Definition at line 18 of file identity_component.h.
◆ IdentityComponent() [1/3]
ecs::IdentityComponent::IdentityComponent |
( |
| ) |
|
|
inline |
◆ IdentityComponent() [2/3]
ecs::IdentityComponent::IdentityComponent |
( |
int | id | ) |
|
|
inlineexplicit |
◆ IdentityComponent() [3/3]
ecs::IdentityComponent::IdentityComponent |
( |
int | id, |
|
|
const std::string & | name ) |
|
inline |
Definition at line 25 of file identity_component.h.
25: m_id(id), m_name(name), m_type(ObjectType::Unknown) {}
◆ GetId()
int ecs::IdentityComponent::GetId |
( |
| ) |
const |
|
inline |
Get the ID stored by the component.
- Returns
- The ID as an int.
Definition at line 40 of file identity_component.h.
◆ GetName()
const std::string & ecs::IdentityComponent::GetName |
( |
| ) |
const |
|
inline |
◆ GetType()
ObjectType ecs::IdentityComponent::GetType |
( |
| ) |
const |
|
inline |
Get the type of the object.
- Returns
- The type as an ObjectType enum.
Definition at line 62 of file identity_component.h.
◆ Initialize()
void ecs::IdentityComponent::Initialize |
( |
| ) |
|
|
inlineoverridevirtual |
Initialize the component. This method is called when the component is added to an entity. It can be used to set up initial values or perform any necessary setup.
Reimplemented from ecs::Component.
Definition at line 33 of file identity_component.h.
◆ ObjectTypeToString()
static std::string ecs::IdentityComponent::ObjectTypeToString |
( |
ObjectType | type | ) |
|
|
inlinestatic |
Convert an ObjectType to a string representation.
- Parameters
-
type | The ObjectType to convert. |
- Returns
- A string representation of the ObjectType.
Definition at line 74 of file identity_component.h.
74 {
75 switch (type) {
76 case ObjectType::Cube: return "Cube";
77 case ObjectType::Sphere: return "Sphere";
78 case ObjectType::Terrain: return "Terrain";
79 default: return "Unknown";
80 }
81 }
◆ SetId()
void ecs::IdentityComponent::SetId |
( |
int | id | ) |
|
|
inline |
◆ SetName()
void ecs::IdentityComponent::SetName |
( |
const std::string & | name | ) |
|
|
inline |
◆ SetType()
void ecs::IdentityComponent::SetType |
( |
ObjectType | type | ) |
|
|
inline |
Set the type of the object.
- Parameters
-
type | The type to set as an ObjectType enum. |
Definition at line 67 of file identity_component.h.
◆ StringToObjectType()
static ObjectType ecs::IdentityComponent::StringToObjectType |
( |
const std::string & | str | ) |
|
|
inlinestatic |
Convert a string representation to an ObjectType.
- Parameters
-
str | The string to convert. |
- Returns
- The corresponding ObjectType, or Unknown if the string does not match any type.
Definition at line 88 of file identity_component.h.
88 {
89 if (str == "Cube") return ObjectType::Cube;
90 if (str == "Sphere") return ObjectType::Sphere;
91 if (str == "Terrain") return ObjectType::Terrain;
92 return ObjectType::Unknown;
93 }
The documentation for this class was generated from the following file: