blob: d22ec8672f0346d46d9d106b4cc0a2d0879fe314 [file] [log] [blame]
srs569420e2a972010-02-04 00:55:04 -05001//
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
23typedef unsigned char my_uuid_t[16];
24#else
srs569464cbd172011-03-01 22:03:54 -050025#include <uuid/uuid.h>
srs569420e2a972010-02-04 00:55:04 -050026typedef uuid_t my_uuid_t;
27#endif
28
29using 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.
33class GUIDData {
34 protected:
35 my_uuid_t uuidData;
srs569455d92612010-03-07 22:16:07 -050036 string DeleteSpaces(string s);
srs569420e2a972010-02-04 00:55:04 -050037 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);
srs569420e2a972010-02-04 00:55:04 -050047 void Zero(void);
48 void Randomize(void);
49
50 // Data tests....
srs56945a081752010-09-24 20:39:41 -040051 int operator==(const GUIDData & orig) const;
52 int operator!=(const GUIDData & orig) const;
srs569420e2a972010-02-04 00:55:04 -050053
54 // Data retrieval....
srs56945a081752010-09-24 20:39:41 -040055 string AsString(void) const;
srs569420e2a972010-02-04 00:55:04 -050056}; // class GUIDData
57
srs56945a081752010-09-24 20:39:41 -040058ostream & operator<<(ostream & os, const GUIDData & data);
59
srs569420e2a972010-02-04 00:55:04 -050060#endif