blob: 59e1bc9ceaf1f464a5bb06feb14bc4dc431c51c4 [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);
srs56945a608532011-03-17 13:53:01 -040040 GUIDData(const string & orig);
srs569420e2a972010-02-04 00:55:04 -050041 GUIDData(const char * orig);
42 ~GUIDData(void);
43
44 // Data assignment operators....
45 GUIDData & operator=(const GUIDData & orig);
46 GUIDData & operator=(const string & orig);
47 GUIDData & operator=(const char * orig);
srs569420e2a972010-02-04 00:55:04 -050048 void Zero(void);
49 void Randomize(void);
50
51 // Data tests....
srs56945a081752010-09-24 20:39:41 -040052 int operator==(const GUIDData & orig) const;
53 int operator!=(const GUIDData & orig) const;
srs569420e2a972010-02-04 00:55:04 -050054
55 // Data retrieval....
srs56945a081752010-09-24 20:39:41 -040056 string AsString(void) const;
srs569420e2a972010-02-04 00:55:04 -050057}; // class GUIDData
58
srs56945a081752010-09-24 20:39:41 -040059ostream & operator<<(ostream & os, const GUIDData & data);
60
srs569420e2a972010-02-04 00:55:04 -050061#endif