EntropyEngine::Core::Debug::INamed
EntropyEngine::Core::Debug::INamed
Section titled “EntropyEngine::Core::Debug::INamed”Interface for objects that support debug naming. More…
#include <INamed.h>
Inherited by EntropyEngine::Core::Debug::Named
Public Functions
Section titled “Public Functions”| Name | |
|---|---|
| virtual | ~INamed() =default |
| virtual void | setName(std::string_view name) =0 Set the debug name for this object. |
| virtual bool | hasName() const Check if this object has a debug name set. |
| virtual std::string_view | getName() const =0 Get the debug name of this object. |
Detailed Description
Section titled “Detailed Description”class EntropyEngine::Core::Debug::INamed;Interface for objects that support debug naming.
Standardizes debug naming across objects. Implement when objects appear in logs, debug output, or profiler traces.
class MyComponent : public INamed { std::string name;public: void setName(std::string_view n) override { name = n; } std::string_view getName() const override { return name; }};
// Meaningful log outputLOG_INFO("Processing component: {}", component->getName());// Output: "Processing component: PlayerHealthUI"Public Functions Documentation
Section titled “Public Functions Documentation”function ~INamed
Section titled “function ~INamed”virtual ~INamed() =defaultfunction setName
Section titled “function setName”virtual void setName( std::string_view name) =0Set the debug name for this object.
Parameters:
- name The debug name to assign (can be empty to clear)
Reimplemented by: EntropyEngine::Core::Debug::Named::setName
Assigns a name for use in logs and debug output. Choose descriptive names that indicate purpose (e.g., “MainMenuUI”, “PlayerHealthBar”).
function hasName
Section titled “function hasName”inline virtual bool hasName() constCheck if this object has a debug name set.
Return: true if a non-empty debug name is set
Useful for conditional formatting with fallback to addresses.
std::string getObjectDescription(const INamed* obj) { if (obj->hasName()) { return std::format("'{}'", obj->getName()); } else { return std::format("<unnamed at {}>", static_cast<const void*>(obj)); }}function getName
Section titled “function getName”virtual std::string_view getName() const =0Get the debug name of this object.
Return: The current debug name (may be empty)
Reimplemented by: EntropyEngine::Core::Debug::Named::getName
Returns the assigned name or empty string if unnamed.
if (object->hasName()) { LOG_INFO("Found object: {}", object->getName());} else { LOG_INFO("Found unnamed object at {}", static_cast<void*>(object));}Updated on 2026-01-26 at 17:14:35 -0500