Panda3D
|
00001 // Filename: windowsGuid.h 00002 // Created by: drose (03Oct04) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef WINDOWS_GUID_H 00016 #define WINDOWS_GUID_H 00017 00018 #include "pandatoolbase.h" 00019 00020 #include <string.h> // For memcpy, memcmp 00021 00022 //////////////////////////////////////////////////////////////////// 00023 // Class : WindowsGuid 00024 // Description : This is an implementation of the Windows GUID object, 00025 // used everywhere as a world-unique identifier for 00026 // anything and everything. In particular, it's used in 00027 // the X file format to identify standard templates. 00028 //////////////////////////////////////////////////////////////////// 00029 class WindowsGuid { 00030 public: 00031 INLINE WindowsGuid(); 00032 INLINE WindowsGuid(unsigned long data1, 00033 unsigned short data2, unsigned short data3, 00034 unsigned char b1, unsigned char b2, unsigned char b3, 00035 unsigned char b4, unsigned char b5, unsigned char b6, 00036 unsigned char b7, unsigned char b8); 00037 INLINE WindowsGuid(const WindowsGuid ©); 00038 INLINE void operator = (const WindowsGuid ©); 00039 00040 INLINE bool operator == (const WindowsGuid &other) const; 00041 INLINE bool operator != (const WindowsGuid &other) const; 00042 INLINE bool operator < (const WindowsGuid &other) const; 00043 INLINE int compare_to(const WindowsGuid &other) const; 00044 00045 bool parse_string(const string &str); 00046 string format_string() const; 00047 00048 void output(ostream &out) const; 00049 00050 private: 00051 unsigned long _data1; 00052 unsigned short _data2; 00053 unsigned short _data3; 00054 unsigned char _b1, _b2, _b3, _b4, _b5, _b6, _b7, _b8; 00055 }; 00056 00057 INLINE ostream &operator << (ostream &out, const WindowsGuid &guid); 00058 00059 #include "windowsGuid.I" 00060 00061 #endif 00062