MySQL  8.0.27
Source Code Documentation
typelib.h
Go to the documentation of this file.
1 /* Copyright (c) 2000, 2021, 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 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 _typelib_h
24 #define _typelib_h
25 
26 /**
27  @file include/typelib.h
28 */
29 
30 #include "my_inttypes.h"
31 
32 struct MEM_ROOT;
33 
34 struct TYPELIB { /* Different types saved here */
35  size_t count{0}; /* How many types */
36  const char *name{nullptr}; /* Name of typelib */
37  const char **type_names{nullptr};
38  unsigned int *type_lengths{nullptr};
39 };
40 
41 extern uint64_t find_typeset(const char *x, TYPELIB *typelib,
42  int *error_position);
43 extern int find_type_or_exit(const char *x, TYPELIB *typelib,
44  const char *option);
45 #define FIND_TYPE_BASIC 0
46 /** makes @c find_type() require the whole name, no prefix */
47 #define FIND_TYPE_NO_PREFIX (1 << 0)
48 /** always implicitely on, so unused, but old code may pass it */
49 #define FIND_TYPE_NO_OVERWRITE (1 << 1)
50 /** makes @c find_type() accept a number */
51 #define FIND_TYPE_ALLOW_NUMBER (1 << 2)
52 /** makes @c find_type() treat ',' as terminator */
53 #define FIND_TYPE_COMMA_TERM (1 << 3)
54 
55 extern int find_type(const char *x, const TYPELIB *typelib, unsigned int flags);
56 extern const char *get_type(TYPELIB *typelib, unsigned int nr);
57 extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from);
58 
60 
61 uint64_t find_set_from_flags(const TYPELIB *lib, int default_name,
62  uint64_t cur_set, uint64_t default_set,
63  const char *str, unsigned int length,
64  const char **err_pos, unsigned int *err_len);
65 
66 #endif /* _typelib_h */
static int flags[50]
Definition: hp_test1.cc:39
Some integer typedefs for easier portability.
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1056
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:75
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:78
Definition: typelib.h:34
const char ** type_names
Definition: typelib.h:37
size_t count
Definition: typelib.h:35
const char * name
Definition: typelib.h:36
unsigned int * type_lengths
Definition: typelib.h:38
const char * get_type(TYPELIB *typelib, unsigned int nr)
Get type.
Definition: typelib.cc:140
int find_type_or_exit(const char *x, TYPELIB *typelib, const char *option)
Definition: typelib.cc:48
int find_type(const char *x, const TYPELIB *typelib, unsigned int flags)
Search after a string in a list of strings.
Definition: typelib.cc:86
TYPELIB sql_protocol_typelib
Definition: client.cc:2025
uint64_t find_typeset(const char *x, TYPELIB *typelib, int *error_position)
Create an integer value to represent the supplied comma-separated string where each string in the TYP...
Definition: typelib.cc:159
TYPELIB * copy_typelib(MEM_ROOT *root, TYPELIB *from)
Create a copy of a specified TYPELIB structure.
Definition: typelib.cc:197
uint64_t find_set_from_flags(const TYPELIB *lib, int default_name, uint64_t cur_set, uint64_t default_set, const char *str, unsigned int length, const char **err_pos, unsigned int *err_len)
Parse and apply a set of flag assingments.
Definition: typelib.cc:297