]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/ole/uuid.h
Fix wxPropertyGrid::GetPropertyRect when the last item is collapsed.
[wxWidgets.git] / 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
5 // Modified by:
6 // Created: 11.07.97
7 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
8 // Licence: wxWindows licence
9 //
10 // Notes: you should link your project with RPCRT4.LIB!
11 ///////////////////////////////////////////////////////////////////////////////
12
13 #ifndef _WX_OLEUUID_H
14 #define _WX_OLEUUID_H
15
16 #include "wx/chartype.h"
17 // ------------------------------------------------------------------
18 // UUID (Universally Unique IDentifier) definition
19 // ------------------------------------------------------------------
20
21 // ----- taken from RPC.H
22 #ifndef UUID_DEFINED // in some cases RPC.H will be already
23 #ifdef __WIN32__ // included, so avoid redefinition
24 typedef struct
25 {
26 unsigned long Data1;
27 unsigned short Data2;
28 unsigned short Data3;
29 unsigned char Data4[8];
30 } UUID; // UUID = GUID = CLSID = LIBID = IID
31 #endif // WIN32
32 #endif // UUID_DEFINED
33
34 #ifndef GUID_DEFINED
35 typedef UUID GUID;
36 #define UUID_DEFINED // prevent redefinition
37 #endif // GUID_DEFINED
38
39 typedef unsigned char uchar;
40
41 // ------------------------------------------------------------------
42 // a class to store UUID and it's string representation
43 // ------------------------------------------------------------------
44
45 // uses RPC functions to create/convert Universally Unique Identifiers
46 class WXDLLIMPEXP_CORE Uuid
47 {
48 private:
49 UUID m_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
52
53 void UuidToCForm();
54
55 // function used to set initial state by all ctors
56 void Init() { m_pszUuid = NULL; m_pszCForm = NULL; }
57
58 public:
59 // ctors & dtor
60 Uuid() { Init(); }
61 Uuid(const wxChar *pc) { Init(); Set(pc); }
62 Uuid(const UUID &uuid) { Init(); Set(uuid); }
63 ~Uuid();
64
65 // copy ctor and assignment operator needed for this class
66 Uuid(const Uuid& uuid);
67 Uuid& operator=(const Uuid& uuid);
68
69 // create a brand new UUID
70 void Create();
71
72 // set value of 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)
75
76 // comparison operators
77 bool operator==(const Uuid& uuid) const;
78 bool operator!=(const Uuid& uuid) const { return !(*this == uuid); }
79
80 // accessors
81 operator const UUID*() const { return &m_uuid; }
82 operator const wxChar*() const { return (wxChar *)(m_pszUuid); }
83
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; }
87 };
88
89 #endif //_WX_OLEUUID_H