1 /* GNU gettext - internationalization aids
2 Copyright (C) 1995-1998, 2000-2003, 2006, 2008, 2019, 2021 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 uses Unicode control characters to protect
43 against filenames with spaces. */
44 bool requires_utf8_for_filenames_with_spaces;
45
46 /* Whether the print function supports styled output. */
47 bool supports_color;
48
49 /* Whether the format supports multiple domains in a single file. */
50 bool supports_multiple_domains;
51
52 /* Whether the format supports contexts. */
53 bool supports_contexts;
54
55 /* Whether the format supports plurals. */
56 bool supports_plurals;
57
58 /* Whether the formats sorts obsolete messages at the end. */
59 bool sorts_obsoletes_to_end;
60
61 /* Whether the PO file format is a suitable alternative output format for
62 this one. */
63 bool alternative_is_po;
64
65 /* Whether a Java class is a suitable alternative output format for this
66 one. */
67 bool alternative_is_java_class;
68 };
69
70 typedef const struct catalog_output_format * catalog_output_format_ty;
71
72 /* These functions set some parameters for use by 'msgdomain_list_print'. */
73 extern void
74 message_page_width_set (size_t width);
75
76 /* Output MDLP into a PO file with the given FILENAME, according to the
77 parameters set by the functions above. */
78 extern void
79 msgdomain_list_print (msgdomain_list_ty *mdlp,
80 const char *filename,
81 catalog_output_format_ty output_syntax,
82 bool force, bool debug);
83
84 /* Sort MDLP destructively according to the given criterion. */
85 extern void
86 msgdomain_list_sort_by_msgid (msgdomain_list_ty *mdlp);
87 extern void
88 msgdomain_list_sort_by_filepos (msgdomain_list_ty *mdlp);
89
90
91 #ifdef __cplusplus
92 }
93 #endif
94
95
96 #endif /* _WRITE_CATALOG_H */