abg-writer: Refactor write_corpus_group API
[platform/upstream/libabigail.git] / include / abg-writer.h
1 // -*- Mode: C++ -*-
2 //
3 // Copyright (C) 2013-2019 Red Hat, Inc.
4 //
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
10 // later version.
11
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.
16
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/>.
20 //
21 // Author: Dodji Seketeli
22
23 /// @file
24 ///
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.
28
29 #ifndef __ABG_WRITER_H__
30 #define __ABG_WRITER_H__
31
32 #include "abg-fwd.h"
33
34 namespace abigail
35 {
36 namespace xml_writer
37 {
38
39 using namespace abigail::ir;
40
41 class write_context;
42
43 /// A convenience typedef for a shared pointer to write_context.
44 typedef shared_ptr<write_context> write_context_sptr;
45
46 write_context_sptr
47 create_write_context(const environment *env,
48                      ostream& output_stream);
49
50 void
51 set_show_locs(write_context& ctxt, bool flag);
52
53 void
54 set_annotate(write_context& ctxt, bool flag);
55
56 bool
57 write_translation_unit(write_context&          ctxt,
58                        const translation_unit& tu,
59                        const unsigned          indent);
60
61 bool ABG_DEPRECATED
62 write_translation_unit(const translation_unit& tu,
63                        unsigned                indent,
64                        std::ostream&           out,
65                        const bool              annotate = false);
66
67 bool ABG_DEPRECATED
68 write_translation_unit(const translation_unit& tu,
69                        unsigned                indent,
70                        const string&           path,
71                        const bool              annotate = false);
72
73 bool
74 write_corpus_to_archive(const corpus& corp,
75                         const string& path,
76                         const bool  annotate = false);
77
78 bool
79 write_corpus_to_archive(const corpus& corp,
80                         const bool annotate = false);
81
82 bool
83 write_corpus_to_archive(const corpus_sptr corp,
84                         const bool annotate = false);
85
86 bool
87 write_corpus(write_context& ctxt, const corpus_sptr& corpus, unsigned indent);
88
89 bool ABG_DEPRECATED
90 write_corpus(const corpus_sptr& corpus, unsigned indent, write_context& ctxt);
91
92 bool ABG_DEPRECATED
93 write_corpus(const corpus_sptr corpus,
94              unsigned          indent,
95              std::ostream&     out,
96              const bool        annotate = false);
97
98 bool ABG_DEPRECATED
99 write_corpus(const corpus_sptr corpus,
100              unsigned          indent,
101              const string&     path,
102              const bool        annotate = false);
103
104 bool
105 write_corpus_group(write_context&           ctx,
106                    const corpus_group_sptr& group,
107                    unsigned                 indent);
108
109 bool ABG_DEPRECATED
110 write_corpus_group(const corpus_group_sptr& group,
111                    unsigned                 indent,
112                    write_context&           ctxt);
113
114 bool ABG_DEPRECATED
115 write_corpus_group(const corpus_group_sptr& group,
116                    unsigned                 indent,
117                    std::ostream&            out,
118                    const bool               annotate = false);
119
120 bool ABG_DEPRECATED
121 write_corpus_group(const corpus_group_sptr& group,
122                    unsigned                 indent,
123                    const string&            path,
124                    const bool               annotate = false);
125
126 }// end namespace xml_writer
127 }// end namespace abigail
128
129 #endif //  __ABG_WRITER_H__