3 // Copyright (C) 2013-2019 Red Hat, Inc.
5 // This file is part of the GNU Application Binary Interface Generic
6 // Analysis and Instrumentation Library (libabigail). This library is
7 // free software; you can redistribute it and/or modify it under the
8 // terms of the GNU Lesser General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option) any
12 // This library is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Lesser Public License for more details.
17 // You should have received a copy of the GNU Lesser General Public
18 // License along with this program; see the file COPYING-LGPLV3. If
19 // not, see <http://www.gnu.org/licenses/>.
21 // Author: Dodji Seketeli
25 /// This file contains the declarations of the entry points to
26 /// de-serialize an instance of @ref abigail::translation_unit to an
27 /// ABI Instrumentation file in libabigail native XML format.
29 #ifndef __ABG_WRITER_H__
30 #define __ABG_WRITER_H__
39 using namespace abigail::ir;
43 /// A convenience typedef for a shared pointer to write_context.
44 typedef shared_ptr<write_context> write_context_sptr;
47 create_write_context(const environment *env,
48 ostream& output_stream);
51 set_show_locs(write_context& ctxt, bool flag);
54 set_annotate(write_context& ctxt, bool flag);
57 /// A convenience generic function to set common options (usually used
58 /// by Libabigail tools) from a generic options carrying-object, into
59 /// a given @ref write_context.
61 /// @param ctxt the @ref the write_context to consider.
63 /// @param opts the option-carrying object to set the options from.
64 /// It must contain data members named: annotate, and show_locs, at
66 template <typename OPTS>
68 set_common_options(write_context& ctxt, const OPTS& opts)
70 set_annotate(ctxt, opts.annotate);
71 set_show_locs(ctxt, opts.show_locs);
75 set_ostream(write_context& ctxt, ostream& os);
78 write_translation_unit(write_context& ctxt,
79 const translation_unit& tu,
80 const unsigned indent);
83 write_translation_unit(const translation_unit& tu,
86 const bool annotate = false);
89 write_translation_unit(const translation_unit& tu,
92 const bool annotate = false);
95 write_corpus_to_archive(const corpus& corp,
97 const bool annotate = false);
100 write_corpus_to_archive(const corpus& corp,
101 const bool annotate = false);
104 write_corpus_to_archive(const corpus_sptr corp,
105 const bool annotate = false);
108 write_corpus(write_context& ctxt, const corpus_sptr& corpus, unsigned indent);
111 write_corpus(const corpus_sptr& corpus, unsigned indent, write_context& ctxt);
114 write_corpus(const corpus_sptr corpus,
117 const bool annotate = false);
120 write_corpus(const corpus_sptr corpus,
123 const bool annotate = false);
126 write_corpus_group(write_context& ctx,
127 const corpus_group_sptr& group,
131 write_corpus_group(const corpus_group_sptr& group,
133 write_context& ctxt);
136 write_corpus_group(const corpus_group_sptr& group,
139 const bool annotate = false);
142 write_corpus_group(const corpus_group_sptr& group,
145 const bool annotate = false);
147 }// end namespace xml_writer
148 }// end namespace abigail
150 #endif // __ABG_WRITER_H__