switch to Boost UUID's and away from libuuid
git-svn-id: svn://localhost/ardour2/branches/3.0@8748 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
466cc57416
commit
373e2c0413
@ -22,29 +22,35 @@
|
||||
#define __pbd_uuid_h__
|
||||
|
||||
#include <string>
|
||||
#include <uuid/uuid.h>
|
||||
#include <boost/uuid/uuid.hpp>
|
||||
#include <boost/uuid/uuid_generators.hpp>
|
||||
|
||||
namespace PBD {
|
||||
|
||||
class UUID {
|
||||
class UUID : public boost::uuids::uuid {
|
||||
|
||||
public:
|
||||
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); }
|
||||
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)
|
||||
{}
|
||||
|
||||
private:
|
||||
uuid_t id;
|
||||
operator boost::uuids::uuid() {
|
||||
return static_cast<boost::uuids::uuid&>(*this);
|
||||
}
|
||||
|
||||
operator boost::uuids::uuid() const {
|
||||
return static_cast<boost::uuids::uuid const&>(*this);
|
||||
}
|
||||
|
||||
UUID& operator= (std::string const & str);
|
||||
std::string to_s () const;
|
||||
|
||||
operator bool() const { return !is_nil(); }
|
||||
};
|
||||
|
||||
} // namespace PBD
|
||||
|
@ -25,14 +25,13 @@ using namespace PBD;
|
||||
UUID&
|
||||
UUID::operator= (std::string const & str)
|
||||
{
|
||||
uuid_parse (str.c_str(), id);
|
||||
boost::uuids::string_generator gen;
|
||||
*((boost::uuids::uuid*) this) = gen (str);
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::string
|
||||
UUID::to_s () const
|
||||
{
|
||||
char buf[37];
|
||||
uuid_unparse (id, buf);
|
||||
return std::string (buf);
|
||||
return std::string ((const char*) data, size());
|
||||
}
|
||||
|
@ -36,8 +36,6 @@ def configure(conf):
|
||||
conf.check_tool('compiler_cxx')
|
||||
autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML')
|
||||
autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP', atleast_version='2.0')
|
||||
if sys.platform != 'darwin':
|
||||
autowaf.check_pkg(conf, 'uuid', uselib_store='UUID')
|
||||
|
||||
conf.check(function_name='getmntent', header_name='mntent.h', define_name='HAVE_GETMNTENT')
|
||||
conf.check(header_name='execinfo.h', define_name='HAVE_EXECINFO')
|
||||
@ -50,6 +48,7 @@ def configure(conf):
|
||||
# Boost headers
|
||||
autowaf.check_header(conf, 'boost/shared_ptr.hpp')
|
||||
autowaf.check_header(conf, 'boost/weak_ptr.hpp')
|
||||
autowaf.check_header(conf, 'boost/uuid/uuid.hpp')
|
||||
|
||||
def build(bld):
|
||||
# Library
|
||||
@ -114,7 +113,7 @@ def build(bld):
|
||||
obj.includes = ['.']
|
||||
obj.name = 'libpbd'
|
||||
obj.target = 'pbd'
|
||||
obj.uselib = 'GLIBMM SIGCPP XML UUID SNDFILE'
|
||||
obj.uselib = 'GLIBMM SIGCPP XML SNDFILE'
|
||||
if sys.platform == 'darwin':
|
||||
TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
|
||||
obj.source += 'cocoa_open_uri.mm'
|
||||
|
Loading…
Reference in New Issue
Block a user