X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fpbd%2Fpbd%2Fuuid.h;h=16a67436b70c36bd57d040183a72d491eccc32d4;hb=a459f96e38f569503e6d983808210d9d43a396ec;hp=275b72648af204dcb3fbb1cd325bbc3a4081763e;hpb=373e2c041337602d600f594757c03ab0c6a740c5;p=ardour.git diff --git a/libs/pbd/pbd/uuid.h b/libs/pbd/pbd/uuid.h index 275b72648a..16a67436b7 100644 --- a/libs/pbd/pbd/uuid.h +++ b/libs/pbd/pbd/uuid.h @@ -22,35 +22,29 @@ #define __pbd_uuid_h__ #include -#include -#include +#include namespace PBD { -class UUID : public boost::uuids::uuid { +class UUID { public: - UUID () - : boost::uuids::uuid (boost::uuids::random_generator()()) {} - UUID (std::string const & str) - : boost::uuids::uuid (boost::uuids::string_generator()(str)) {} - - explicit UUID (boost::uuids::uuid const& u) - : boost::uuids::uuid(u) - {} - - operator boost::uuids::uuid() { - return static_cast(*this); - } - - operator boost::uuids::uuid() const { - return static_cast(*this); - } - - UUID& operator= (std::string const & str); - std::string to_s () const; - - operator bool() const { return !is_nil(); } + UUID () { uuid_generate (id); } + UUID (UUID const & other) { uuid_copy (id, other.id); } + UUID (std::string const & str) { uuid_parse (str.c_str(), id); } + + UUID& operator= (std::string const & str); + std::string to_s () const; + + bool operator== (UUID const & other) const { return !uuid_compare (id, other.id); } + bool operator!= (UUID const & other) const { return uuid_compare (id, other.id); } + bool operator< (UUID const & other) const { return uuid_compare (id, other.id) < 0; } + + operator bool() const { return !uuid_is_null (id); } + + private: + uuid_t id; + }; } // namespace PBD