MySQL 8.0.39
Source Code Documentation
abstract_value_option.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2014, 2024, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is designed to work with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have either included with
14 the program or referenced in the documentation.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License, version 2.0, for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24*/
25
26#ifndef ABSTRACT_VALUE_OPTION_INCLUDED
27#define ABSTRACT_VALUE_OPTION_INCLUDED
28
29#include <string>
30
32#include "my_getopt.h"
33
34namespace Mysql {
35namespace Tools {
36namespace Base {
37namespace Options {
38
39/**
40 Abstract option to handle options accepting value argument.
41 */
42template <typename T_type>
43class Abstract_value_option : public Abstract_option<T_type> {
44 public:
45 /**
46 Sets arg_type to OPT_ARG - doesn't require argument to be specified when
47 using this option.
48 */
49 T_type *value_optional();
50
51 protected:
52 /**
53 Constructs new option with value argument.
54 @param value Pointer to object to receive option value.
55 @param var_type my_getopt internal option type.
56 @param name Name of option. It is used in command line option name as
57 --name.
58 @param description Description of option to be printed in --help.
59 @param default_value default value to be supplied to internal option
60 data structure.
61 */
62 Abstract_value_option(void *value, ulong var_type, std::string name,
63 std::string description, uint64 default_value);
64};
65
66template <typename T_type>
68 ulong var_type,
69 std::string name,
70 std::string description,
71 uint64 default_value)
72 : Abstract_option<T_type>(value, var_type, name, description,
73 default_value) {}
74
75template <typename T_type>
77 this->m_option_structure.arg_type = OPT_ARG;
78 return (T_type *)this;
79}
80
81} // namespace Options
82} // namespace Base
83} // namespace Tools
84} // namespace Mysql
85#endif
Abstract base with common option functionalities.
Definition: abstract_option.h:50
Abstract option to handle options accepting value argument.
Definition: abstract_value_option.h:43
Abstract_value_option(void *value, ulong var_type, std::string name, std::string description, uint64 default_value)
Constructs new option with value argument.
Definition: abstract_value_option.h:67
T_type * value_optional()
Sets arg_type to OPT_ARG - doesn't require argument to be specified when using this option.
Definition: abstract_value_option.h:76
@ OPT_ARG
Definition: my_getopt.h:81
uint64_t uint64
Definition: my_inttypes.h:69
constexpr pos_type Options
Definition: http_request.h:261
Definition: abstract_connection_program.h:38
case opt name
Definition: sslopt-case.h:33