1 /*
2  * Copyright 1999-2006 University of Chicago
3  * 
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  * 
8  * http://www.apache.org/licenses/LICENSE-2.0
9  * 
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #include "globus_i_xsd.h"
18 #include "xsd_IDREFS.h"
19
20 GLOBUS_I_XSD_DEFINE_QNAME(xsd, IDREFS);
21 GLOBUS_I_XSD_DEFINE_TYPE_INFO(xsd_IDREFS);
22 0 GLOBUS_I_XSD_DEFINE_TYPE_FUNCTIONS(xsd_IDREFS);
23 0 GLOBUS_I_XSD_DEFINE_INIT_CONTENTS_GENERIC(xsd_IDREFS);
24
25 void
26 xsd_IDREFS_destroy_contents(
27     xsd_IDREFS *                        instance)
28 {
29 0     GlobusFuncName(xsd_IDREFS_destroy_contents);
30 0     GlobusSoapMessageDebugEnter();
31
32 0     if(*instance)
33     {
34 0         free(*instance);
35 0         *instance = NULL;
36     }
37
38 0     GlobusSoapMessageDebugExit();
39 }
40
41 globus_result_t
42 xsd_IDREFS_copy_contents(
43     xsd_IDREFS *                        dest,
44     const xsd_IDREFS *                  src)
45 0 {
46 0     globus_result_t                     result = GLOBUS_SUCCESS;
47 0     GlobusFuncName(xsd_IDREFS_copy_contents);
48 0     GlobusSoapMessageDebugEnter();
49
50 0     if(dest)
51     {
52 0         if(!src || !*src)
53         {
54 0             *dest = NULL;
55         }
56         else
57         {
58 0             *dest = globus_libc_strdup(*src);
59 0             if(!*dest)
60             {
61 0                 result = GlobusSoapMessageErrorOutOfMemory;
62             }
63         }
64     }
65
66 0     GlobusSoapMessageDebugExit();
67 0     return result;
68 }
69
70 globus_result_t
71 xsd_IDREFS_serialize_contents(
72     const xsd_QName *                   element,
73     const xsd_IDREFS *                  instance,
74     globus_soap_message_handle_t        message_handle,
75     globus_xsd_element_options_t        options)
76 0 {
77 0     globus_result_t                     result = GLOBUS_SUCCESS;
78 0     GlobusFuncName(xsd_IDREFS_serialize_contents);
79 0     GlobusSoapMessageDebugEnter();
80
81     /* serialize contents of type */
82 0     result = globus_soap_message_serialize_string(
83         message_handle, instance);
84
85 0     GlobusSoapMessageDebugExit();
86 0     return result;
87 }
88
89 globus_result_t
90 xsd_IDREFS_deserialize_contents(
91     const xsd_QName *                   eqn,
92     xsd_IDREFS *                        instance,
93     globus_soap_message_handle_t        message_handle,
94     globus_xsd_element_options_t        options)
95 0 {
96 0     globus_result_t                     result = GLOBUS_SUCCESS;
97 0     GlobusFuncName(xsd_IDREFS_deserialize_contents);
98 0     GlobusSoapMessageDebugEnter();
99     
100 0     result = globus_soap_message_deserialize_string(
101         message_handle, instance);
102
103 0     GlobusSoapMessageDebugExit();
104 0     return result;
105 }
106
107 globus_result_t
108 xsd_IDREFS_serialize_attribute(
109     const xsd_QName *                   element_qname,
110     const xsd_IDREFS *                  instance,
111     globus_soap_message_handle_t        message_handle,
112     globus_xsd_element_options_t        options)
113 0 {
114 0     globus_result_t                     result = GLOBUS_SUCCESS;
115 0     GlobusFuncName(xsd_IDREFS_serialize_attribute);
116 0     GlobusSoapMessageDebugEnter();
117
118 0     result = globus_soap_message_serialize_string_attribute(
119         message_handle, element_qname, instance);
120 0     if(result != GLOBUS_SUCCESS)
121     {
122 0         result = GlobusSoapMessageErrorSerializeFailed(
123             result, NULL, element_qname);
124         goto exit;
125     }
126
127  exit:
128
129 0     GlobusSoapMessageDebugExit();
130 0     return result;
131 }
132
133 globus_result_t
134 xsd_IDREFS_deserialize_attribute(
135     const xsd_QName *                   element_qname,
136     xsd_IDREFS *                        ip,
137     globus_soap_message_handle_t        message_handle,
138     globus_xsd_element_options_t        options)
139 0 {
140 0     globus_result_t                 result = GLOBUS_SUCCESS;
141 0     GlobusFuncName(xsd_IDREFS_deserialize_attribute);
142 0     GlobusSoapMessageDebugEnter();
143
144 0     result = globus_soap_message_deserialize_string_attribute(
145         message_handle, element_qname, ip);
146 0     if(GlobusSoapMessageStatusAttributeNotFoundCheck(result))
147     {
148 0         result = GLOBUS_SUCCESS;
149 0         goto exit;
150     }
151
152 0     if(result != GLOBUS_SUCCESS)
153     {
154 0         goto error_exit;
155     }
156
157 0     goto exit;
158
159  error_exit:
160
161 0     GlobusSoapMessageErrorDeserializeFailed(result, element_qname);
162
163  exit:
164
165 0     GlobusSoapMessageDebugExit();
166 0     return result;
167 }
168
169 globus_result_t
170 xsd_IDREFS_deserialize_attribute_pointer(
171     const xsd_QName *                   element_qname,
172     xsd_IDREFS **                       ip,
173     globus_soap_message_handle_t        message_handle,
174     globus_xsd_element_options_t        options)
175 0 {
176 0     xsd_IDREFS *                        instance = NULL;
177 0     globus_result_t                     result = GLOBUS_SUCCESS;
178 0     GlobusFuncName(xsd_IDREFS_deserialize_attribute_pointer);
179 0     GlobusSoapMessageDebugEnter();
180
181 0     *ip = NULL;
182
183 0     result = xsd_IDREFS_init(&instance);
184 0     if(result != GLOBUS_SUCCESS)
185     {
186 0         goto error_exit;
187     }
188
189 0     result = globus_soap_message_deserialize_string_attribute(
190         message_handle, element_qname, instance);
191 0     if(GlobusSoapMessageStatusAttributeNotFoundCheck(result))
192     {
193 0 xsd_IDREFS_destroy(instance);
194 0         result = GLOBUS_SUCCESS;
195 0         goto exit;
196     }
197
198 0     if(result != GLOBUS_SUCCESS)
199     {
200 0         goto error_exit;
201     }
202
203 0     *ip = instance;
204
205 0     goto exit;
206
207  error_exit:
208
209 0     GlobusSoapMessageErrorDeserializeFailed(result, element_qname);
210
211  exit:
212
213 0     if(result != GLOBUS_SUCCESS && instance)
214     {
215 0         xsd_IDREFS_destroy(instance);
216 0         *ip = NULL;
217     }
218
219 0     GlobusSoapMessageDebugExit();
220 0     return result;