diff --git a/Ref.h b/Ref.h index 88a0ccd37f90e51d44bceec47ae30f9a17620211..4e7b6d9aad42f92d64e7db4871837b94e5656108 100644 --- a/Ref.h +++ b/Ref.h @@ -153,7 +153,7 @@ bool Ref<T>::operator!=(const Ref & ref) const { template <class T> ostream & operator<<(ostream & os, const Ref<T> & ref) { if (ref._object) - os << ref._object << "(" << ref._object->GetType().GetTypeName() << ")"; + os << ref->GetIDString(); else os << "NULL"; return os; diff --git a/obj/NiObject.cpp b/obj/NiObject.cpp index 1355b011cb2061175f05f46a04f602d561da743b..781a52e5f24cfda6153b814e4671a3aa0641b949 100644 --- a/obj/NiObject.cpp +++ b/obj/NiObject.cpp @@ -58,3 +58,9 @@ list<NiObjectRef> NiObject::GetLinks() { return list<NiObjectRef>(); } +/*! Used to format a human readable string that includes the type of the object */ +string NiObject::GetIDString() { + stringstream out; + out << this << "(" << this->GetType().GetTypeName() << ")"; + return out.str(); +} \ No newline at end of file diff --git a/obj/NiObject.h b/obj/NiObject.h index ecea0262bb8116f47cf2ac0f7e3b2cdebe8a8995..1814d39e9e53f1516649128974b5d2c49d583db5 100644 --- a/obj/NiObject.h +++ b/obj/NiObject.h @@ -100,6 +100,9 @@ public: */ virtual string asString( bool verbose = false ) const; + /*! Formats a human readable string that includes the type of the object */ + virtual string GetIDString(); + /*! * Used to retrieve all blocks that the current block is linked to through <i>all</i> attributes. * \return A list of references to blocks that this attribute links its owner block to. diff --git a/obj/NiObjectNET.cpp b/obj/NiObjectNET.cpp index 8ee930917edbd6fe0ffbd6e9cdb46338125315f2..03fec1cd00b0628e2300d929eabbfaf6f7f98a11 100644 --- a/obj/NiObjectNET.cpp +++ b/obj/NiObjectNET.cpp @@ -36,3 +36,10 @@ void NiObjectNET::SetName( string & new_name ) { name = new_name; } +/*! Used to format a human readable string that includes the type of the object */ +string NiObjectNET::GetIDString() { + stringstream out; + out << NiObject::GetIDString() << " {" << name << "}"; + return out.str(); +} + diff --git a/obj/NiObjectNET.h b/obj/NiObjectNET.h index 52f701ac97e7d9dd44844db61f53c7088a7f417a..1d8753ec81383128cc064ec5e315c8152f9573bc 100644 --- a/obj/NiObjectNET.h +++ b/obj/NiObjectNET.h @@ -28,6 +28,8 @@ public: virtual void Read( istream& in, list<uint> & link_stack, unsigned int version ); virtual void Write( ostream& out, map<NiObjectRef,uint> link_map, unsigned int version ) const; virtual string asString( bool verbose = false ) const; + /*! Formats a human readable string that includes the type and name of the object */ + virtual string GetIDString(); virtual void FixLinks( const vector<NiObjectRef> & objects, list<uint> & link_stack, unsigned int version ); string GetName();