1 /* $Id: dst_request.c,v 1.0 2005/10/14 15:17:55 fpeters Exp $
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 "dst_request.h"
26 #include "idwsf2_strings.h"
27
28 /**
29 * SECTION:dst_request
30 * @short_description: <dst:Request>
31 *
32 * <figure><title>Schema fragment for dst:Request</title>
33 * <programlisting><![CDATA[
34 *
35 * <xs:complexType name="RequestType">
36 * <xs:sequence>
37 * <xs:element ref="lu:Extension" minOccurs="0" maxOccurs="unbounded"/>
38 * </xs:sequence>
39 * <xs:attribute ref="lu:itemID" use="optional"/>
40 * <xs:anyAttribute namespace="##other" processContents="lax"/>
41 * </xs:complexType>
42 * ]]></programlisting>
43 * </figure>
44 */
45
46 /*****************************************************************************/
47 /* private methods */
48 /*****************************************************************************/
49
50
51 static struct XmlSnippet schema_snippets[] = {
52 { "Extension", SNIPPET_LIST_NODES,
53 G_STRUCT_OFFSET(LassoIdWsf2DstRequest, Extension),
54 "LassoIdWsf2Utilextension", LASSO_IDWSF2_UTIL_PREFIX, LASSO_IDWSF2_UTIL_HREF},
55 { "itemID", SNIPPET_ATTRIBUTE | SNIPPET_OPTIONAL,
56 G_STRUCT_OFFSET(LassoIdWsf2DstRequest, itemID), NULL, NULL, NULL},
57 { "attributes", SNIPPET_ATTRIBUTE | SNIPPET_ANY,
58 G_STRUCT_OFFSET(LassoIdWsf2DstRequest, attributes), NULL, NULL, NULL},
59 {NULL, 0, 0, NULL, NULL, NULL}
60 };
61
62 static LassoNodeClass *parent_class = NULL;
63
64
65 /*****************************************************************************/
66 /* instance and class init functions */
67 /*****************************************************************************/
68
69 static void
instance_init(LassoIdWsf2DstRequest * node)70 instance_init(LassoIdWsf2DstRequest *node)
71 {
72 node->attributes = g_hash_table_new_full(
73 g_str_hash, g_str_equal, g_free, g_free);
74 }
75
76 static void
class_init(LassoIdWsf2DstRequestClass * klass,void * unused G_GNUC_UNUSED)77 class_init(LassoIdWsf2DstRequestClass *klass, void *unused G_GNUC_UNUSED)
78 {
79 LassoNodeClass *nclass = LASSO_NODE_CLASS(klass);
80
81 parent_class = g_type_class_peek_parent(klass);
82 nclass->node_data = g_new0(LassoNodeClassData, 1);
83 lasso_node_class_set_nodename(nclass, "Request");
84 lasso_node_class_set_ns(nclass, LASSO_IDWSF2_DST_HREF, LASSO_IDWSF2_DST_PREFIX);
85 lasso_node_class_add_snippets(nclass, schema_snippets);
86 }
87
88 GType
lasso_idwsf2_dst_request_get_type()89 lasso_idwsf2_dst_request_get_type()
90 {
91 static GType this_type = 0;
92
93 if (!this_type) {
94 static const GTypeInfo this_info = {
95 sizeof (LassoIdWsf2DstRequestClass),
96 NULL,
97 NULL,
98 (GClassInitFunc) class_init,
99 NULL,
100 NULL,
101 sizeof(LassoIdWsf2DstRequest),
102 0,
103 (GInstanceInitFunc) instance_init,
104 NULL
105 };
106
107 this_type = g_type_register_static(LASSO_TYPE_NODE,
108 "LassoIdWsf2DstRequest", &this_info, 0);
109 }
110 return this_type;
111 }
112
113 /**
114 * lasso_idwsf2_dst_request_new:
115 *
116 * Creates a new #LassoIdWsf2DstRequest object.
117 *
118 * Return value: a newly created #LassoIdWsf2DstRequest object
119 **/
120 LassoIdWsf2DstRequest*
lasso_idwsf2_dst_request_new()121 lasso_idwsf2_dst_request_new()
122 {
123 return g_object_new(LASSO_TYPE_IDWSF2_DST_REQUEST, NULL);
124 }
125