]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/ole/uuid.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/ole/uuid.h
3 // Purpose: encapsulates an UUID with some added helper functions
4 // Author: Vadim Zeitlin
7 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
8 // Licence: wxWindows licence
10 // Notes: you should link your project with RPCRT4.LIB!
11 ///////////////////////////////////////////////////////////////////////////////
16 #include "wx/chartype.h"
17 // ------------------------------------------------------------------
18 // UUID (Universally Unique IDentifier) definition
19 // ------------------------------------------------------------------
21 // ----- taken from RPC.H
22 #ifndef UUID_DEFINED // in some cases RPC.H will be already
23 #ifdef __WIN32__ // included, so avoid redefinition
29 unsigned char Data4
[8];
30 } UUID
; // UUID = GUID = CLSID = LIBID = IID
32 #endif // UUID_DEFINED
36 #define UUID_DEFINED // prevent redefinition
37 #endif // GUID_DEFINED
39 typedef unsigned char uchar
;
41 // ------------------------------------------------------------------
42 // a class to store UUID and it's string representation
43 // ------------------------------------------------------------------
45 // uses RPC functions to create/convert Universally Unique Identifiers
46 class WXDLLIMPEXP_CORE Uuid
50 wxUChar
*m_pszUuid
; // this string is alloc'd and freed by RPC
51 wxChar
*m_pszCForm
; // this string is allocated in Set/Create
55 // function used to set initial state by all ctors
56 void Init() { m_pszUuid
= NULL
; m_pszCForm
= NULL
; }
61 Uuid(const wxChar
*pc
) { Init(); Set(pc
); }
62 Uuid(const UUID
&uuid
) { Init(); Set(uuid
); }
65 // copy ctor and assignment operator needed for this class
66 Uuid(const Uuid
& uuid
);
67 Uuid
& operator=(const Uuid
& uuid
);
69 // create a brand new UUID
73 bool Set(const wxChar
*pc
); // from a string, returns true if ok
74 void Set(const UUID
& uuid
); // from another UUID (never fails)
76 // comparison operators
77 bool operator==(const Uuid
& uuid
) const;
78 bool operator!=(const Uuid
& uuid
) const { return !(*this == uuid
); }
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