X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3bce6687f47dfa5fb8d4bab92702a5b5b1eb3485..1cd44b9c5f49407329c3da220ca8212e65e97d6c:/src/msw/ole/uuid.cpp diff --git a/src/msw/ole/uuid.cpp b/src/msw/ole/uuid.cpp index 04f81a8385..d4079803b4 100644 --- a/src/msw/ole/uuid.cpp +++ b/src/msw/ole/uuid.cpp @@ -1,22 +1,18 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: ole/uuid.cpp +// Name: src/msw/ole/uuid.cpp // Purpose: implements Uuid class, see uuid.h for details // Author: Vadim Zeitlin -// Modified by: +// Modified by: // Created: 12.09.96 // RCS-ID: $Id$ // Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows license +// Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // ============================================================================ // Declarations // ============================================================================ -#ifdef __GNUG__ -#pragma implementation "uuid.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -24,14 +20,12 @@ #pragma hdrstop #endif -#include "wx/setup.h" - -#if wxUSE_OLE && wxUSE_DRAG_AND_DROP +#if wxUSE_OLE && (wxUSE_DRAG_AND_DROP || wxUSE_DATAOBJ) -// standard headers -#if wxCHECK_W32API_VERSION( 1, 0 ) - #include +#ifndef WX_PRECOMP + #include "wx/msw/wrapwin.h" #endif + #include // UUID related functions #include "wx/msw/ole/uuid.h" @@ -48,8 +42,8 @@ // copy ctor Uuid::Uuid(const Uuid& uuid) { - // bitwise copy Ok for UUIDs - m_uuid = uuid.m_uuid; + // bitwise copy Ok for UUIDs + m_uuid = uuid.m_uuid; // force the string to be allocated by RPC // (we free it later with RpcStringFree) @@ -88,12 +82,19 @@ Uuid& Uuid::operator=(const Uuid& uuid) return *this; } +bool Uuid::operator==(const Uuid& uuid) const +{ + // IsEqualGUID() returns BOOL and not bool so use an explicit comparison to + // avoid MSVC warnings about int->bool conversion + return IsEqualGUID(m_uuid, uuid.m_uuid) == TRUE; +} + // dtor -Uuid::~Uuid() -{ +Uuid::~Uuid() +{ // this string must be allocated by RPC! // (otherwise you get a debug breakpoint deep inside RPC DLL) - if ( m_pszUuid ) + if ( m_pszUuid ) #ifdef _UNICODE RpcStringFree((unsigned short **)&m_pszUuid); #else @@ -129,17 +130,13 @@ void Uuid::Create() // can't fail UuidCreate(&uuid); - + Set(uuid); } // set the value bool Uuid::Set(const wxChar *pc) { -#ifdef __WXWINE__ - wxFAIL_MSG(_T("UUid::Set not implemented")); - return FALSE; -#else // get UUID from string #ifdef _UNICODE if ( UuidFromString((unsigned short *)pc, &m_uuid) != RPC_S_OK) @@ -147,7 +144,7 @@ bool Uuid::Set(const wxChar *pc) if ( UuidFromString((wxUChar *)pc, &m_uuid) != RPC_S_OK) #endif // failed: probably invalid string - return FALSE; + return false; // transform it back to string to normalize it #ifdef _UNICODE @@ -159,8 +156,7 @@ bool Uuid::Set(const wxChar *pc) // update m_pszCForm UuidToCForm(); - return TRUE; -#endif + return true; } // stores m_uuid in m_pszCForm in a format required by