diff --git a/Sources/Plasma/CoreLib/plFileSystem.cpp b/Sources/Plasma/CoreLib/plFileSystem.cpp index 61341c78..cf1a7604 100644 --- a/Sources/Plasma/CoreLib/plFileSystem.cpp +++ b/Sources/Plasma/CoreLib/plFileSystem.cpp @@ -199,6 +199,11 @@ plFileName plFileName::Join(const plFileName &base, const plFileName &path) return base.fName + path.fName.Substr(1); } +PL_FORMAT_IMPL(const plFileName &) +{ + return PL_FORMAT_FORWARD(format, value.AsString()); +} + /* plFileInfo */ plFileInfo::plFileInfo(const plFileName &filename) diff --git a/Sources/Plasma/CoreLib/plFileSystem.h b/Sources/Plasma/CoreLib/plFileSystem.h index 07f3d767..8fe89b4f 100644 --- a/Sources/Plasma/CoreLib/plFileSystem.h +++ b/Sources/Plasma/CoreLib/plFileSystem.h @@ -47,6 +47,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include +#include "plFormat.h" + #if HS_BUILD_FOR_WIN32 # define PATH_SEPARATOR '\\' # define PATH_SEPARATOR_STR "\\" @@ -225,6 +227,10 @@ inline plFileName operator+(const char *left, const plFileName &right) { return left + right.AsString(); } +// Shortcut for use in plFormat +PL_FORMAT_TYPE(const plFileName &) + + /** Structure to get information about a file by name. * \sa plFileName */ diff --git a/Sources/Plasma/CoreLib/plFormat.h b/Sources/Plasma/CoreLib/plFormat.h index dc70eced..52116f0e 100644 --- a/Sources/Plasma/CoreLib/plFormat.h +++ b/Sources/Plasma/CoreLib/plFormat.h @@ -144,6 +144,9 @@ namespace plFormat_Private plStringBuffer _impl_plFormat_DataHandler( \ const plFormat_Private::FormatSpec &format, _type value) +#define PL_FORMAT_FORWARD(format, fwd_value) \ + _impl_plFormat_DataHandler((format), (fwd_value)) + PL_FORMAT_TYPE(char) PL_FORMAT_TYPE(wchar_t) PL_FORMAT_TYPE(signed char) diff --git a/Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.cpp b/Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.cpp index 872f70a8..2660c1ab 100644 --- a/Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.cpp +++ b/Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.cpp @@ -114,7 +114,12 @@ bool plLocation::IsVirtual() const // THIS SHOULD BE FOR DEBUGGING ONLY plString plLocation::StringIze() const // Format to displayable string { - return plString::Format("S0x%xF0x%x", fSequenceNumber, int(fFlags)); + return plFormat("S0x{x}F0x{x}", fSequenceNumber, fFlags); +} + +PL_FORMAT_IMPL(const plLocation &) +{ + return PL_FORMAT_FORWARD(format, value.StringIze()); } plLocation plLocation::MakeReserved(uint32_t number) @@ -261,10 +266,15 @@ plUoid& plUoid::operator=(const plUoid& rhs) // THIS SHOULD BE FOR DEBUGGING ONLY plString plUoid::StringIze() const // Format to displayable string { - return plString::Format("(0x%x:0x%x:%s:C:[%u,%u])", - fLocation.GetSequenceNumber(), - int(fLocation.GetFlags()), - fObjectName.c_str(), - GetClonePlayerID(), + return plFormat("(0x{x}:0x{x}:{}:C:[{},{}])", + fLocation.GetSequenceNumber(), + fLocation.GetFlags(), + fObjectName, + GetClonePlayerID(), GetCloneID()); } + +PL_FORMAT_IMPL(const plUoid &) +{ + return PL_FORMAT_FORWARD(format, value.StringIze()); +} diff --git a/Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.h b/Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.h index 2c0b8051..0c1d7255 100644 --- a/Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.h +++ b/Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.h @@ -57,7 +57,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "HeadSpin.h" #include "plFixedKey.h" #include "plLoadMask.h" -#include "plString.h" +#include "plFormat.h" class hsStream; @@ -144,6 +144,8 @@ public: static const plLocation kInvalidLoc; }; +PL_FORMAT_TYPE(const plLocation &) + //// plUoid ////////////////////////////////////////////////////////////////// class plUoid @@ -198,4 +200,6 @@ protected: plLoadMask fLoadMask; }; +PL_FORMAT_TYPE(const plUoid &) + #endif // plUoid_h_inc diff --git a/Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp b/Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp index 0ace55a7..d9120dd0 100644 --- a/Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp +++ b/Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp @@ -83,3 +83,8 @@ plString plUUID::AsString() const ToString(str); return str; } + +PL_FORMAT_IMPL(const plUUID &) +{ + return PL_FORMAT_FORWARD(format, value.AsString()); +} diff --git a/Sources/Plasma/NucleusLib/pnUUID/pnUUID.h b/Sources/Plasma/NucleusLib/pnUUID/pnUUID.h index 2062b917..d7dce497 100644 --- a/Sources/Plasma/NucleusLib/pnUUID/pnUUID.h +++ b/Sources/Plasma/NucleusLib/pnUUID/pnUUID.h @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define pnUUID_h_inc #include "HeadSpin.h" -#include "plString.h" +#include "plFormat.h" class hsStream; @@ -96,4 +96,6 @@ public: static plUUID Generate(); }; +PL_FORMAT_TYPE(const plUUID &) + #endif // pnUUID_h_inc