MySQL  8.0.17
Source Code Documentation
my_metadata.h
Go to the documentation of this file.
1 /* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
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 also distributed 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 included with MySQL.
13 
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 #ifndef MYSQL_REGISTRY_METADATA_H
24 #define MYSQL_REGISTRY_METADATA_H
25 
26 #include <memory>
27 #include <string>
28 #include <unordered_map>
29 
30 typedef std::string my_string;
31 
32 typedef std::unordered_map<my_string, my_string>
34 
35 /**
36  The metadata class used by both the registry and the dynamic loader services
37  to store and manage metadata information related to specified objects.
38 */
39 class my_metadata {
40  protected:
42 
43  public:
44  my_metadata();
45  my_metadata(my_metadata &other);
46 
47  /**
48  The data type of the iterator used.
49  Keep consistent with the type of the underlying data structure
50  */
52  : public my_unordered_string_to_string_map::const_iterator {
54 
55  public:
56  const_iterator(my_unordered_string_to_string_map::const_iterator iter,
58 
60  bool is_at_end();
61  };
62 
63  /* update service */
64  bool set_value(const char *name, const char *value);
65 
66  /* query service */
67  bool get_value(const char *name, const char **value);
68 
69  /* enumeration service */
70 
72 
73  static bool release_iterator(const_iterator *iter);
74 };
75 
76 #endif /* MYSQL_REGISTRY_METADATA_H */
static bool release_iterator(const_iterator *iter)
Frees an iterator over the metadata.
Definition: my_metadata.cc:123
The metadata class used by both the registry and the dynamic loader services to store and manage meta...
Definition: my_metadata.h:39
const string name("\ame\)
const_iterator create_iterator()
Creates an iterator over the metadata.
Definition: my_metadata.cc:110
std::string my_string
Definition: my_metadata.h:30
The data type of the iterator used.
Definition: my_metadata.h:51
bool get_value(const char *name, const char **value)
Gets value for the name specified.
Definition: my_metadata.cc:89
my_metadata()
Definition: my_metadata.cc:25
const_iterator(my_unordered_string_to_string_map::const_iterator iter, my_unordered_string_to_string_map *data_arg)
Definition: my_metadata.cc:29
bool is_at_end()
Checks if iterator is pointing behind the end element.
Definition: my_metadata.cc:44
my_unordered_string_to_string_map * data
Definition: my_metadata.h:53
my_unordered_string_to_string_map data
Definition: my_metadata.h:41
my_unordered_string_to_string_map * get_data()
Gets pointer to structure the iterator is iterating over.
Definition: my_metadata.cc:37
const string value("\alue\)
std::unordered_map< my_string, my_string > my_unordered_string_to_string_map
Definition: my_metadata.h:33
bool set_value(const char *name, const char *value)
Sets a value for the name specified.
Definition: my_metadata.cc:60