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