diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:24:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:24:48 +0000 |
commit | cca66b9ec4e494c1d919bff0f71a820d8afab1fa (patch) | |
tree | 146f39ded1c938019e1ed42d30923c2ac9e86789 /src/xml/repr.cpp | |
parent | Initial commit. (diff) | |
download | inkscape-cca66b9ec4e494c1d919bff0f71a820d8afab1fa.tar.xz inkscape-cca66b9ec4e494c1d919bff0f71a820d8afab1fa.zip |
Adding upstream version 1.2.2.upstream/1.2.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/xml/repr.cpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/xml/repr.cpp b/src/xml/repr.cpp new file mode 100644 index 0000000..8988586 --- /dev/null +++ b/src/xml/repr.cpp @@ -0,0 +1,59 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/** \file + * A few non-inline functions of the C facade to Inkscape::XML::Node. + */ + +/* + * Authors: + * Lauris Kaplinski <lauris@kaplinski.com> + * MenTaLguY <mental@rydia.net> + * + * Copyright (C) 1999-2003 authors + * Copyright (C) 2000-2002 Ximian, Inc. + * g++ port Copyright (C) 2003 Nathan Hurst + * + * Released under GNU GPL v2+, read the file 'COPYING' for more information. + */ + +#define noREPR_VERBOSE + +#include <cstring> + +#include "xml/repr.h" +#include "xml/text-node.h" +#include "xml/element-node.h" +#include "xml/comment-node.h" +#include "xml/simple-document.h" + +using Inkscape::Util::share_string; + +/// Returns new document having as first child a node named rootname. +Inkscape::XML::Document * +sp_repr_document_new(char const *rootname) +{ + Inkscape::XML::Document *doc = new Inkscape::XML::SimpleDocument(); + if (!strcmp(rootname, "svg:svg")) { + doc->setAttribute("version", "1.0"); + doc->setAttribute("standalone", "no"); + Inkscape::XML::Node *comment = doc->createComment(" Created with Inkscape (http://www.inkscape.org/) "); + doc->appendChild(comment); + Inkscape::GC::release(comment); + } + + Inkscape::XML::Node *root = doc->createElement(rootname); + doc->appendChild(root); + Inkscape::GC::release(root); + + return doc; +} + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : |