OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 namespace crashpad { | 30 namespace crashpad { |
31 | 31 |
32 //! \brief A universally unique identifier (%UUID). | 32 //! \brief A universally unique identifier (%UUID). |
33 //! | 33 //! |
34 //! An alternate term for %UUID is “globally unique identifier” (GUID), used | 34 //! An alternate term for %UUID is “globally unique identifier” (GUID), used |
35 //! primarily by Microsoft. | 35 //! primarily by Microsoft. |
36 //! | 36 //! |
37 //! A %UUID is a unique 128-bit number specified by RFC 4122. | 37 //! A %UUID is a unique 128-bit number specified by RFC 4122. |
38 //! | 38 //! |
39 //! This is a standard-layout structure. | 39 //! This is a POD structure. |
40 struct UUID { | 40 struct UUID { |
41 //! \brief Initializes the %UUID to zero. | |
42 UUID(); | |
43 | |
44 //! \brief Tag to pass to constructor to indicate it should initialize with | |
45 //! generated data. | |
46 struct InitializeWithNewTag {}; | |
47 | |
48 //! \brief Initializes the %UUID using a standard system facility to generate | |
49 //! the value. | |
50 //! | |
51 //! CHECKs on failure with a message logged. | |
52 explicit UUID(InitializeWithNewTag); | |
53 | |
54 //! \copydoc InitializeFromBytes() | |
55 explicit UUID(const uint8_t* bytes); | |
56 | |
57 bool operator==(const UUID& that) const; | 41 bool operator==(const UUID& that) const; |
58 bool operator!=(const UUID& that) const { return !operator==(that); } | 42 bool operator!=(const UUID& that) const { return !operator==(that); } |
59 | 43 |
| 44 //! \brief Initializes the %UUID to zero. |
| 45 void InitializeToZero(); |
| 46 |
60 //! \brief Initializes the %UUID from a sequence of bytes. | 47 //! \brief Initializes the %UUID from a sequence of bytes. |
61 //! | 48 //! |
62 //! \a bytes is taken as a %UUID laid out in big-endian format in memory. On | 49 //! \a bytes is taken as a %UUID laid out in big-endian format in memory. On |
63 //! little-endian machines, appropriate byte-swapping will be performed to | 50 //! little-endian machines, appropriate byte-swapping will be performed to |
64 //! initialize an object’s data members. | 51 //! initialize an object’s data members. |
65 //! | 52 //! |
66 //! \param[in] bytes A buffer of exactly 16 bytes that will be assigned to the | 53 //! \param[in] bytes A buffer of exactly 16 bytes that will be assigned to the |
67 //! %UUID. | 54 //! %UUID. |
68 void InitializeFromBytes(const uint8_t* bytes); | 55 void InitializeFromBytes(const uint8_t* bytes); |
69 | 56 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 uint32_t data_1; | 92 uint32_t data_1; |
106 uint16_t data_2; | 93 uint16_t data_2; |
107 uint16_t data_3; | 94 uint16_t data_3; |
108 uint8_t data_4[2]; | 95 uint8_t data_4[2]; |
109 uint8_t data_5[6]; | 96 uint8_t data_5[6]; |
110 }; | 97 }; |
111 | 98 |
112 } // namespace crashpad | 99 } // namespace crashpad |
113 | 100 |
114 #endif // CRASHPAD_UTIL_MISC_UUID_H_ | 101 #endif // CRASHPAD_UTIL_MISC_UUID_H_ |
OLD | NEW |