Ndk/EntityHandle: Add ToString() method
Former-commit-id: b99c515e893c6363f030ffdd18925e92870e9361
This commit is contained in:
parent
6fa143d7a8
commit
ea66d01246
|
|
@ -33,6 +33,8 @@ namespace Ndk
|
||||||
|
|
||||||
EntityHandle& Swap(EntityHandle& handle);
|
EntityHandle& Swap(EntityHandle& handle);
|
||||||
|
|
||||||
|
NzString ToString() const;
|
||||||
|
|
||||||
operator bool() const;
|
operator bool() const;
|
||||||
operator Entity*() const;
|
operator Entity*() const;
|
||||||
Entity* operator->() const;
|
Entity* operator->() const;
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
// This file is part of the "Nazara Development Kit"
|
// This file is part of the "Nazara Development Kit"
|
||||||
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
|
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
|
||||||
|
|
||||||
|
#include <Nazara/Core/StringStream.hpp>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
|
@ -89,6 +90,20 @@ namespace Ndk
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline NzString EntityHandle::ToString() const
|
||||||
|
{
|
||||||
|
NzStringStream ss;
|
||||||
|
ss << "EntityHandle(";
|
||||||
|
if (IsValid())
|
||||||
|
ss << "Entity(" << m_entity->GetId() << ')';
|
||||||
|
else
|
||||||
|
ss << "Null entity";
|
||||||
|
|
||||||
|
ss << ')';
|
||||||
|
|
||||||
|
return ss;
|
||||||
|
}
|
||||||
|
|
||||||
inline EntityHandle::operator bool() const
|
inline EntityHandle::operator bool() const
|
||||||
{
|
{
|
||||||
return IsValid();
|
return IsValid();
|
||||||
|
|
@ -143,7 +158,7 @@ namespace Ndk
|
||||||
{
|
{
|
||||||
out << "EntityHandle(";
|
out << "EntityHandle(";
|
||||||
if (handle.IsValid())
|
if (handle.IsValid())
|
||||||
out << "Entity(" << handle->GetId() << ")";
|
out << "Entity(" << handle->GetId() << ')';
|
||||||
else
|
else
|
||||||
out << "Null entity";
|
out << "Null entity";
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue