btrfs: [] on the end of a struct field is a variable length array.
[haiku.git] / headers / private / support / Uuid.h
blob5e52072f613ce2187cbdb334eba0d8a0da408642
1 /*
2 * Copyright 2013, Haiku, Inc.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef _UUID_H_
6 #define _UUID_H_
9 #include <String.h>
12 namespace BPrivate {
15 class BUuid {
16 public:
17 BUuid();
18 BUuid(const BUuid& other);
19 ~BUuid();
21 bool IsNil() const;
23 BUuid& SetToRandom();
25 BString ToString() const;
27 int Compare(const BUuid& other) const;
29 inline bool operator==(const BUuid& other) const;
30 inline bool operator!=(const BUuid& other) const;
32 inline bool operator<(const BUuid& other) const;
33 inline bool operator>(const BUuid& other) const;
34 inline bool operator<=(const BUuid& other) const;
35 inline bool operator>=(const BUuid& other) const;
37 BUuid& operator=(const BUuid& other);
39 private:
40 bool _SetToDevRandom();
41 void _SetToRandomFallback();
43 private:
44 uint8 fValue[16];
48 inline bool
49 BUuid::operator==(const BUuid& other) const
51 return Compare(other) == 0;
55 inline bool
56 BUuid::operator!=(const BUuid& other) const
58 return Compare(other) != 0;
62 inline bool
63 BUuid::operator<(const BUuid& other) const
65 return Compare(other) < 0;
69 inline bool
70 BUuid::operator>(const BUuid& other) const
72 return Compare(other) > 0;
76 inline bool
77 BUuid::operator<=(const BUuid& other) const
79 return Compare(other) <= 0;
83 inline bool
84 BUuid::operator>=(const BUuid& other) const
86 return Compare(other) >= 0;
90 } // namespace BPrivate
93 using BPrivate::BUuid;
96 #endif // _UUID_H_