• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GNU gettext - internationalization aids
2    Copyright (C) 1995-1998, 2000-2003, 2006, 2008, 2019 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 <https://www.gnu.org/licenses/>.  */
16 
17 #ifndef _WRITE_CATALOG_H
18 #define _WRITE_CATALOG_H
19 
20 #include <stdbool.h>
21 
22 #include <textstyle.h>
23 
24 #include "message.h"
25 
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 
32 /* This structure describes a textual catalog output format.  */
33 struct catalog_output_format
34 {
35   /* Outputs a list of domains of messages to a stream.  */
36   void (*print) (msgdomain_list_ty *mdlp, ostream_t stream, size_t page_width, bool debug);
37 
38   /* Whether the print function requires the MDLP to be encoded in UTF-8
39      encoding.  */
40   bool requires_utf8;
41 
42   /* Whether the print function supports styled output.  */
43   bool supports_color;
44 
45   /* Whether the format supports multiple domains in a single file.  */
46   bool supports_multiple_domains;
47 
48   /* Whether the format supports contexts.  */
49   bool supports_contexts;
50 
51   /* Whether the format supports plurals.  */
52   bool supports_plurals;
53 
54   /* Whether the formats sorts obsolete messages at the end.  */
55   bool sorts_obsoletes_to_end;
56 
57   /* Whether the PO file format is a suitable alternative output format for
58      this one.  */
59   bool alternative_is_po;
60 
61   /* Whether a Java class is a suitable alternative output format for this
62      one.  */
63   bool alternative_is_java_class;
64 };
65 
66 typedef const struct catalog_output_format * catalog_output_format_ty;
67 
68 /* These functions set some parameters for use by 'msgdomain_list_print'.  */
69 extern void
70        message_page_width_set (size_t width);
71 
72 /* Output MDLP into a PO file with the given FILENAME, according to the
73    parameters set by the functions above.  */
74 extern void
75        msgdomain_list_print (msgdomain_list_ty *mdlp,
76                              const char *filename,
77                              catalog_output_format_ty output_syntax,
78                              bool force, bool debug);
79 
80 /* Sort MDLP destructively according to the given criterion.  */
81 extern void
82        msgdomain_list_sort_by_msgid (msgdomain_list_ty *mdlp);
83 extern void
84        msgdomain_list_sort_by_filepos (msgdomain_list_ty *mdlp);
85 
86 
87 #ifdef __cplusplus
88 }
89 #endif
90 
91 
92 #endif /* _WRITE_CATALOG_H */
93