guid: style

This commit is contained in:
Danny Robson 2016-08-12 15:17:36 +10:00
parent 931dc65727
commit 2bbba9ab01
2 changed files with 34 additions and 27 deletions

View File

@ -24,6 +24,8 @@
#include <iomanip> #include <iomanip>
#include <sstream> #include <sstream>
using util::guid;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
guid::guid (uint32_t _data1, guid::guid (uint32_t _data1,

View File

@ -21,40 +21,45 @@
#include <ostream> #include <ostream>
#include <istream> #include <istream>
class guid {
public:
enum type {
NCS_BACKWARD, // 0xx: Network Computing System backward compatibility
STANDARD, // 10x: Standard
COM_BACKWARD, // 110: Microsoft Component Object Model backward compatibility
RESERVED // 111: Reserved for future use
};
private: ///////////////////////////////////////////////////////////////////////////////
guid (void); namespace util {
class guid {
public:
enum type {
NCS_BACKWARD, // 0xx: Network Computing System backward compatibility
STANDARD, // 10x: Standard
COM_BACKWARD, // 110: Microsoft Component Object Model backward compatibility
RESERVED // 111: Reserved for future use
};
public: private:
guid (uint32_t, uint16_t, uint16_t, uint8_t[8]); guid (void);
explicit guid (const char *);
guid (const guid&);
guid& operator= (const guid&); public:
guid (uint32_t, uint16_t, uint16_t, uint8_t[8]);
explicit guid (const char *);
guid (const guid&);
static guid from_bytes (const uint8_t *bytes); guid& operator= (const guid&);
static guid from_string (const char *bytes);
uint32_t data1; static guid from_bytes (const uint8_t *bytes);
uint16_t data2; static guid from_string (const char *bytes);
uint16_t data3;
uint8_t data4[8];
type get_type (void) const; uint32_t data1;
uint16_t data2;
uint16_t data3;
uint8_t data4[8];
bool operator< (const guid&) const; type get_type (void) const;
bool operator== (const guid&) const;
}; bool operator< (const guid&) const;
bool operator== (const guid&) const;
};
std::istream& operator>> (std::istream&, guid&);
std::ostream& operator<< (std::ostream&, const guid&);
}
std::istream& operator>> (std::istream&, guid&);
std::ostream& operator<< (std::ostream&, const guid&);
#endif #endif