Revert "packaging: Add gdb packages"
[external/binutils.git] / gdb / cli / cli-style.h
1 /* CLI stylizing
2
3    Copyright (C) 2018-2019 Free Software Foundation, Inc.
4
5    This file is part of GDB.
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19
20 #ifndef CLI_CLI_STYLE_H
21 #define CLI_CLI_STYLE_H
22
23 #include "ui-file.h"
24 #include "command.h"
25
26 /* A single CLI style option.  */
27 class cli_style_option
28 {
29 public:
30
31   /* Construct a CLI style option with a foreground color.  */
32   cli_style_option (const char *name, ui_file_style::basic_color fg);
33
34   /* Construct a CLI style option with an intensity.  */
35   cli_style_option (const char *name, ui_file_style::intensity i);
36
37   /* Return a ui_file_style corresponding to the settings in this CLI
38      style.  */
39   ui_file_style style () const;
40
41   /* Return the style name.  */
42   const char *name () { return m_name; };
43
44   /* Call once to register this CLI style with the CLI engine.  */
45   void add_setshow_commands (enum command_class theclass,
46                              const char *prefix_doc,
47                              struct cmd_list_element **set_list,
48                              void (*do_set) (const char *args, int from_tty),
49                              struct cmd_list_element **show_list,
50                              void (*do_show) (const char *args, int from_tty));
51
52   /* Return the 'set style NAME' command list, that can be used
53      to build a lambda DO_SET to call add_setshow_commands.  */
54   struct cmd_list_element *set_list () { return m_set_list; };
55
56   /* Same as SET_LIST but for the show command list.  */
57   struct cmd_list_element *show_list () { return m_show_list; };
58
59 private:
60
61   /* The style name.  */
62   const char *m_name;
63
64   /* The foreground.  */
65   const char *m_foreground;
66   /* The background.  */
67   const char *m_background;
68   /* The intensity.  */
69   const char *m_intensity;
70
71   /* Storage for prefixes needed when registering the commands.  */
72   std::string m_show_prefix;
73   std::string m_set_prefix;
74   /* Storage for command lists needed when registering
75      subcommands.  */
76   struct cmd_list_element *m_set_list = nullptr;
77   struct cmd_list_element *m_show_list = nullptr;
78
79   /* Callback to show the foreground.  */
80   static void do_show_foreground (struct ui_file *file, int from_tty,
81                                   struct cmd_list_element *cmd,
82                                   const char *value);
83   /* Callback to show the background.  */
84   static void do_show_background (struct ui_file *file, int from_tty,
85                                   struct cmd_list_element *cmd,
86                                   const char *value);
87   /* Callback to show the intensity.  */
88   static void do_show_intensity (struct ui_file *file, int from_tty,
89                                  struct cmd_list_element *cmd,
90                                  const char *value);
91 };
92
93 /* The file name style.  */
94 extern cli_style_option file_name_style;
95
96 /* The function name style.  */
97 extern cli_style_option function_name_style;
98
99 /* The variable name style.  */
100 extern cli_style_option variable_name_style;
101
102 /* The address style.  */
103 extern cli_style_option address_style;
104
105 /* The highlight style.  */
106 extern cli_style_option highlight_style;
107
108 /* The title style.  */
109 extern cli_style_option title_style;
110
111
112 /* True if source styling is enabled.  */
113 extern int source_styling;
114
115 /* True if styling is enabled.  */
116 extern int cli_styling;
117
118 #endif /* CLI_CLI_STYLE_H */