1 /* $Id: sb2_sender.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 "sb2_sender.h"
26 #include "idwsf2_strings.h"
27 
28 /**
29  * SECTION:sb2_sender
30  * @short_description: &lt;sb2:Sender&gt;
31  *
32  * <figure><title>Schema fragment for sb2:Sender</title>
33  * <programlisting><![CDATA[
34  *
35  * <xs:complexType name="SenderType">
36  *   <xs:attribute name="providerID" type="xs:anyURI" use="required"/>
37  *   <xs:attribute name="affiliationID" type="xs:anyURI" use="optional"/>
38  *   <xs:anyAttribute namespace="##other" processContents="lax"/>
39  * </xs:complexType>
40  * ]]></programlisting>
41  * </figure>
42  */
43 
44 /*****************************************************************************/
45 /* private methods                                                           */
46 /*****************************************************************************/
47 
48 
49 static struct XmlSnippet schema_snippets[] = {
50 	{ "providerID", SNIPPET_ATTRIBUTE,
51 		G_STRUCT_OFFSET(LassoIdWsf2Sb2Sender, providerID), NULL, NULL, NULL},
52 	{ "affiliationID", SNIPPET_ATTRIBUTE | SNIPPET_OPTIONAL,
53 		G_STRUCT_OFFSET(LassoIdWsf2Sb2Sender, affiliationID), NULL, NULL, NULL},
54 	{ "attributes", SNIPPET_ATTRIBUTE | SNIPPET_ANY,
55 		G_STRUCT_OFFSET(LassoIdWsf2Sb2Sender, attributes), NULL, NULL, NULL},
56 	{NULL, 0, 0, NULL, NULL, NULL}
57 };
58 
59 static LassoNodeClass *parent_class = NULL;
60 
61 
62 /*****************************************************************************/
63 /* instance and class init functions                                         */
64 /*****************************************************************************/
65 
66 static void
instance_init(LassoIdWsf2Sb2Sender * node)67 instance_init(LassoIdWsf2Sb2Sender *node)
68 {
69 	node->attributes = g_hash_table_new_full(
70 		g_str_hash, g_str_equal, g_free, g_free);
71 }
72 
73 static void
class_init(LassoIdWsf2Sb2SenderClass * klass,void * unused G_GNUC_UNUSED)74 class_init(LassoIdWsf2Sb2SenderClass *klass, void *unused G_GNUC_UNUSED)
75 {
76 	LassoNodeClass *nclass = LASSO_NODE_CLASS(klass);
77 
78 	parent_class = g_type_class_peek_parent(klass);
79 	nclass->node_data = g_new0(LassoNodeClassData, 1);
80 	lasso_node_class_set_nodename(nclass, "Sender");
81 	lasso_node_class_set_ns(nclass, LASSO_IDWSF2_SB2_HREF, LASSO_IDWSF2_SB2_PREFIX);
82 	lasso_node_class_add_snippets(nclass, schema_snippets);
83 }
84 
85 GType
lasso_idwsf2_sb2_sender_get_type()86 lasso_idwsf2_sb2_sender_get_type()
87 {
88 	static GType this_type = 0;
89 
90 	if (!this_type) {
91 		static const GTypeInfo this_info = {
92 			sizeof (LassoIdWsf2Sb2SenderClass),
93 			NULL,
94 			NULL,
95 			(GClassInitFunc) class_init,
96 			NULL,
97 			NULL,
98 			sizeof(LassoIdWsf2Sb2Sender),
99 			0,
100 			(GInstanceInitFunc) instance_init,
101 			NULL
102 		};
103 
104 		this_type = g_type_register_static(LASSO_TYPE_NODE,
105 				"LassoIdWsf2Sb2Sender", &this_info, 0);
106 	}
107 	return this_type;
108 }
109 
110 /**
111  * lasso_idwsf2_sb2_sender_new:
112  *
113  * Creates a new #LassoIdWsf2Sb2Sender object.
114  *
115  * Return value: a newly created #LassoIdWsf2Sb2Sender object
116  **/
117 LassoIdWsf2Sb2Sender*
lasso_idwsf2_sb2_sender_new()118 lasso_idwsf2_sb2_sender_new()
119 {
120 	return g_object_new(LASSO_TYPE_IDWSF2_SB2_SENDER, NULL);
121 }
122