MySQL 8.0.37
Source Code Documentation
data.h
Go to the documentation of this file.
1/* Copyright (c) 2021, 2024, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef DATA_INCLUDED
25#define DATA_INCLUDED
26
27#include <string>
28
29namespace keyring_common {
30namespace data {
31
32/** Data types */
33using Type = std::string;
34using Sensitive_data = std::string;
35
36/**
37 Sensitive data storage
38*/
39
40class Data {
41 public:
43 Data();
44 Data(Type type);
45 Data(const Data &src);
46 Data(Data &&src) noexcept;
47 Data &operator=(const Data &src);
48 Data &operator=(Data &&src) noexcept;
49
50 virtual ~Data();
51
52 virtual const Data get_data() const;
53
54 Sensitive_data data() const;
55
56 Type type() const;
57
58 bool valid() const;
59
60 void set_data(const Sensitive_data &data);
61
62 virtual void set_data(const Data &src);
63
64 void set_type(Type type);
65
66 bool operator==(const Data &other);
67
68 protected:
69 void set_validity();
70 /** Sensitive data */
72 /** Data type */
74 /** Validity of Data object */
75 bool valid_{false};
76};
77
78} // namespace data
79} // namespace keyring_common
80
81#endif // !DATA_INCLUDED
Sensitive data storage.
Definition: data.h:40
void set_data(const Sensitive_data &data)
Set data.
Definition: data.cc:77
void set_validity()
Set validity of the data object.
Definition: data.cc:97
Type type() const
Get data's type.
Definition: data.cc:71
Data()
Definition: data.cc:37
bool valid() const
Status of object's validity.
Definition: data.cc:74
bool operator==(const Data &other)
Comparison.
Definition: data.cc:92
Sensitive_data data() const
Get data.
Definition: data.cc:68
Type type_
Data type.
Definition: data.h:73
virtual const Data get_data() const
Return self.
Definition: data.cc:65
void set_type(Type type)
Set type.
Definition: data.cc:86
virtual ~Data()
Destructor.
Definition: data.cc:62
Data & operator=(const Data &src)
Sensitive_data data_
Sensitive data.
Definition: data.h:71
bool valid_
Validity of Data object.
Definition: data.h:75
std::string Type
Data types.
Definition: data.h:33
std::string Sensitive_data
Definition: data.h:34
Definition: keyring_encryption_service_definition.h:32