summaryrefslogtreecommitdiff
path: root/project2/uuid.h
blob: 8cb22f325dafdcbb120f7ad93b39f9d0bbe683c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef UUID_H
#define UUID_H

#include <iostream>
#include <boost/version.hpp>

#if BOOST_VERSION < 104200
//#if 1
#	define USINGOSSPUUID
#	include <ossp/uuid++.hh>
#else
#	define USINGBOOSTUUID
#	include <boost/uuid/uuid.hpp>
#endif

class UUID {
	public:
		UUID();
		UUID(const std::string &);

		static UUID generate_random();

		bool operator!=(const UUID & other) const;
		bool is_nil() const;

		void operator=(const std::string &);
		std::string str() const;

	private:
#ifdef USINGBOOSTUUID
		boost::uuids::uuid boost_uuid;
#endif
#ifdef USINGOSSPUUID
		mutable uuid ossp_uuid;
#endif
};

#endif