Botan 3.9.0
Crypto and TLS for C&
uuid.h
Go to the documentation of this file.
1/*
2* UUID type
3* (C) 2015,2018 Jack Lloyd
4*
5* Botan is released under the Simplified BSD License (see license.txt)
6*/
7
8#ifndef BOTAN_UUID_H_
9#define BOTAN_UUID_H_
10
11#include <botan/types.h>
12#include <string>
13#include <vector>
14
16
17namespace Botan {
18
19class RandomNumberGenerator;
20
22 public:
23 /**
24 * Create an uninitialized UUID object
25 */
26 UUID() = default;
27
28 /**
29 * Create a random UUID
30 */
32
33 /**
34 * Load a UUID from a 16 byte vector
35 */
36 BOTAN_FUTURE_EXPLICIT UUID(const std::vector<uint8_t>& blob);
37
38 /**
39 * Decode a UUID string
40 */
41 BOTAN_FUTURE_EXPLICIT UUID(std::string_view uuid_str);
42
43 /**
44 * Convert the UUID to a string
45 */
46 std::string to_string() const;
47
48 const std::vector<uint8_t>& binary_value() const { return m_uuid; }
49
50 bool operator==(const UUID& other) const { return m_uuid == other.m_uuid; }
51
52 bool operator!=(const UUID& other) const { return !(*this == other); }
53
54 bool is_valid() const { return m_uuid.size() == 16; }
55
56 private:
57 std::vector<uint8_t> m_uuid;
58};
59
60} // namespace Botan
61
62#endif
#define BOTAN_DEPRECATED_HEADER(hdr)
Definition api.h:94
#define BOTAN_UNSTABLE_API
Definition api.h:34
#define BOTAN_FUTURE_EXPLICIT
Definition api.h:52
bool operator!=(const UUID &other) const
Definition uuid.h:52
bool is_valid() const
Definition uuid.h:54
const std::vector< uint8_t > & binary_value() const
Definition uuid.h:48
std::string to_string() const
Definition uuid.cpp:58
bool operator==(const UUID &other) const
Definition uuid.h:50
UUID()=default