~ubuntu-branches/ubuntu/edgy/lasso/edgy

« back to all changes in this revision

Viewing changes to lasso/xml/disco_query.c

  • Committer: Bazaar Package Importer
  • Author(s): Stephan Hermann
  • Date: 2005-09-16 02:16:49 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050916021649-lr5tuka6pfmmks44
Tags: 0.6.2-3ubuntu1
* debian/control: removed hardcoded php dependency, added php:Depends
  substvar
* debian/rules: added phpapiver, added substitution of php:Depends

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: disco_query.c,v 1.7 2005/01/22 15:57:55 eraviart Exp $ 
 
2
 *
 
3
 * Lasso - A free implementation of the Liberty Alliance specifications.
 
4
 *
 
5
 * Copyright (C) 2004, 2005 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, write to the Free Software
 
22
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
23
 */
 
24
 
 
25
#include <lasso/xml/disco_query.h>
 
26
 
 
27
/*
 
28
 * Schema fragments (liberty-idwsf-disco-svc-1.0-errata-v1.0.xsd):
 
29
 * 
 
30
 * <xs:element name="Query" type="QueryType"/>
 
31
 * <xs:complexType name="QueryType">
 
32
 *   <xs:sequence>
 
33
 *      <xs:group ref="ResourceIDGroup"/>
 
34
 *      <xs:element name="RequestedServiceType" minOccurs="0" maxOccurs="unbounded">
 
35
 *        <xs:complexType>
 
36
 *           <xs:sequence>
 
37
 *             <xs:element ref="ServiceType"/>
 
38
 *             <xs:element ref="Options" minOccurs="0"/>
 
39
 *           </xs:sequence>
 
40
 *        </xs:complexType>
 
41
 *      </xs:element>
 
42
 *   </xs:sequence>
 
43
 *   <xs:attribute name="id" type="xs:ID" use="optional"/>
 
44
 * </xs:complexType>
 
45
 * 
 
46
 * <xs:group name="ResourceIDGroup">
 
47
 *   <xs:sequence>
 
48
 *     <xs:choice minOccurs="0" maxOccurs="1">
 
49
 *       <xs:element ref="ResourceID"/>
 
50
 *       <xs:element ref="EncryptedResourceID"/>
 
51
 *     </xs:choice>
 
52
 *   </xs:sequence>
 
53
 * </xs:group>
 
54
 */ 
 
55
 
 
56
/*****************************************************************************/
 
57
/* private methods                                                           */
 
58
/*****************************************************************************/
 
59
 
 
60
static struct XmlSnippet schema_snippets[] = {
 
61
        { "ResourceID", SNIPPET_NODE, G_STRUCT_OFFSET(LassoDiscoQuery, ResourceID) },
 
62
        { "EncryptedResourceID",
 
63
          SNIPPET_NODE, G_STRUCT_OFFSET(LassoDiscoQuery, EncryptedResourceID) },
 
64
        { "RequestedServiceType", SNIPPET_LIST_NODES,
 
65
          G_STRUCT_OFFSET(LassoDiscoQuery, RequestedServiceType) },
 
66
        { "id", SNIPPET_ATTRIBUTE, G_STRUCT_OFFSET(LassoDiscoQuery, id) },
 
67
        { NULL, 0, 0}
 
68
};
 
69
 
 
70
/*****************************************************************************/
 
71
/* instance and class init functions                                         */
 
72
/*****************************************************************************/
 
73
 
 
74
static void
 
75
instance_init(LassoDiscoQuery *node)
 
76
{
 
77
        node->ResourceID = NULL;
 
78
        node->EncryptedResourceID = NULL;
 
79
        node->RequestedServiceType = NULL;
 
80
        node->id = NULL;
 
81
}
 
82
 
 
83
static void
 
84
class_init(LassoDiscoQueryClass *klass)
 
85
{
 
86
        LassoNodeClass *nclass = LASSO_NODE_CLASS(klass);
 
87
 
 
88
        nclass->node_data = g_new0(LassoNodeClassData, 1);
 
89
        lasso_node_class_set_nodename(nclass, "Query");
 
90
        lasso_node_class_set_ns(nclass, LASSO_DISCO_HREF, LASSO_DISCO_PREFIX);
 
91
        lasso_node_class_add_snippets(nclass, schema_snippets);
 
92
}
 
93
 
 
94
GType
 
95
lasso_disco_query_get_type()
 
96
{
 
97
        static GType this_type = 0;
 
98
 
 
99
        if (!this_type) {
 
100
                static const GTypeInfo this_info = {
 
101
                        sizeof (LassoDiscoQueryClass),
 
102
                        NULL,
 
103
                        NULL,
 
104
                        (GClassInitFunc) class_init,
 
105
                        NULL,
 
106
                        NULL,
 
107
                        sizeof(LassoDiscoQuery),
 
108
                        0,
 
109
                        (GInstanceInitFunc) instance_init,
 
110
                };
 
111
 
 
112
                this_type = g_type_register_static(LASSO_TYPE_NODE,
 
113
                                "LassoDiscoQuery", &this_info, 0);
 
114
        }
 
115
        return this_type;
 
116
}
 
117
 
 
118
LassoDiscoQuery*
 
119
lasso_disco_query_new()
 
120
{
 
121
        LassoDiscoQuery *node;
 
122
 
 
123
        node = g_object_new(LASSO_TYPE_DISCO_QUERY, NULL);
 
124
 
 
125
        return node;
 
126
}
 
127
 
 
128
LassoDiscoQuery*
 
129
lasso_disco_query_new_from_message(const gchar *message)
 
130
{
 
131
        LassoDiscoQuery *node;
 
132
 
 
133
        g_return_val_if_fail(message != NULL, NULL);
 
134
 
 
135
        node = g_object_new(LASSO_TYPE_DISCO_QUERY, NULL);
 
136
        lasso_node_init_from_message(LASSO_NODE(node), message);
 
137
 
 
138
        return node;
 
139
}