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/string16.h" |
22 #include "base/strings/string_piece.h" | 23 #include "base/strings/string_piece.h" |
23 #include "build/build_config.h" | 24 #include "build/build_config.h" |
24 | 25 |
25 namespace crashpad { | 26 namespace crashpad { |
26 | 27 |
27 //! \brief A universally unique identifier (%UUID). | 28 //! \brief A universally unique identifier (%UUID). |
28 //! | 29 //! |
29 //! An alternate term for %UUID is “globally unique identifier” (GUID), used | 30 //! An alternate term for %UUID is “globally unique identifier” (GUID), used |
30 //! primarily by Microsoft. | 31 //! primarily by Microsoft. |
31 //! | 32 //! |
(...skipping 29 matching lines...) Expand all Loading... |
61 //! been initialized with the data. `false` if the string could not be | 62 //! been initialized with the data. `false` if the string could not be |
62 //! parsed, with the object state untouched. | 63 //! parsed, with the object state untouched. |
63 bool InitializeFromString(const base::StringPiece& string); | 64 bool InitializeFromString(const base::StringPiece& string); |
64 | 65 |
65 //! \brief Formats the %UUID per RFC 4122 §3. | 66 //! \brief Formats the %UUID per RFC 4122 §3. |
66 //! | 67 //! |
67 //! \return A string of the form `"00112233-4455-6677-8899-aabbccddeeff"`. | 68 //! \return A string of the form `"00112233-4455-6677-8899-aabbccddeeff"`. |
68 std::string ToString() const; | 69 std::string ToString() const; |
69 | 70 |
70 #if defined(OS_WIN) | 71 #if defined(OS_WIN) |
71 //! \brief The same as ToString, but returned as a wstring. | 72 //! \brief The same as ToString, but returned as a string16. |
72 std::wstring ToWideString() const; | 73 base::string16 ToString16() const; |
73 #endif // OS_WIN | 74 #endif // OS_WIN |
74 | 75 |
75 // These fields are laid out according to RFC 4122 §4.1.2. | 76 // These fields are laid out according to RFC 4122 §4.1.2. |
76 uint32_t data_1; | 77 uint32_t data_1; |
77 uint16_t data_2; | 78 uint16_t data_2; |
78 uint16_t data_3; | 79 uint16_t data_3; |
79 uint8_t data_4[2]; | 80 uint8_t data_4[2]; |
80 uint8_t data_5[6]; | 81 uint8_t data_5[6]; |
81 }; | 82 }; |
82 | 83 |
83 } // namespace crashpad | 84 } // namespace crashpad |
84 | 85 |
85 #endif // CRASHPAD_UTIL_MISC_UUID_H_ | 86 #endif // CRASHPAD_UTIL_MISC_UUID_H_ |
OLD | NEW |