34#if !defined( GUID_WINDOWS ) && !defined( GUID_LIBUUID ) && !defined( GUID_CFUUID ) && !defined( GUID_ANDROID )
38 #elif defined(__APPLE__)
40 #elif defined(__ANDROID__)
42 #elif defined(__linux) || defined(__posix)
61#define BEGIN_XG_NAMESPACE namespace xg {
62#define END_XG_NAMESPACE }
73 explicit Guid(
const std::array<unsigned char, 16>&
bytes );
74 explicit Guid( std::array<unsigned char, 16>&&
bytes );
76 explicit Guid(
const std::string& fromString );
87 std::string
str()
const;
88 operator std::string()
const;
89 const std::array<unsigned char, 16>&
bytes()
const;
97 std::array<unsigned char, 16> _bytes;
100 friend std::ostream&
operator<<( std::ostream& s,
const Guid& guid );
107struct AndroidGuidInfo
109 static AndroidGuidInfo fromJniEnv( JNIEnv* env );
113 jmethodID newGuidMethod;
114 jmethodID mostSignificantBitsMethod;
115 jmethodID leastSignificantBitsMethod;
116 std::thread::id initThreadId;
119extern AndroidGuidInfo androidInfo;
121void initJni( JNIEnv* env );
128template <
typename...>
134 using std::hash<T>::hash;
137template <
typename T,
typename... Rest>
140 inline std::size_t
operator()(
const T& v,
const Rest&... rest )
142 std::size_t seed =
hash<Rest...>{}( rest... );
143 seed ^=
hash<T>{}( v ) + 0x9e3779b9 + ( seed << 6 ) + ( seed >> 2 );
155void swap( xg::Guid& guid0, xg::Guid& guid1 )
noexcept;
165 const uint64_t* p =
reinterpret_cast<const uint64_t*
>( guid.bytes().data() );
166 return xg::details::hash<uint64_t, uint64_t>{}( p[0], p[1] );
Definition: crossguid.hpp:71
std::string str() const
Definition: crossguid.cpp:114
const std::array< unsigned char, 16 > & bytes() const
Definition: crossguid.cpp:146
Guid(const Guid &other)=default
void swap(Guid &other)
Definition: crossguid.cpp:262
Guid & operator=(const Guid &other)=default
Guid()
Definition: crossguid.cpp:239
friend bool operator<(const Guid &lhs, const Guid &rhs)
bool operator!=(const Guid &other) const
Definition: crossguid.cpp:256
bool isValid() const
Definition: crossguid.cpp:107
bool operator==(const Guid &other) const
Definition: crossguid.cpp:250
Guid(Guid &&other)=default
Guid & operator=(Guid &&other)=default
friend std::ostream & operator<<(std::ostream &s, const Guid &guid)
Definition: crossguid.cpp:74
#define BEGIN_XG_NAMESPACE
Definition: crossguid.hpp:61
#define END_XG_NAMESPACE
Definition: crossguid.hpp:62
Definition: crossguid.hpp:127
Definition: crossguid.cpp:388
void swap(xg::Guid &lhs, xg::Guid &rhs) noexcept
Definition: crossguid.cpp:390
std::size_t operator()(const T &v, const Rest &... rest)
Definition: crossguid.hpp:140
Definition: crossguid.hpp:129
std::size_t operator()(xg::Guid const &guid) const
Definition: crossguid.hpp:163