1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-18 19:29:09 +00:00

Move plUUID to pnUUID.

--HG--
rename : Sources/Plasma/PubUtilLib/plUUID/plUUID.cpp => Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp
rename : Sources/Plasma/PubUtilLib/plUUID/plUUID.h => Sources/Plasma/NucleusLib/pnUUID/pnUUID.h
rename : Sources/Plasma/PubUtilLib/plUUID/plUUID_Unix.cpp => Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp
rename : Sources/Plasma/PubUtilLib/plUUID/plUUID_Win32.cpp => Sources/Plasma/NucleusLib/pnUUID/pnUUID_Win32.cpp
This commit is contained in:
Darryl Pogue
2011-10-25 23:40:13 -07:00
parent f085087c23
commit 8a28ba9e89
21 changed files with 101 additions and 52 deletions

View File

@ -48,5 +48,4 @@ add_subdirectory(plStreamLogger)
add_subdirectory(plSurface)
add_subdirectory(plTransform)
add_subdirectory(plUnifiedTime)
add_subdirectory(plUUID)
add_subdirectory(plVault)

View File

@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plAgeDescription/plAgeDescription.h"
#include "plUUID/plUUID.h"
#include "pnUUID/pnUUID.h"
//
// A singleton class which manages loading and unloading ages and operations associated with that

View File

@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define plLoadAgeMsg_INC
#include "pnMessage/plMessage.h"
#include "plUUID/plUUID.h"
#include "pnUUID/pnUUID.h"
#include "hsUtils.h"
//

View File

@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsConfig.h"
#include "hsStlUtils.h"
#include "pnFactory/plCreatable.h"
#include "plUUID/plUUID.h"
#include "pnUUID/pnUUID.h"
class plClientGuid : public plCreatable
{

View File

@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/
#include "plNetCommon.h"
#include "hsStlUtils.h"
#include "plUUID/plUUID.h"
#include "pnUUID/pnUUID.h"
#include <algorithm>
namespace plNetCommon

View File

@ -55,10 +55,6 @@ REGISTER_CREATABLE( plNetCoreStatsSummary );
#endif // SERVER
REGISTER_CREATABLE( plCreatableListHelper );
// HACK: plUUID should have it's own creatable include
#include "../plUUID/plUUID.h"
REGISTER_CREATABLE( plCreatableUuid );
#include "plClientGuid.h"
REGISTER_CREATABLE( plClientGuid );
#include "plNetServerSessionInfo.h"

View File

@ -47,7 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "pnFactory/plCreatable.h"
#include "pnNetCommon/plNetServers.h"
#include "plNetCommon/plSpawnPointInfo.h"
#include "plUUID/plUUID.h"
#include "pnUUID/pnUUID.h"
class hsStream;

View File

@ -1,26 +0,0 @@
include_directories("../../CoreLib")
include_directories("../../NucleusLib")
include_directories("../../PubUtilLib")
set(plUUID_SOURCES
plUUID.cpp
)
if(WIN32)
set(plUUID_SOURCES ${plUUID_SOURCES} plUUID_Win32.cpp)
else(WIN32)
set(plUUID_SOURCES ${plUUID_SOURCES} plUUID_Unix.cpp)
endif(WIN32)
set(plUUID_HEADERS
plUUID.h
)
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})

View File

@ -1,97 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "plUUID.h"
#include "hsStream.h"
plUUID::plUUID()
{
Clear();
}
plUUID::plUUID( const char * s )
{
FromString( s );
}
plUUID::plUUID( const plUUID & other )
{
CopyFrom( &other );
}
void plUUID::Read( hsStream * s)
{
s->LogSubStreamPushDesc("plUUID");
s->Read( sizeof( fData ), (void*)fData );
}
void plUUID::Write( hsStream * s)
{
s->Write( sizeof( fData ), (const void*)fData );
}
const char * plUUID::AsString() const {
static std::string str;
ToStdString(str);
return str.c_str();
}
/*****************************************************************************
*
* plCreatableUuid
*
***/
//============================================================================
plCreatableUuid::plCreatableUuid () {
}
//============================================================================
plCreatableUuid::plCreatableUuid (const plCreatableUuid & other)
: plUUID(other)
{
}
//============================================================================
plCreatableUuid::plCreatableUuid (const plUUID & other)
: plUUID(other)
{
}

View File

