Code

Added test script I thought was already added.
[inkscape.git] / src / sp-desc.cpp
1 #define __SP_DESC_C__
3 /*
4  * SVG <desc> implementation
5  *
6  * Authors:
7  *   Jeff Schiller <codedread@gmail.com>
8  *
9  * Copyright (C) 2008 Jeff Schiller
10  *
11  * Released under GNU GPL, read the file 'COPYING' for more information
12  */
14 #ifdef HAVE_CONFIG_H
15 # include "config.h"
16 #endif
18 #include "sp-desc.h"
19 #include "xml/repr.h"
21 static void sp_desc_class_init(SPDescClass *klass);
22 static void sp_desc_init(SPDesc *rect);
23 static Inkscape::XML::Node *sp_desc_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
25 static SPObjectClass *desc_parent_class;
27 GType
28 sp_desc_get_type (void)
29 {
30     static GType desc_type = 0;
32     if (!desc_type) {
33         GTypeInfo desc_info = {
34             sizeof (SPDescClass),
35             NULL, NULL,
36             (GClassInitFunc) sp_desc_class_init,
37             NULL, NULL,
38             sizeof (SPDesc),
39             16,
40             (GInstanceInitFunc) sp_desc_init,
41             NULL,    /* value_table */
42         };
43         desc_type = g_type_register_static (SP_TYPE_OBJECT, "SPDesc", &desc_info, (GTypeFlags)0);
44     }
45     return desc_type;
46 }
48 static void
49 sp_desc_class_init(SPDescClass *klass)
50 {
51     SPObjectClass *sp_object_class = (SPObjectClass *) klass;
52     desc_parent_class = (SPObjectClass *) g_type_class_ref(SP_TYPE_OBJECT);;
54     sp_object_class->write = sp_desc_write;
55 }
57 static void
58 sp_desc_init(SPDesc */*desc*/)
59 {
60 }
62 /*
63  * \brief Writes it's settings to an incoming repr object, if any
64  */
65 static Inkscape::XML::Node *
66 sp_desc_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags)
67 {
68     if (!repr) {
69         repr = SP_OBJECT_REPR (object)->duplicate(doc);
70     }
72     if (((SPObjectClass *) desc_parent_class)->write)
73         ((SPObjectClass *) desc_parent_class)->write(object, doc, repr, flags);
75     return repr;
76 }