]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/ole/uuid.h
Don't define __STRICT_ANSI__, we should build both with and without it.
[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 6// Created: 11.07.97
bbf1f0e5 7// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
65571936 8// Licence: wxWindows licence
bbf1f0e5
KB
9//
10// Notes: you should link your project with RPCRT4.LIB!
11///////////////////////////////////////////////////////////////////////////////
12
bbcdf8bc
JS
13#ifndef _WX_OLEUUID_H
14#define _WX_OLEUUID_H
bbf1f0e5 15
e3f6cbd9 16#include "wx/chartype.h"
bbf1f0e5
KB
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
0a0e6a5b 24 typedef struct
bbf1f0e5
KB
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
bbf1f0e5
KB
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
39typedef 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
53a2db12 46class WXDLLIMPEXP_CORE Uuid
bbf1f0e5
KB
47{
48private:
49 UUID m_uuid;
0a0e6a5b 50 wxUChar *m_pszUuid; // this string is alloc'd and freed by RPC
c47d0f2e 51 wxChar *m_pszCForm; // this string is allocated in Set/Create
bbf1f0e5
KB
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
58public:
59 // ctors & dtor
60 Uuid() { Init(); }
c47d0f2e 61 Uuid(const wxChar *pc) { Init(); Set(pc); }
bbf1f0e5
KB
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
0a0e6a5b 72 // set value of UUID
c47d0f2e 73 bool Set(const wxChar *pc); // from a string, returns true if ok
bbf1f0e5
KB
74 void Set(const UUID& uuid); // from another UUID (never fails)
75
2753fd96
VZ
76 // comparison operators
77 bool operator==(const Uuid& uuid) const;
58bd9838 78 bool operator!=(const Uuid& uuid) const { return !(*this == uuid); }
2753fd96 79
bbf1f0e5 80 // accessors
c47d0f2e
OK
81 operator const UUID*() const { return &m_uuid; }
82 operator const wxChar*() const { return (wxChar *)(m_pszUuid); }
bbf1f0e5
KB
83
84 // return string representation of the UUID in the C form
85 // (as in DEFINE_GUID macro)
c47d0f2e 86 const wxChar *CForm() const { return m_pszCForm; }
bbf1f0e5
KB
87};
88
8853b9a8 89#endif //_WX_OLEUUID_H