1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Code to handle compressed SVG loading and saving. Almost identical to svg
4  * routines, but separated for simpler extension maintenance.
5  *
6  * Authors:
7  *   Lauris Kaplinski <lauris@kaplinski.com>
8  *   Ted Gould <ted@gould.cx>
9  *   Jon A. Cruz <jon@joncruz.org>
10  *
11  * Copyright (C) 2002-2005 Authors
12  *
13  * Released under GNU GPL v2+, read the file 'COPYING' for more information.
14  */
15 
16 #include "svgz.h"
17 #include "extension/extension.h"
18 #include "extension/system.h"
19 
20 namespace Inkscape {
21 namespace Extension {
22 namespace Internal {
23 
24 #include "clear-n_.h"
25 
26 /**
27     \return   None
28     \brief    What would an SVG editor be without loading/saving SVG
29               files.  This function sets that up.
30 
31     For each module there is a call to Inkscape::Extension::build_from_mem
32     with a rather large XML file passed in.  This is a constant string
33     that describes the module.  At the end of this call a module is
34     returned that is basically filled out.  The one thing that it doesn't
35     have is the key function for the operation.  And that is linked at
36     the end of each call.
37 */
38 void
init()39 Svgz::init()
40 {
41     // clang-format off
42     /* SVGZ in */
43     Inkscape::Extension::build_from_mem(
44         "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
45             "<name>" N_("SVGZ Input") "</name>\n"
46             "<id>" SP_MODULE_KEY_INPUT_SVGZ "</id>\n"
47             "<dependency type=\"extension\">" SP_MODULE_KEY_INPUT_SVG "</dependency>\n"
48             SVG_COMMON_INPUT_PARAMS
49             "<input>\n"
50                 "<extension>.svgz</extension>\n"
51                 "<mimetype>image/svg+xml-compressed</mimetype>\n"
52                 "<filetypename>" N_("Compressed Inkscape SVG (*.svgz)") "</filetypename>\n"
53                 "<filetypetooltip>" N_("SVG file format compressed with GZip") "</filetypetooltip>\n"
54             "</input>\n"
55         "</inkscape-extension>", new Svgz());
56 
57     /* SVGZ out Inkscape */
58     Inkscape::Extension::build_from_mem(
59         "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
60             "<name>" N_("SVGZ Output") "</name>\n"
61             "<id>" SP_MODULE_KEY_OUTPUT_SVGZ_INKSCAPE "</id>\n"
62             "<output>\n"
63                 "<extension>.svgz</extension>\n"
64                 "<mimetype>image/x-inkscape-svg-compressed</mimetype>\n"
65                 "<filetypename>" N_("Compressed Inkscape SVG (*.svgz)") "</filetypename>\n"
66                 "<filetypetooltip>" N_("Inkscape's native file format compressed with GZip") "</filetypetooltip>\n"
67                 "<dataloss>false</dataloss>\n"
68             "</output>\n"
69         "</inkscape-extension>", new Svgz());
70 
71     /* SVGZ out */
72     Inkscape::Extension::build_from_mem(
73         "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
74             "<name>" N_("SVGZ Output") "</name>\n"
75             "<id>" SP_MODULE_KEY_OUTPUT_SVGZ "</id>\n"
76             "<output>\n"
77                 "<extension>.svgz</extension>\n"
78                 "<mimetype>image/svg+xml-compressed</mimetype>\n"
79                 "<filetypename>" N_("Compressed plain SVG (*.svgz)") "</filetypename>\n"
80                 "<filetypetooltip>" N_("Scalable Vector Graphics format compressed with GZip") "</filetypetooltip>\n"
81             "</output>\n"
82         "</inkscape-extension>\n", new Svgz());
83     // clang-format on
84 
85     return;
86 }
87 
88 
89 } } }  // namespace inkscape, module, implementation
90 
91 /*
92   Local Variables:
93   mode:c++
94   c-file-style:"stroustrup"
95   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
96   indent-tabs-mode:nil
97   fill-column:99
98   End:
99 */
100 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
101