Commit | Line | Data |
---|---|---|
cbe56571 TT |
1 | /* CLI stylizing |
2 | ||
42a4f53d | 3 | Copyright (C) 2018-2019 Free Software Foundation, Inc. |
cbe56571 TT |
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 | ||
1a5c2598 TT |
20 | #ifndef CLI_CLI_STYLE_H |
21 | #define CLI_CLI_STYLE_H | |
cbe56571 TT |
22 | |
23 | #include "ui-file.h" | |
24 | ||
25 | /* A single CLI style option. */ | |
26 | class cli_style_option | |
27 | { | |
28 | public: | |
29 | ||
30 | /* Construct a CLI style option with a foreground color. */ | |
31 | cli_style_option (ui_file_style::basic_color fg); | |
32 | ||
33 | /* Return a ui_file_style corresponding to the settings in this CLI | |
34 | style. */ | |
35 | ui_file_style style () const; | |
36 | ||
37 | /* Call once to register this CLI style with the CLI engine. */ | |
38 | void add_setshow_commands (const char *name, | |
39 | enum command_class theclass, | |
40 | const char *prefix_doc, | |
cbe56571 | 41 | struct cmd_list_element **set_list, |
d73cff18 PW |
42 | void (*do_set) (const char *args, int from_tty), |
43 | struct cmd_list_element **show_list, | |
44 | void (*do_show) (const char *args, int from_tty)); | |
45 | ||
46 | /* Return the 'set style NAME' command list, that can be used | |
47 | to build a lambda DO_SET to call add_setshow_commands. */ | |
48 | struct cmd_list_element *set_list () { return m_set_list; }; | |
49 | ||
50 | /* Same as SET_LIST but for the show command list. */ | |
51 | struct cmd_list_element *show_list () { return m_show_list; }; | |
cbe56571 TT |
52 | |
53 | private: | |
54 | ||
55 | /* The foreground. */ | |
56 | const char *m_foreground; | |
57 | /* The background. */ | |
58 | const char *m_background; | |
59 | /* The intensity. */ | |
60 | const char *m_intensity; | |
61 | ||
62 | /* Storage for prefixes needed when registering the commands. */ | |
63 | std::string m_show_prefix; | |
64 | std::string m_set_prefix; | |
65 | /* Storage for command lists needed when registering | |
66 | subcommands. */ | |
67 | struct cmd_list_element *m_set_list = nullptr; | |
68 | struct cmd_list_element *m_show_list = nullptr; | |
69 | ||
cbe56571 TT |
70 | /* Callback to show the foreground. */ |
71 | static void do_show_foreground (struct ui_file *file, int from_tty, | |
72 | struct cmd_list_element *cmd, | |
73 | const char *value); | |
74 | /* Callback to show the background. */ | |
75 | static void do_show_background (struct ui_file *file, int from_tty, | |
76 | struct cmd_list_element *cmd, | |
77 | const char *value); | |
78 | /* Callback to show the intensity. */ | |
79 | static void do_show_intensity (struct ui_file *file, int from_tty, | |
80 | struct cmd_list_element *cmd, | |
81 | const char *value); | |
82 | }; | |
83 | ||
84 | /* The file name style. */ | |
85 | extern cli_style_option file_name_style; | |
86 | ||
87 | /* The function name style. */ | |
88 | extern cli_style_option function_name_style; | |
89 | ||
80ae2043 TT |
90 | /* The variable name style. */ |
91 | extern cli_style_option variable_name_style; | |
92 | ||
35fb8261 TT |
93 | /* The address style. */ |
94 | extern cli_style_option address_style; | |
95 | ||
cbe56571 TT |
96 | /* True if styling is enabled. */ |
97 | extern int cli_styling; | |
98 | ||
1a5c2598 | 99 | #endif /* CLI_CLI_STYLE_H */ |