Botan 2.19.5 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
15 BOTAN_FUTURE_INTERNAL_HEADER(uuid.h)
16
17namespace Botan {
18
19 class RandomNumberGenerator;
20
21 class BOTAN_UNSTABLE_API UUID final
22 {
23 public:
24 /**
25 * Create an uninitialized UUID object
26 */
27 UUID() : m_uuid() {}
28
29 /**
30 * Create a random UUID
31 */
32 UUID(RandomNumberGenerator& rng);
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
Botan::RandomNumberGenerator
Definition: rng.h:26
Botan::UUID
Definition: uuid.h:22
Botan::UUID::operator=
UUID & operator=(const UUID &other)=default
Botan::UUID::operator!=
bool operator!=(const UUID &other) const
Definition: uuid.h:59
Botan::UUID::UUID
UUID()
Definition: uuid.h:27
Botan::UUID::is_valid
bool is_valid() const
Definition: uuid.h:61
Botan::UUID::binary_value
const std::vector< uint8_t > & binary_value() const
Definition: uuid.h:52
Botan::UUID::UUID
UUID(const UUID &other)=default
Botan::UUID::operator==
bool operator==(const UUID &other) const
Definition: uuid.h:54
final
int(* final)(unsigned char *, CTX *)
Definition: commoncrypto_hash.cpp:29
BOTAN_FUTURE_INTERNAL_HEADER
#define BOTAN_FUTURE_INTERNAL_HEADER(hdr)
Definition: compiler.h:136
BOTAN_UNSTABLE_API
#define BOTAN_UNSTABLE_API
Definition: compiler.h:44
Botan::ASN1::to_string
std::string to_string(const BER_Object &obj)
Definition: asn1_obj.cpp:213
Botan
Definition: alg_id.cpp:13