Home | History | Annotate | Download | only in gptfdisk
      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 (at) rodsbooks.com>, (C) 2010-2011
      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 (in rpc.h)
     22 #ifdef _WIN32
     23 #include <rpc.h>
     24    #ifdef _MSC_VER
     25    #pragma comment(lib, "Rpcrt4.lib")
     26    #endif
     27 typedef unsigned char my_uuid_t[16];
     28 #else // Not Windows
     29 #include <uuid/uuid.h>
     30 typedef uuid_t my_uuid_t;
     31 #endif
     32 
     33 using namespace std;
     34 
     35 // Note: This class's data size is critical. If data elements must be added,
     36 // it will be necessary to modify various GPT classes to compensate.
     37 class GUIDData {
     38    private:
     39       static bool firstInstance;
     40    protected:
     41       my_uuid_t uuidData;
     42       string DeleteSpaces(string s);
     43    public:
     44       GUIDData(void);
     45       GUIDData(const GUIDData & orig);
     46       GUIDData(const string & orig);
     47       GUIDData(const char * orig);
     48       ~GUIDData(void);
     49 
     50       // Data assignment operators....
     51       GUIDData & operator=(const GUIDData & orig);
     52       GUIDData & operator=(const string & orig);
     53       GUIDData & operator=(const char * orig);
     54       void Zero(void);
     55       void Randomize(void);
     56 
     57       // Data tests....
     58       int operator==(const GUIDData & orig) const;
     59       int operator!=(const GUIDData & orig) const;
     60 
     61       // Data retrieval....
     62       string AsString(void) const;
     63 }; // class GUIDData
     64 
     65 ostream & operator<<(ostream & os, const GUIDData & data);
     66 
     67 #endif
     68