libstdc++: Simplify std::any to fix -Wdeprecated-declarations warning
[official-gcc.git] / gcc / pretty-print-markup.h
blobce2c5e9dbbe99fcebbf75e251d7a1f3e7c7196bf
1 /* Copyright (C) 2024 Free Software Foundation, Inc.
2 Contributed by David Malcolm <dmalcolm@redhat.com>
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
20 #ifndef GCC_PRETTY_PRINT_MARKUP_H
21 #define GCC_PRETTY_PRINT_MARKUP_H
23 #include "diagnostic-color.h"
25 class pp_token_list;
27 namespace pp_markup {
29 class context
31 public:
32 context (pretty_printer &pp,
33 output_buffer &buf,
34 unsigned chunk_idx,
35 bool &quoted,
36 pp_token_list *formatted_token_list)
37 : m_pp (pp),
38 m_buf (buf),
39 m_chunk_idx (chunk_idx),
40 m_quoted (quoted),
41 m_formatted_token_list (formatted_token_list)
45 void begin_quote ();
46 void end_quote ();
48 void begin_highlight_color (const char *color_name);
49 void end_highlight_color ();
51 void push_back_any_text ();
53 pretty_printer &m_pp;
54 output_buffer &m_buf;
55 unsigned m_chunk_idx;
56 bool &m_quoted;
57 pp_token_list *m_formatted_token_list;
60 /* Abstract base class for use in pp_format for handling "%e".
61 This can add arbitrary content to the buffer being constructed, and
62 isolates the non-typesafe part of the formatting call in one place. */
64 class element
66 public:
67 virtual ~element () {}
68 virtual void add_to_phase_2 (context &ctxt) = 0;
70 protected:
71 element () {}
73 private:
74 DISABLE_COPY_AND_ASSIGN (element);
77 } // namespace pp_markup
79 #endif /* GCC_PRETTY_PRINT_MARKUP_H */