Line data Source code
1 : /* Copyright (C) 2026 Free Software Foundation, Inc.
2 : Contributed by David Malcolm <dmalcolm@redhat.com>
3 :
4 : This file is part of GCC.
5 :
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.
10 :
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.
15 :
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/>. */
19 :
20 : #ifndef GCC_PRETTY_PRINT_MARKUP_JSON_H
21 : #define GCC_PRETTY_PRINT_MARKUP_JSON_H
22 :
23 : #include "pretty-print-markup.h"
24 :
25 : namespace pp_markup {
26 :
27 : /* Print the JSON Pointer of a given json::value in quotes. */
28 :
29 32 : class quoted_json_pointer : public pp_element
30 : {
31 : public:
32 32 : quoted_json_pointer (const json::value &js_val)
33 32 : : m_js_val (js_val)
34 : {
35 : }
36 :
37 : void
38 32 : add_to_phase_2 (context &ctxt) final override
39 : {
40 32 : ctxt.begin_quote ();
41 32 : m_js_val.print_pointer (&ctxt.m_pp);
42 32 : ctxt.end_quote ();
43 32 : }
44 :
45 : private:
46 : const json::value &m_js_val;
47 : };
48 :
49 : } // namespace pp_markup
50 :
51 : #endif /* GCC_PRETTY_PRINT_MARKUP_JSON_H */
|