mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 02:27:40 -04:00
CWE Directory Reorganization
Rearrange directory structure of CWE to be loosely equivalent to the H'uru Plasma repository. Part 1: Movement of directories and files.
This commit is contained in:
121
Sources/Plasma/PubUtilLib/plUUID/plUUID.cpp
Normal file
121
Sources/Plasma/PubUtilLib/plUUID/plUUID.cpp
Normal file
@ -0,0 +1,121 @@
|
||||
/*==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"
|
||||
|
||||
COMPILER_ASSERT(msizeof(Uuid, data) == msizeof(plUUID, fData));
|
||||
|
||||
plUUID::plUUID()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
plUUID::plUUID( const char * s )
|
||||
{
|
||||
FromString( s );
|
||||
}
|
||||
|
||||
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");
|
||||
s->Read( sizeof( fData ), (void*)fData );
|
||||
}
|
||||
|
||||
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
|
||||
*
|
||||
***/
|
||||
|
||||
//============================================================================
|
||||
plCreatableUuid::plCreatableUuid () {
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
plCreatableUuid::plCreatableUuid (const plCreatableUuid & other)
|
||||
: plUUID(other)
|
||||
{
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
plCreatableUuid::plCreatableUuid (const plUUID & other)
|
||||
: plUUID(other)
|
||||
{
|
||||
}
|
104
Sources/Plasma/PubUtilLib/plUUID/plUUID.h
Normal file
104
Sources/Plasma/PubUtilLib/plUUID/plUUID.h
Normal file
@ -0,0 +1,104 @@
|
||||
/*==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"
|
||||
#include "../pnUtils/pnUtils.h"
|
||||
#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 );
|
||||
plUUID( const Uuid & uuid );
|
||||
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 ); }
|
||||
operator Uuid () const;
|
||||
|
||||
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
|
144
Sources/Plasma/PubUtilLib/plUUID/plUUID_Unix.cpp
Normal file
144
Sources/Plasma/PubUtilLib/plUUID/plUUID_Unix.cpp
Normal file
@ -0,0 +1,144 @@
|
||||
/*==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::ToString( std::string & out ) const
|
||||
{
|
||||
uuid_t g;
|
||||
plUUIDHelper::CopyToNative( g, this );
|
||||
char buf[40];
|
||||
uuid_unparse( g, buf );
|
||||
out = buf;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string plUUID::ToString() const
|
||||
{
|
||||
std::string str;
|
||||
plUUID::ToString( str );
|
||||
return str;
|
||||
}
|
||||
|
||||
// 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
|
102
Sources/Plasma/PubUtilLib/plUUID/plUUID_Win32.cpp
Normal file
102
Sources/Plasma/PubUtilLib/plUUID/plUUID_Win32.cpp
Normal file
@ -0,0 +1,102 @@
|
||||
/*==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>
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
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
|
Reference in New Issue
Block a user