Botan 3.6.1
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() : m_uuid() {}
27
28 /**
29 * Create a random UUID
30 */
32
33 /**
34 * Load a UUID from a 16 byte vector
35 */
36 UUID(const std::vector<uint8_t>& blob);
37
38 UUID& operator=(const UUID& other) = default;
39 UUID(const UUID& other) = default;
40
41 /**
42 * Decode a UUID string
43 */
44 UUID(std::string_view uuid_str);
45
46 /**
47 * Convert the UUID to a string
48 */
49 std::string to_string() const;
50
51 const std::vector<uint8_t>& binary_value() const { return m_uuid; }
52
53 bool operator==(const UUID& other) const { return m_uuid == other.m_uuid; }
54
55 bool operator!=(const UUID& other) const { return !(*this == other); }
56
57 bool is_valid() const { return m_uuid.size() == 16; }
58
59 private:
60 std::vector<uint8_t> m_uuid;
61};
62
63} // namespace Botan
64
65#endif
UUID & operator=(const UUID &other)=default
bool operator!=(const UUID &other) const
Definition uuid.h:55
bool is_valid() const
Definition uuid.h:57
const std::vector< uint8_t > & binary_value() const
Definition uuid.h:51
UUID(const UUID &other)=default
bool operator==(const UUID &other) const
Definition uuid.h:53
int(* final)(unsigned char *, CTX *)
#define BOTAN_DEPRECATED_HEADER(hdr)
Definition compiler.h:146
#define BOTAN_UNSTABLE_API
Definition compiler.h:44