@ -1,110 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#ifndef plUUID_h_inc
#define plUUID_h_inc
#include "hsTypes.h"
#include "hsStlUtils.h"
#ifdef HS_BUILD_FOR_WIN32
#include "pnUtils/pnUtils.h"
#endif
#include "pnFactory/plCreatable.h"
class hsStream;
class plUUID
{
// must be first field in class
public:
UInt8 fData[16];
struct Match
{
const plUUID * fGuid;
Match( const plUUID * guid ):fGuid( guid ){}
bool operator()( const plUUID * guid ) const { return guid->IsEqualTo( fGuid );}
};
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(); }
void CopyFrom( const plUUID * v );
void CopyFrom( const plUUID & v );
int CompareTo( const plUUID * v ) const;
bool IsEqualTo( const plUUID * v ) const;
bool FromString( const char * str );
bool ToStdString( std::string & out ) const;
inline std::string AsStdString() const { return AsString(); }
const char * AsString() const; // returns static buffer
void Read( hsStream * s );
void Write( hsStream * s );
operator std::string ( void ) const { return AsStdString();}
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();
};
class plCreatableUuid : public plUUID, public plCreatable {
public:
CLASSNAME_REGISTER( plCreatableUuid );
GETINTERFACE_ANY( plCreatableUuid, plCreatable );
plCreatableUuid ();
plCreatableUuid (const plCreatableUuid & other);
plCreatableUuid (const plUUID & other);
void Read( hsStream * s, hsResMgr* ) { plUUID::Read(s); }
void Write( hsStream * s, hsResMgr* ) { plUUID::Write(s); }
};
#endif // plUUID_h_inc

View File

@ -1,137 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "plUUID.h"
#ifdef HS_BUILD_FOR_UNIX
#include <uuid/uuid.h>
struct plUUIDHelper
{
static inline void CopyToPlasma( plUUID * dst, const uuid_t & src )
{
hsAssert( sizeof(uuid_t)==sizeof(dst->fData), "sizeof(uuid_t)!=sizeof(plUUID)" );
memcpy( (void*)dst->fData, (const void *)src, sizeof( plUUID ) );
}
static inline void CopyToNative( uuid_t & dst, const plUUID * src )
{
hsAssert( sizeof(uuid_t)==sizeof(src->fData), "sizeof(uuid_t)!=sizeof(plUUID)" );
memcpy( (void*)dst, (const void *)src->fData, sizeof( plUUID ) );
}
};
void plUUID::Clear()
{
uuid_t g;
plUUIDHelper::CopyToNative( g, this );
uuid_clear( g );
plUUIDHelper::CopyToPlasma( this, g );
}
bool plUUID::IsNull() const
{
uuid_t g;
plUUIDHelper::CopyToNative( g, this );
return ( uuid_is_null( g )!=0 );
}
void plUUID::CopyFrom( const plUUID * v )
{
memcpy( (void*)fData, (const void*)v->fData, sizeof(fData) );
}
int plUUID::CompareTo( const plUUID * v ) const
{
uuid_t ga, gb;
plUUIDHelper::CopyToNative( ga, this );
plUUIDHelper::CopyToNative( gb, v );
int ans = uuid_compare( ga, gb );
return ans;
}
bool plUUID::IsEqualTo( const plUUID * v ) const
{
return ( CompareTo( v )==0 );
}
bool plUUID::FromString( const char * str )
{
Clear();
if ( !str )
return false;
uuid_t g;
uuid_parse( str, g );
plUUIDHelper::CopyToPlasma( this, g );
return true;
}
bool plUUID::ToStdString( std::string & out ) const
{
uuid_t g;
plUUIDHelper::CopyToNative( g, this );
char buf[40];
uuid_unparse( g, buf );
out = buf;
return true;
}
// static
plUUID plUUID::Generate()
{
uuid_t g;
uuid_generate( g );
plUUID result;
plUUIDHelper::CopyToPlasma( &result, g );
return result;
}
#else
// dummy function to prevent a linker warning complaining about no public symbols if the
// contents of the file get compiled out via pre-processor
void _preventLNK4221WarningStub()
{
}
#endif

View File

@ -1,126 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "plUUID.h"
#ifdef HS_BUILD_FOR_WIN32
#include "hsUtils.h"
#include "hsWindows.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()
{
UuidCreateNil( (GUID *)this );
}
int plUUID::CompareTo( const plUUID * v ) const
{
RPC_STATUS s;
return UuidCompare( (GUID *)this, (GUID *)v, &s );
}
bool plUUID::IsEqualTo( const plUUID * v ) const
{
return ( CompareTo( v )==0 );
}
bool plUUID::IsNull() const
{
RPC_STATUS 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 )
{
Clear();
if ( !str )
return false;
return RPC_S_OK == UuidFromString( (unsigned char *)str, (GUID *)this );
}
bool plUUID::ToStdString( std::string & out ) const
{
out = "";
unsigned char * ubuf;
RPC_STATUS s;
s = UuidToString( (GUID *) this, &ubuf );
bool success = ( s==RPC_S_OK );
if ( success )
out = (char*)ubuf;
RpcStringFree( &ubuf );
return success;
}
// static
plUUID plUUID::Generate()
{
hsAssert(sizeof(plUUID) >= sizeof(GUID), "plUUID size");
plUUID result;
UuidCreate( (GUID *)&result );
return result;
}
#endif