diff --git a/Sources/Plasma/PubUtilLib/plUUID/CMakeLists.txt b/Sources/Plasma/PubUtilLib/plUUID/CMakeLists.txt index 99eaca4c..53e01fcc 100644 --- a/Sources/Plasma/PubUtilLib/plUUID/CMakeLists.txt +++ b/Sources/Plasma/PubUtilLib/plUUID/CMakeLists.txt @@ -17,6 +17,10 @@ set(plUUID_HEADERS ) add_library(plUUID STATIC ${plUUID_SOURCES} ${plUUID_HEADERS}) +target_link_libraries(plUUID pnFactory) +if(NOT WIN32) + target_link_libraries(plUUID uuid) +endif(NOT WIN32) source_group("Source Files" FILES ${plUUID_SOURCES}) source_group("Header Files" FILES ${plUUID_HEADERS}) diff --git a/Sources/Plasma/PubUtilLib/plUUID/plUUID.cpp b/Sources/Plasma/PubUtilLib/plUUID/plUUID.cpp index 6531fc22..6dfd79da 100644 --- a/Sources/Plasma/PubUtilLib/plUUID/plUUID.cpp +++ b/Sources/Plasma/PubUtilLib/plUUID/plUUID.cpp @@ -42,8 +42,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plUUID.h" #include "hsStream.h" -COMPILER_ASSERT(msizeof(Uuid, data) == msizeof(plUUID, fData)); - plUUID::plUUID() { Clear(); @@ -59,11 +57,6 @@ plUUID::plUUID( const plUUID & other ) CopyFrom( &other ); } -plUUID::plUUID( const Uuid & uuid ) -{ - MemCopy(fData, uuid.data, sizeof(fData)); -} - void plUUID::Read( hsStream * s) { s->LogSubStreamPushDesc("plUUID"); @@ -75,29 +68,12 @@ void plUUID::Write( hsStream * s) s->Write( sizeof( fData ), (const void*)fData ); } -plUUID::operator Uuid () const { - Uuid uuid; - MemCopy(uuid.data, fData, sizeof(uuid.data)); - return uuid; -} - const char * plUUID::AsString() const { static std::string str; ToStdString(str); return str.c_str(); } -void plUUID::CopyFrom( const plUUID * v ) { - if (!v) - Clear(); - else - CopyFrom(*v); -} - -void plUUID::CopyFrom( const plUUID & v ) { - MemCopy(fData, v.fData, sizeof(fData)); -} - /***************************************************************************** * * plCreatableUuid diff --git a/Sources/Plasma/PubUtilLib/plUUID/plUUID.h b/Sources/Plasma/PubUtilLib/plUUID/plUUID.h index a297e826..bf780949 100644 --- a/Sources/Plasma/PubUtilLib/plUUID/plUUID.h +++ b/Sources/Plasma/PubUtilLib/plUUID/plUUID.h @@ -44,7 +44,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsTypes.h" #include "hsStlUtils.h" +#ifdef HS_BUILD_FOR_WIN32 #include "pnUtils/pnUtils.h" +#endif #include "pnFactory/plCreatable.h" class hsStream; @@ -64,7 +66,9 @@ public: plUUID(); plUUID( const char * s ); plUUID( const plUUID & other ); +#ifdef HS_BUILD_FOR_WIN32 plUUID( const Uuid & uuid ); +#endif void Clear(); bool IsNull() const; bool IsSet() const { return !IsNull(); } @@ -82,7 +86,9 @@ public: bool operator==( const plUUID & other ) const { return IsEqualTo( &other ); } bool operator!=( const plUUID & other ) const { return !IsEqualTo( &other ); } int operator <( const plUUID & other ) const { return CompareTo( &other ); } +#ifdef HS_BUILD_FOR_WIN32 operator Uuid () const; +#endif static plUUID Generate(); }; diff --git a/Sources/Plasma/PubUtilLib/plUUID/plUUID_Win32.cpp b/Sources/Plasma/PubUtilLib/plUUID/plUUID_Win32.cpp index 54853bf4..c7724540 100644 --- a/Sources/Plasma/PubUtilLib/plUUID/plUUID_Win32.cpp +++ b/Sources/Plasma/PubUtilLib/plUUID/plUUID_Win32.cpp @@ -47,6 +47,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsWindows.h" #include +COMPILER_ASSERT(msizeof(Uuid, data) == msizeof(plUUID, fData)); + +plUUID::plUUID( const Uuid & uuid ) +{ + MemCopy(fData, uuid.data, sizeof(fData)); +} + void plUUID::Clear() { UuidCreateNil( (GUID *)this ); @@ -69,6 +76,23 @@ bool plUUID::IsNull() const return 1 == UuidIsNil( (GUID *)this, &s ); } +void plUUID::CopyFrom( const plUUID * v ) { + if (!v) + Clear(); + else + CopyFrom(*v); +} + +void plUUID::CopyFrom( const plUUID & v ) { + MemCopy(fData, v.fData, sizeof(fData)); +} + +plUUID::operator Uuid () const { + Uuid uuid; + MemCopy(uuid.data, fData, sizeof(uuid.data)); + return uuid; +} + bool plUUID::FromString( const char * str ) { Clear();