Imported Upstream version 0.18.3.2
[platform/upstream/gettext.git] / gettext-tools / src / write-catalog.h
1 /* GNU gettext - internationalization aids
2    Copyright (C) 1995-1998, 2000-2003, 2006, 2008 Free Software Foundation, Inc.
3
4    This program is free software: you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 3 of the License, or
7    (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
16
17 #ifndef _WRITE_CATALOG_H
18 #define _WRITE_CATALOG_H
19
20 #include <stdbool.h>
21
22 #include "ostream.h"
23 #include "message.h"
24
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30
31 /* This structure describes a textual catalog output format.  */
32 struct catalog_output_format
33 {
34   /* Outputs a list of domains of messages to a stream.  */
35   void (*print) (msgdomain_list_ty *mdlp, ostream_t stream, size_t page_width, bool debug);
36
37   /* Whether the print function requires the MDLP to be encoded in UTF-8
38      encoding.  */
39   bool requires_utf8;
40
41   /* Whether the print function supports styled output.  */
42   bool supports_color;
43
44   /* Whether the format supports multiple domains in a single file.  */
45   bool supports_multiple_domains;
46
47   /* Whether the format supports contexts.  */
48   bool supports_contexts;
49
50   /* Whether the format supports plurals.  */
51   bool supports_plurals;
52
53   /* Whether the formats sorts obsolete messages at the end.  */
54   bool sorts_obsoletes_to_end;
55
56   /* Whether the PO file format is a suitable alternative output format for
57      this one.  */
58   bool alternative_is_po;
59
60   /* Whether a Java class is a suitable alternative output format for this
61      one.  */
62   bool alternative_is_java_class;
63 };
64
65 typedef const struct catalog_output_format * catalog_output_format_ty;
66
67 /* These functions set some parameters for use by 'msgdomain_list_print'.  */
68 extern void
69        message_page_width_set (size_t width);
70
71 /* Output MDLP into a PO file with the given FILENAME, according to the
72    parameters set by the functions above.  */
73 extern void
74        msgdomain_list_print (msgdomain_list_ty *mdlp,
75                              const char *filename,
76                              catalog_output_format_ty output_syntax,
77                              bool force, bool debug);
78
79 /* Sort MDLP destructively according to the given criterion.  */
80 extern void
81        msgdomain_list_sort_by_msgid (msgdomain_list_ty *mdlp);
82 extern void
83        msgdomain_list_sort_by_filepos (msgdomain_list_ty *mdlp);
84
85
86 #ifdef __cplusplus
87 }
88 #endif
89
90
91 #endif /* _WRITE_CATALOG_H */