mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-19 03:39:08 +00:00
Updates to plUUID for Linux & Windows.
Includes linking against libuuid on Linux.
This commit is contained in:
@ -17,6 +17,10 @@ set(plUUID_HEADERS
|
|||||||
)
|
)
|
||||||
|
|
||||||
add_library(plUUID STATIC ${plUUID_SOURCES} ${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("Source Files" FILES ${plUUID_SOURCES})
|
||||||
source_group("Header Files" FILES ${plUUID_HEADERS})
|
source_group("Header Files" FILES ${plUUID_HEADERS})
|
||||||
|
@ -42,8 +42,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
#include "plUUID.h"
|
#include "plUUID.h"
|
||||||
#include "hsStream.h"
|
#include "hsStream.h"
|
||||||
|
|
||||||
COMPILER_ASSERT(msizeof(Uuid, data) == msizeof(plUUID, fData));
|
|
||||||
|
|
||||||
plUUID::plUUID()
|
plUUID::plUUID()
|
||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
@ -59,11 +57,6 @@ plUUID::plUUID( const plUUID & other )
|
|||||||
CopyFrom( &other );
|
CopyFrom( &other );
|
||||||
}
|
}
|
||||||
|
|
||||||
plUUID::plUUID( const Uuid & uuid )
|
|
||||||
{
|
|
||||||
MemCopy(fData, uuid.data, sizeof(fData));
|
|
||||||
}
|
|
||||||
|
|
||||||
void plUUID::Read( hsStream * s)
|
void plUUID::Read( hsStream * s)
|
||||||
{
|
{
|
||||||
s->LogSubStreamPushDesc("plUUID");
|
s->LogSubStreamPushDesc("plUUID");
|
||||||
@ -75,29 +68,12 @@ void plUUID::Write( hsStream * s)
|
|||||||
s->Write( sizeof( fData ), (const void*)fData );
|
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 {
|
const char * plUUID::AsString() const {
|
||||||
static std::string str;
|
static std::string str;
|
||||||
ToStdString(str);
|
ToStdString(str);
|
||||||
return str.c_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
|
* plCreatableUuid
|
||||||
|
@ -44,7 +44,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
|
|
||||||
#include "hsTypes.h"
|
#include "hsTypes.h"
|
||||||
#include "hsStlUtils.h"
|
#include "hsStlUtils.h"
|
||||||
|
#ifdef HS_BUILD_FOR_WIN32
|
||||||
#include "pnUtils/pnUtils.h"
|
#include "pnUtils/pnUtils.h"
|
||||||
|
#endif
|
||||||
#include "pnFactory/plCreatable.h"
|
#include "pnFactory/plCreatable.h"
|
||||||
|
|
||||||
class hsStream;
|
class hsStream;
|
||||||
@ -64,7 +66,9 @@ public:
|
|||||||
plUUID();
|
plUUID();
|
||||||
plUUID( const char * s );
|
plUUID( const char * s );
|
||||||
plUUID( const plUUID & other );
|
plUUID( const plUUID & other );
|
||||||
|
#ifdef HS_BUILD_FOR_WIN32
|
||||||
plUUID( const Uuid & uuid );
|
plUUID( const Uuid & uuid );
|
||||||
|
#endif
|
||||||
void Clear();
|
void Clear();
|
||||||
bool IsNull() const;
|
bool IsNull() const;
|
||||||
bool IsSet() const { return !IsNull(); }
|
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 ); }
|
||||||
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 ); }
|
int operator <( const plUUID & other ) const { return CompareTo( &other ); }
|
||||||
|
#ifdef HS_BUILD_FOR_WIN32
|
||||||
operator Uuid () const;
|
operator Uuid () const;
|
||||||
|
#endif
|
||||||
|
|
||||||
static plUUID Generate();
|
static plUUID Generate();
|
||||||
};
|
};
|
||||||
|
@ -47,6 +47,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
#include "hsWindows.h"
|
#include "hsWindows.h"
|
||||||
#include <rpc.h>
|
#include <rpc.h>
|
||||||
|
|
||||||
|
COMPILER_ASSERT(msizeof(Uuid, data) == msizeof(plUUID, fData));
|
||||||
|
|
||||||
|
plUUID::plUUID( const Uuid & uuid )
|
||||||
|
{
|
||||||
|
MemCopy(fData, uuid.data, sizeof(fData));
|
||||||
|
}
|
||||||
|
|
||||||
void plUUID::Clear()
|
void plUUID::Clear()
|
||||||
{
|
{
|
||||||
UuidCreateNil( (GUID *)this );
|
UuidCreateNil( (GUID *)this );
|
||||||
@ -69,6 +76,23 @@ bool plUUID::IsNull() const
|
|||||||
return 1 == UuidIsNil( (GUID *)this, &s );
|
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 )
|
bool plUUID::FromString( const char * str )
|
||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
|
Reference in New Issue
Block a user