1998-05-20 10:21:00 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: ole/uuid.h
|
|
|
|
// Purpose: encapsulates an UUID with some added helper functions
|
|
|
|
// Author: Vadim Zeitlin
|
2004-08-16 08:45:46 -04:00
|
|
|
// Modified by:
|
1998-05-20 10:21:00 -04:00
|
|
|
// Created: 11.07.97
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:21:00 -04:00
|
|
|
//
|
|
|
|
// Notes: you should link your project with RPCRT4.LIB!
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-07 19:52:45 -04:00
|
|
|
#ifndef _WX_OLEUUID_H
|
|
|
|
#define _WX_OLEUUID_H
|
1998-05-20 10:21:00 -04:00
|
|
|
|
2003-08-09 08:38:21 -04:00
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
1998-05-20 10:21:00 -04:00
|
|
|
#pragma interface "uuid.h"
|
|
|
|
#endif
|
1999-08-09 13:47:28 -04:00
|
|
|
#include "wx/wxchar.h"
|
1998-05-20 10:21:00 -04:00
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// UUID (Universally Unique IDentifier) definition
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
// ----- taken from RPC.H
|
|
|
|
#ifndef UUID_DEFINED // in some cases RPC.H will be already
|
|
|
|
#ifdef __WIN32__ // included, so avoid redefinition
|
2004-08-16 08:45:46 -04:00
|
|
|
typedef struct
|
1998-05-20 10:21:00 -04:00
|
|
|
{
|
|
|
|
unsigned long Data1;
|
|
|
|
unsigned short Data2;
|
|
|
|
unsigned short Data3;
|
|
|
|
unsigned char Data4[8];
|
|
|
|
} UUID; // UUID = GUID = CLSID = LIBID = IID
|
|
|
|
#endif // WIN32
|
|
|
|
#endif // UUID_DEFINED
|
|
|
|
|
|
|
|
#ifndef GUID_DEFINED
|
|
|
|
typedef UUID GUID;
|
|
|
|
#define UUID_DEFINED // prevent redefinition
|
|
|
|
#endif // GUID_DEFINED
|
|
|
|
|
|
|
|
typedef unsigned char uchar;
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// a class to store UUID and it's string representation
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
// uses RPC functions to create/convert Universally Unique Identifiers
|
1999-01-08 08:15:42 -05:00
|
|
|
class WXDLLEXPORT Uuid
|
1998-05-20 10:21:00 -04:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
UUID m_uuid;
|
2004-08-16 08:45:46 -04:00
|
|
|
wxUChar *m_pszUuid; // this string is alloc'd and freed by RPC
|
1999-06-14 10:19:15 -04:00
|
|
|
wxChar *m_pszCForm; // this string is allocated in Set/Create
|
1998-05-20 10:21:00 -04:00
|
|
|
|
|
|
|
void UuidToCForm();
|
|
|
|
|
|
|
|
// function used to set initial state by all ctors
|
|
|
|
void Init() { m_pszUuid = NULL; m_pszCForm = NULL; }
|
|
|
|
|
|
|
|
public:
|
|
|
|
// ctors & dtor
|
|
|
|
Uuid() { Init(); }
|
1999-06-14 10:19:15 -04:00
|
|
|
Uuid(const wxChar *pc) { Init(); Set(pc); }
|
1998-05-20 10:21:00 -04:00
|
|
|
Uuid(const UUID &uuid) { Init(); Set(uuid); }
|
|
|
|
~Uuid();
|
|
|
|
|
|
|
|
// copy ctor and assignment operator needed for this class
|
|
|
|
Uuid(const Uuid& uuid);
|
|
|
|
Uuid& operator=(const Uuid& uuid);
|
|
|
|
|
|
|
|
// create a brand new UUID
|
|
|
|
void Create();
|
|
|
|
|
2004-08-16 08:45:46 -04:00
|
|
|
// set value of UUID
|
1999-06-14 10:19:15 -04:00
|
|
|
bool Set(const wxChar *pc); // from a string, returns true if ok
|
1998-05-20 10:21:00 -04:00
|
|
|
void Set(const UUID& uuid); // from another UUID (never fails)
|
|
|
|
|
|
|
|
// accessors
|
1999-06-14 10:19:15 -04:00
|
|
|
operator const UUID*() const { return &m_uuid; }
|
|
|
|
operator const wxChar*() const { return (wxChar *)(m_pszUuid); }
|
1998-05-20 10:21:00 -04:00
|
|
|
|
|
|
|
// return string representation of the UUID in the C form
|
|
|
|
// (as in DEFINE_GUID macro)
|
1999-06-14 10:19:15 -04:00
|
|
|
const wxChar *CForm() const { return m_pszCForm; }
|
1998-05-20 10:21:00 -04:00
|
|
|
};
|
|
|
|
|
1999-01-08 08:15:42 -05:00
|
|
|
#endif //_WX_OLEUUID_H
|