Botan 2.19.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 <vector>
13#include <string>
14
16
17namespace Botan {
18
19class RandomNumberGenerator;
20
22 {
23 public:
24 /**
25 * Create an uninitialized UUID object
26 */
27 UUID() : m_uuid() {}
28
29 /**
30 * Create a random UUID
31 */
33
34 /**
35 * Load a UUID from a 16 byte vector
36 */
37 UUID(const std::vector<uint8_t>& blob);
38
39 UUID& operator=(const UUID& other) = default;
40 UUID(const UUID& other) = default;
41
42 /**
43 * Decode a UUID string
44 */
45 UUID(const std::string& uuid_str);
46
47 /**
48 * Convert the UUID to a string
49 */
50 std::string to_string() const;
51
52 const std::vector<uint8_t>& binary_value() const { return m_uuid; }
53
54 bool operator==(const UUID& other) const
55 {
56 return m_uuid == other.m_uuid;
57 }
58
59 bool operator!=(const UUID& other) const { return !(*this == other); }
60
61 bool is_valid() const { return m_uuid.size() == 16; }
62
63 private:
64 std::vector<uint8_t> m_uuid;
65 };
66
67}
68
69#endif
UUID & operator=(const UUID &other)=default
bool operator!=(const UUID &other) const
Definition: uuid.h:59
UUID()
Definition: uuid.h:27
bool is_valid() const
Definition: uuid.h:61
const std::vector< uint8_t > & binary_value() const
Definition: uuid.h:52
UUID(const UUID &other)=default
bool operator==(const UUID &other) const
Definition: uuid.h:54
int(* final)(unsigned char *, CTX *)
#define BOTAN_FUTURE_INTERNAL_HEADER(hdr)
Definition: compiler.h:136
#define BOTAN_UNSTABLE_API
Definition: compiler.h:44
std::string to_string(const BER_Object &obj)
Definition: asn1_obj.cpp:213
Definition: alg_id.cpp:13