Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: util/misc/uuid.h

Issue 430003003: Add UUID, strlcpy, and their tests to util (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review comments Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | util/misc/uuid.cc » ('j') | util/misc/uuid.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (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
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #ifndef CRASHPAD_UTIL_MISC_UUID_H_
16 #define CRASHPAD_UTIL_MISC_UUID_H_
17
18 #include <stdint.h>
19
20 #include <string>
21
22 namespace crashpad {
23
24 //! \brief A universally unique identifier (%UUID).
25 //!
26 //! An alternate term for %UUID is “globally unique identifier” (GUID), used
27 //! primarily by Microsoft.
28 //!
29 //! A %UUID is a unique 128-bit number specified by RFC 4122.
30 //!
31 //! This is a standard-layout structure, and it is acceptable to use `memcpy()`
32 //! to set its value.
33 struct UUID {
34 //! \brief Initializes the %UUID to zero.
35 UUID();
36
37 //! \brief Initializes the %UUID from a sequence of bytes.
38 //!
39 //! \param[in] bytes A buffer of exactly 16 bytes that will be assigned to the
40 //! %UUID.
41 explicit UUID(const uint8_t* bytes);
42
43 //! \brief Formats the %UUID per RFC 4122 3.
Robert Sesek 2014/08/01 18:37:03 A § could look nice here.
44 //!
45 //! \return A string of the form `"00112233-4455-6677-8899-aabbccddeeff"`.
46 std::string ToString() const;
47
48 uint8_t data[16];
49 };
50
51 } // namespace crashpad
52
53 #endif // CRASHPAD_UTIL_MISC_UUID_H_
OLDNEW
« no previous file with comments | « no previous file | util/misc/uuid.cc » ('j') | util/misc/uuid.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698