1 #define __SP_REPR_C__
3 /** \file
4 * A few non-inline functions of the C facade to Inkscape::XML::Node.
5 */
7 /*
8 * Authors:
9 * Lauris Kaplinski <lauris@kaplinski.com>
10 * MenTaLguY <mental@rydia.net>
11 *
12 * Copyright (C) 1999-2003 authors
13 * Copyright (C) 2000-2002 Ximian, Inc.
14 * g++ port Copyright (C) 2003 Nathan Hurst
15 *
16 * Released under GNU GPL, read the file 'COPYING' for more information
17 */
19 #define noREPR_VERBOSE
21 #ifdef HAVE_CONFIG_H
22 # include "config.h"
23 #endif
25 #include <cstring>
27 #include "xml/repr.h"
28 #include "xml/text-node.h"
29 #include "xml/element-node.h"
30 #include "xml/comment-node.h"
31 #include "xml/simple-document.h"
33 using Inkscape::Util::share_string;
35 /// Returns new document having as first child a node named rootname.
36 Inkscape::XML::Document *
37 sp_repr_document_new(char const *rootname)
38 {
39 Inkscape::XML::Document *doc = new Inkscape::XML::SimpleDocument();
40 if (!strcmp(rootname, "svg:svg")) {
41 doc->setAttribute("version", "1.0");
42 doc->setAttribute("standalone", "no");
43 Inkscape::XML::Node *comment = doc->createComment(" Created with Inkscape (http://www.inkscape.org/) ");
44 doc->appendChild(comment);
45 Inkscape::GC::release(comment);
46 }
48 Inkscape::XML::Node *root = doc->createElement(rootname);
49 doc->appendChild(root);
50 Inkscape::GC::release(root);
52 return doc;
53 }
55 /*
56 Local Variables:
57 mode:c++
58 c-file-style:"stroustrup"
59 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
60 indent-tabs-mode:nil
61 fill-column:99
62 End:
63 */
64 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :