]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/ole/uuid.h
synchronize GTK2 minimum version in docs
[wxWidgets.git] / include / wx / msw / ole / uuid.h
CommitLineData
bbf1f0e5 1///////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: wx/msw/ole/uuid.h
bbf1f0e5
KB
3// Purpose: encapsulates an UUID with some added helper functions
4// Author: Vadim Zeitlin
0a0e6a5b 5// Modified by:
bbf1f0e5
KB
6// Created: 11.07.97
7// RCS-ID: $Id$
8// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
65571936 9// Licence: wxWindows licence
bbf1f0e5
KB
10//
11// Notes: you should link your project with RPCRT4.LIB!
12///////////////////////////////////////////////////////////////////////////////
13
bbcdf8bc
JS
14#ifndef _WX_OLEUUID_H
15#define _WX_OLEUUID_H
bbf1f0e5 16
e3f6cbd9 17#include "wx/chartype.h"
bbf1f0e5
KB
18// ------------------------------------------------------------------
19// UUID (Universally Unique IDentifier) definition
20// ------------------------------------------------------------------
21
22// ----- taken from RPC.H
23#ifndef UUID_DEFINED // in some cases RPC.H will be already
24 #ifdef __WIN32__ // included, so avoid redefinition
0a0e6a5b 25 typedef struct
bbf1f0e5
KB
26 {
27 unsigned long Data1;
28 unsigned short Data2;
29 unsigned short Data3;
30 unsigned char Data4[8];
31 } UUID; // UUID = GUID = CLSID = LIBID = IID
bbf1f0e5
KB
32 #endif // WIN32
33#endif // UUID_DEFINED
34
35#ifndef GUID_DEFINED
36 typedef UUID GUID;
37 #define UUID_DEFINED // prevent redefinition
38#endif // GUID_DEFINED
39
40typedef unsigned char uchar;
41
42// ------------------------------------------------------------------
43// a class to store UUID and it's string representation
44// ------------------------------------------------------------------
45
46// uses RPC functions to create/convert Universally Unique Identifiers
53a2db12 47class WXDLLIMPEXP_CORE Uuid
bbf1f0e5
KB
48{
49private:
50 UUID m_uuid;
0a0e6a5b 51 wxUChar *m_pszUuid; // this string is alloc'd and freed by RPC
c47d0f2e 52 wxChar *m_pszCForm; // this string is allocated in Set/Create
bbf1f0e5
KB
53
54 void UuidToCForm();
55
56 // function used to set initial state by all ctors
57 void Init() { m_pszUuid = NULL; m_pszCForm = NULL; }
58
59public:
60 // ctors & dtor
61 Uuid() { Init(); }
c47d0f2e 62 Uuid(const wxChar *pc) { Init(); Set(pc); }
bbf1f0e5
KB
63 Uuid(const UUID &uuid) { Init(); Set(uuid); }
64 ~Uuid();
65
66 // copy ctor and assignment operator needed for this class
67 Uuid(const Uuid& uuid);
68 Uuid& operator=(const Uuid& uuid);
69
70 // create a brand new UUID
71 void Create();
72
0a0e6a5b 73 // set value of UUID
c47d0f2e 74 bool Set(const wxChar *pc); // from a string, returns true if ok
bbf1f0e5
KB
75 void Set(const UUID& uuid); // from another UUID (never fails)
76
2753fd96
VZ
77 // comparison operators
78 bool operator==(const Uuid& uuid) const;
58bd9838 79 bool operator!=(const Uuid& uuid) const { return !(*this == uuid); }
2753fd96 80
bbf1f0e5 81 // accessors
c47d0f2e
OK
82 operator const UUID*() const { return &m_uuid; }
83 operator const wxChar*() const { return (wxChar *)(m_pszUuid); }
bbf1f0e5
KB
84
85 // return string representation of the UUID in the C form
86 // (as in DEFINE_GUID macro)
c47d0f2e 87 const wxChar *CForm() const { return m_pszCForm; }
bbf1f0e5
KB
88};
89
8853b9a8 90#endif //_WX_OLEUUID_H