1 /* $Id$
2  *
3  * Lasso - A free implementation of the Liberty Alliance specifications.
4  *
5  * Copyright (C) 2004-2007 Entr'ouvert
6  * http://lasso.entrouvert.org
7  *
8  * Authors: See AUTHORS file in top-level directory.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 #include "private.h"
25 #include "sa_transform.h"
26 #include "idwsf_strings.h"
27 
28 /**
29  * SECTION:sa_transform
30  * @short_description: &lt;sa:Transform&gt;
31  *
32  * <figure><title>Schema fragment for sa:Transform</title>
33  * <programlisting><![CDATA[
34  * <xs:element name="Transform" maxOccurs="unbounded">
35  * <xs:complexType>
36  *    <xs:sequence>
37  *      <xs:element name="Parameter" minOccurs="0" maxOccurs="unbounded">
38  *        <xs:complexType>
39  *          <xs:simpleContent>
40  *            <xs:extension base="xs:string">
41  *              <xs:attribute name="name" type="xs:string" use="required"/>
42  *            </xs:extension>
43  *          </xs:simpleContent>
44  *        </xs:complexType>
45  *      </xs:element>
46  *    </xs:sequence>
47  *    <xs:attribute name="name" type="xs:anyURI" use="required"/>
48  *    <xs:attribute name="id" type="xs:ID"use="optional"/>
49  *  </xs:complexType>
50  *  </xs:element>
51  * ]]></programlisting>
52  * </figure>
53  */
54 
55 /*****************************************************************************/
56 /* private methods                                                           */
57 /*****************************************************************************/
58 
59 static struct XmlSnippet schema_snippets[] = {
60 	{ "Parameter", SNIPPET_LIST_NODES, G_STRUCT_OFFSET(LassoSaTransform, Parameter), NULL, NULL, NULL},
61 	{ "name", SNIPPET_ATTRIBUTE, G_STRUCT_OFFSET(LassoSaTransform, name), NULL, NULL, NULL},
62 	{ "id", SNIPPET_ATTRIBUTE, G_STRUCT_OFFSET(LassoSaTransform, id), NULL, NULL, NULL},
63 	{NULL, 0, 0, NULL, NULL, NULL}
64 };
65 
66 /*****************************************************************************/
67 /* instance and class init functions                                         */
68 /*****************************************************************************/
69 
70 
71 static void
class_init(LassoSaTransformClass * klass,void * unused G_GNUC_UNUSED)72 class_init(LassoSaTransformClass *klass, void *unused G_GNUC_UNUSED)
73 {
74 	LassoNodeClass *nclass = LASSO_NODE_CLASS(klass);
75 
76 	nclass->node_data = g_new0(LassoNodeClassData, 1);
77 	lasso_node_class_set_nodename(nclass, "Transform");
78 	lasso_node_class_set_ns(nclass, LASSO_SA_HREF, LASSO_SA_PREFIX);
79 	lasso_node_class_add_snippets(nclass, schema_snippets);
80 }
81 
82 GType
lasso_sa_transform_get_type()83 lasso_sa_transform_get_type()
84 {
85 	static GType this_type = 0;
86 
87 	if (!this_type) {
88 		static const GTypeInfo this_info = {
89 			sizeof (LassoSaTransformClass),
90 			NULL,
91 			NULL,
92 			(GClassInitFunc) class_init,
93 			NULL,
94 			NULL,
95 			sizeof(LassoSaTransform),
96 			0,
97 			NULL,
98 			NULL
99 		};
100 
101 		this_type = g_type_register_static(LASSO_TYPE_NODE,
102 				"LassoSaTransform", &this_info, 0);
103 	}
104 	return this_type;
105 }
106 
107 LassoSaTransform*
lasso_sa_transform_new(const char * name)108 lasso_sa_transform_new(const char *name)
109 {
110 	LassoSaTransform *node;
111 
112 	g_return_val_if_fail(name != NULL, NULL);
113 
114 	node = g_object_new(LASSO_TYPE_SA_TRANSFORM, NULL);
115 
116 	node->name = g_strdup(name);
117 
118 	return node;
119 }
120