Panda3D
 All Classes Functions Variables Enumerations
windowsGuid.h
1 // Filename: windowsGuid.h
2 // Created by: drose (03Oct04)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef WINDOWS_GUID_H
16 #define WINDOWS_GUID_H
17 
18 #include "pandatoolbase.h"
19 
20 #include <string.h> // For memcpy, memcmp
21 
22 ////////////////////////////////////////////////////////////////////
23 // Class : WindowsGuid
24 // Description : This is an implementation of the Windows GUID object,
25 // used everywhere as a world-unique identifier for
26 // anything and everything. In particular, it's used in
27 // the X file format to identify standard templates.
28 ////////////////////////////////////////////////////////////////////
29 class WindowsGuid {
30 public:
31  INLINE WindowsGuid();
32  INLINE WindowsGuid(unsigned long data1,
33  unsigned short data2, unsigned short data3,
34  unsigned char b1, unsigned char b2, unsigned char b3,
35  unsigned char b4, unsigned char b5, unsigned char b6,
36  unsigned char b7, unsigned char b8);
37  INLINE WindowsGuid(const WindowsGuid &copy);
38  INLINE void operator = (const WindowsGuid &copy);
39 
40  INLINE bool operator == (const WindowsGuid &other) const;
41  INLINE bool operator != (const WindowsGuid &other) const;
42  INLINE bool operator < (const WindowsGuid &other) const;
43  INLINE int compare_to(const WindowsGuid &other) const;
44 
45  bool parse_string(const string &str);
46  string format_string() const;
47 
48  void output(ostream &out) const;
49 
50 private:
51  unsigned long _data1;
52  unsigned short _data2;
53  unsigned short _data3;
54  unsigned char _b1, _b2, _b3, _b4, _b5, _b6, _b7, _b8;
55 };
56 
57 INLINE ostream &operator << (ostream &out, const WindowsGuid &guid);
58 
59 #include "windowsGuid.I"
60 
61 #endif
62 
This is an implementation of the Windows GUID object, used everywhere as a world-unique identifier fo...
Definition: windowsGuid.h:29
int compare_to(const WindowsGuid &other) const
Returns a number less than zero if this WindowsGuid sorts before the other one, greater than zero if ...
Definition: windowsGuid.I:109
void output(ostream &out) const
Outputs a hex representation of the GUID.
Definition: windowsGuid.cxx:80
bool parse_string(const string &str)
Parses the hex representation in the indicated string and stores it in the WindowsGuid object...
Definition: windowsGuid.cxx:29
string format_string() const
Returns a hex representation of the GUID.
Definition: windowsGuid.cxx:62