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, |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
13 // limitations under the License. | 13 // limitations under the License. |
14 | 14 |
15 #ifndef CRASHPAD_UTIL_MISC_UUID_H_ | 15 #ifndef CRASHPAD_UTIL_MISC_UUID_H_ |
16 #define CRASHPAD_UTIL_MISC_UUID_H_ | 16 #define CRASHPAD_UTIL_MISC_UUID_H_ |
17 | 17 |
18 #include <stdint.h> | 18 #include <stdint.h> |
19 | 19 |
20 #include <string> | 20 #include <string> |
21 | 21 |
22 #include "base/strings/string_piece.h" | 22 #include "base/strings/string_piece.h" |
| 23 #include "build/build_config.h" |
23 | 24 |
24 namespace crashpad { | 25 namespace crashpad { |
25 | 26 |
26 //! \brief A universally unique identifier (%UUID). | 27 //! \brief A universally unique identifier (%UUID). |
27 //! | 28 //! |
28 //! An alternate term for %UUID is “globally unique identifier” (GUID), used | 29 //! An alternate term for %UUID is “globally unique identifier” (GUID), used |
29 //! primarily by Microsoft. | 30 //! primarily by Microsoft. |
30 //! | 31 //! |
31 //! A %UUID is a unique 128-bit number specified by RFC 4122. | 32 //! A %UUID is a unique 128-bit number specified by RFC 4122. |
32 //! | 33 //! |
(...skipping 26 matching lines...) Expand all Loading... |
59 //! \return `true` if the string was formatted correctly and the object has | 60 //! \return `true` if the string was formatted correctly and the object has |
60 //! been initialized with the data. `false` if the string could not be | 61 //! been initialized with the data. `false` if the string could not be |
61 //! parsed, with the object state untouched. | 62 //! parsed, with the object state untouched. |
62 bool InitializeFromString(const base::StringPiece& string); | 63 bool InitializeFromString(const base::StringPiece& string); |
63 | 64 |
64 //! \brief Formats the %UUID per RFC 4122 §3. | 65 //! \brief Formats the %UUID per RFC 4122 §3. |
65 //! | 66 //! |
66 //! \return A string of the form `"00112233-4455-6677-8899-aabbccddeeff"`. | 67 //! \return A string of the form `"00112233-4455-6677-8899-aabbccddeeff"`. |
67 std::string ToString() const; | 68 std::string ToString() const; |
68 | 69 |
| 70 #if defined(OS_WIN) |
| 71 //! \brief The same as ToString, but returned as a wstring. |
| 72 std::wstring ToWideString() const; |
| 73 #endif // OS_WIN |
| 74 |
69 // These fields are laid out according to RFC 4122 §4.1.2. | 75 // These fields are laid out according to RFC 4122 §4.1.2. |
70 uint32_t data_1; | 76 uint32_t data_1; |
71 uint16_t data_2; | 77 uint16_t data_2; |
72 uint16_t data_3; | 78 uint16_t data_3; |
73 uint8_t data_4[2]; | 79 uint8_t data_4[2]; |
74 uint8_t data_5[6]; | 80 uint8_t data_5[6]; |
75 }; | 81 }; |
76 | 82 |
77 } // namespace crashpad | 83 } // namespace crashpad |
78 | 84 |
79 #endif // CRASHPAD_UTIL_MISC_UUID_H_ | 85 #endif // CRASHPAD_UTIL_MISC_UUID_H_ |
OLD | NEW |