MySQL 8.4.0
Source Code Documentation
data_extension.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_extension_INCLUDED
25#define Data_extension_INCLUDED
26
27#include "data.h" /* data::Data */
28
29namespace keyring_common {
30
31namespace data {
32/**
33 Data wrapper to include backend specific extensions
34*/
35
36template <typename Extension>
37class Data_extension final : public Data {
38 public:
39 /** Constructor */
40 Data_extension(const data::Data data, const Extension ext)
41 : data::Data(data), ext_(ext) {}
42 Data_extension() : Data_extension(data::Data{}, Extension{}) {}
44 Data_extension(const Extension ext) : Data_extension(data::Data{}, ext) {}
45
46 /** Copy constructor */
48 : Data_extension(src.get_data(), src.ext_) {}
49
50 /** Assignment operator */
52 Data::operator=(src);
53 ext_ = src.ext_;
54
55 return *this;
56 }
57
58 /* Get data */
59 const data::Data get_data() const override { return Data::get_data(); }
60
61 /* Get Metadata extension details */
62 const Extension get_extension() const { return ext_; }
63
64 /* Set data */
65 void set_data(const data::Data &data) override { Data::operator=(data); }
66 /* Set metadata extension */
67 void set_extension(const Extension ext) { ext_ = ext; }
68
69 private:
70 /** Backend specific extensions */
71 Extension ext_;
72};
73
74} // namespace data
75
76} // namespace keyring_common
77
78#endif // !Data_extension_INCLUDED
Data wrapper to include backend specific extensions.
Definition: data_extension.h:37
void set_extension(const Extension ext)
Definition: data_extension.h:67
Extension ext_
Backend specific extensions.
Definition: data_extension.h:71
Data_extension(const data::Data data, const Extension ext)
Constructor.
Definition: data_extension.h:40
Data_extension()
Definition: data_extension.h:42
Data_extension(const data::Data data)
Definition: data_extension.h:43
Data_extension(const Extension ext)
Definition: data_extension.h:44
void set_data(const data::Data &data) override
Set data.
Definition: data_extension.h:65
const Extension get_extension() const
Definition: data_extension.h:62
const data::Data get_data() const override
Return self.
Definition: data_extension.h:59
Data_extension(const Data_extension &src)
Copy constructor.
Definition: data_extension.h:47
Data_extension & operator=(const Data_extension &src)
Assignment operator.
Definition: data_extension.h:51
Sensitive data storage.
Definition: data.h:40
Sensitive_data data() const
Get data.
Definition: data.cc:68
virtual const Data get_data() const
Return self.
Definition: data.cc:65
Data & operator=(const Data &src)
Definition: keyring_encryption_service_definition.h:32
Json_data_extension ext
Definition: backend.cc:52