Code

more unreffing temporary styles properly
[inkscape.git] / src / xml / repr.cpp
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 "xml/repr.h"
26 #include "xml/text-node.h"
27 #include "xml/element-node.h"
28 #include "xml/comment-node.h"
29 #include "xml/simple-document.h"
31 using Inkscape::Util::share_string;
33 /// Returns new document having as first child a node named rootname.
34 Inkscape::XML::Document *
35 sp_repr_document_new(char const *rootname)
36 {
37     Inkscape::XML::Document *doc = new Inkscape::XML::SimpleDocument();
38     if (!strcmp(rootname, "svg:svg")) {
39         doc->setAttribute("version", "1.0");
40         doc->setAttribute("standalone", "no");
41         Inkscape::XML::Node *comment = doc->createComment(" Created with Inkscape (http://www.inkscape.org/) ");
42         doc->appendChild(comment);
43         Inkscape::GC::release(comment);
44     }
46     Inkscape::XML::Node *root = doc->createElement(rootname);
47     doc->appendChild(root);
48     Inkscape::GC::release(root);
50     return doc;
51 }
53 /*
54   Local Variables:
55   mode:c++
56   c-file-style:"stroustrup"
57   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
58   indent-tabs-mode:nil
59   fill-column:99
60   End:
61 */
62 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :