srs5694 | 20e2a97 | 2010-02-04 00:55:04 -0500 | [diff] [blame] | 1 | // |
| 2 | // C++ Interface: GUIDData |
| 3 | // |
| 4 | // Description: GUIDData class header |
| 5 | // Implements the GUIDData data structure and support methods |
| 6 | // |
| 7 | // |
| 8 | // Author: Rod Smith <rodsmith@rodsbooks.com>, (C) 2010 |
| 9 | // |
| 10 | // Copyright: See COPYING file that comes with this distribution |
| 11 | // |
| 12 | // |
| 13 | |
| 14 | #ifndef __GUIDDATA_CLASS |
| 15 | #define __GUIDDATA_CLASS |
| 16 | |
| 17 | #include <stdint.h> |
| 18 | #include <string> |
| 19 | |
| 20 | // Have to play games with uuid_t since it's defined in incompatible ways |
| 21 | // for Unix (libuuid) vs. Windows |
| 22 | #ifdef _WIN32 |
| 23 | typedef unsigned char my_uuid_t[16]; |
| 24 | #else |
| 25 | #include <uuid/uuid.h> |
| 26 | typedef uuid_t my_uuid_t; |
| 27 | #endif |
| 28 | |
| 29 | using namespace std; |
| 30 | |
| 31 | // Note: This class's data size is critical. If data elements must be added, |
| 32 | // it will be necessary to modify various GPT classes to compensate. |
| 33 | class GUIDData { |
| 34 | protected: |
| 35 | my_uuid_t uuidData; |
srs5694 | 55d9261 | 2010-03-07 22:16:07 -0500 | [diff] [blame] | 36 | string DeleteSpaces(string s); |
srs5694 | 20e2a97 | 2010-02-04 00:55:04 -0500 | [diff] [blame] | 37 | public: |
| 38 | GUIDData(void); |
| 39 | GUIDData(const GUIDData & orig); |
| 40 | GUIDData(const char * orig); |
| 41 | ~GUIDData(void); |
| 42 | |
| 43 | // Data assignment operators.... |
| 44 | GUIDData & operator=(const GUIDData & orig); |
| 45 | GUIDData & operator=(const string & orig); |
| 46 | GUIDData & operator=(const char * orig); |
srs5694 | 20e2a97 | 2010-02-04 00:55:04 -0500 | [diff] [blame] | 47 | void Zero(void); |
| 48 | void Randomize(void); |
| 49 | |
| 50 | // Data tests.... |
srs5694 | 5a08175 | 2010-09-24 20:39:41 -0400 | [diff] [blame] | 51 | int operator==(const GUIDData & orig) const; |
| 52 | int operator!=(const GUIDData & orig) const; |
srs5694 | 20e2a97 | 2010-02-04 00:55:04 -0500 | [diff] [blame] | 53 | |
| 54 | // Data retrieval.... |
srs5694 | 5a08175 | 2010-09-24 20:39:41 -0400 | [diff] [blame] | 55 | string AsString(void) const; |
srs5694 | 20e2a97 | 2010-02-04 00:55:04 -0500 | [diff] [blame] | 56 | }; // class GUIDData |
| 57 | |
srs5694 | 5a08175 | 2010-09-24 20:39:41 -0400 | [diff] [blame] | 58 | ostream & operator<<(ostream & os, const GUIDData & data); |
| 59 | |
srs5694 | 20e2a97 | 2010-02-04 00:55:04 -0500 | [diff] [blame] | 60 | #endif |