]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/ole/uuid.h
1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: encapsulates an UUID with some added helper functions
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence: wxWindows licence
11 // Notes: you should link your project with RPCRT4.LIB!
12 ///////////////////////////////////////////////////////////////////////////////
17 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
18 #pragma interface "uuid.h"
20 #include "wx/wxchar.h"
21 // ------------------------------------------------------------------
22 // UUID (Universally Unique IDentifier) definition
23 // ------------------------------------------------------------------
25 // ----- taken from RPC.H
26 #ifndef UUID_DEFINED // in some cases RPC.H will be already
27 #ifdef __WIN32__ // included, so avoid redefinition
33 unsigned char Data4
[8];
34 } UUID
; // UUID = GUID = CLSID = LIBID = IID
36 #endif // UUID_DEFINED
40 #define UUID_DEFINED // prevent redefinition
41 #endif // GUID_DEFINED
43 typedef unsigned char uchar
;
45 // ------------------------------------------------------------------
46 // a class to store UUID and it's string representation
47 // ------------------------------------------------------------------
49 // uses RPC functions to create/convert Universally Unique Identifiers
50 class WXDLLEXPORT Uuid
54 wxUChar
*m_pszUuid
; // this string is alloc'd and freed by RPC
55 wxChar
*m_pszCForm
; // this string is allocated in Set/Create
59 // function used to set initial state by all ctors
60 void Init() { m_pszUuid
= NULL
; m_pszCForm
= NULL
; }
65 Uuid(const wxChar
*pc
) { Init(); Set(pc
); }
66 Uuid(const UUID
&uuid
) { Init(); Set(uuid
); }
69 // copy ctor and assignment operator needed for this class
70 Uuid(const Uuid
& uuid
);
71 Uuid
& operator=(const Uuid
& uuid
);
73 // create a brand new UUID
77 bool Set(const wxChar
*pc
); // from a string, returns true if ok
78 void Set(const UUID
& uuid
); // from another UUID (never fails)
81 operator const UUID
*() const { return &m_uuid
; }
82 operator const wxChar
*() const { return (wxChar
*)(m_pszUuid
); }
84 // return string representation of the UUID in the C form
85 // (as in DEFINE_GUID macro)
86 const wxChar
*CForm() const { return m_pszCForm
; }
89 #endif //_WX_OLEUUID_H