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 "globus_i_xsd_type_info.h"
19 #include "globus_soap_message.h"
20
21 GLOBUS_I_XSD_DEFINE_QNAME(xsd, base64Binary);
22 GLOBUS_I_XSD_DEFINE_TYPE_INFO(xsd_base64Binary);
23 0 GLOBUS_I_XSD_DEFINE_TYPE_FUNCTIONS(xsd_base64Binary);
24 0 GLOBUS_I_XSD_DEFINE_ATTR_FUNCTIONS(xsd_base64Binary, base64Binary);
25
26 0 GLOBUS_I_XSD_DEFINE_INIT_CONTENTS_GENERIC(xsd_base64Binary);
27
28 void
29 xsd_base64Binary_destroy_contents(
30     xsd_base64Binary *                  instance)
31 {
32 0     GlobusFuncName(xsd_base64Binary_destroy_contents);
33 0     GlobusSoapMessageDebugEnter();
34
35 0     if(instance)
36     {
37 0         if(instance->value)
38         {
39 0             free(instance->value);
40 0             instance->value = NULL;
41         }
42     }
43
44 0     GlobusSoapMessageDebugExit();
45 }
46
47 globus_result_t
48 xsd_base64Binary_copy_contents(
49     xsd_base64Binary *                  dest,
50     const xsd_base64Binary *            src)
51 0 {
52 0     globus_result_t                     result = GLOBUS_SUCCESS;
53 0     GlobusFuncName(xsd_base64Binary_copy_contents);
54 0     GlobusSoapMessageDebugEnter();
55
56 0     if(dest && src)
57     {
58 0         dest->length = src->length;
59 0         dest->value = globus_libc_malloc(src->length);
60 0         if(!dest->value)
61         {
62 0             result = GlobusSoapMessageErrorOutOfMemory;
63         }
64         else
65         {
66 0             memcpy(dest->value, src->value, src->length);
67         }
68     }
69
70 0     GlobusSoapMessageDebugExit();
71
72 0     return result;
73 }
74
75 globus_result_t
76 xsd_base64Binary_serialize_contents(
77     const xsd_QName *                   element_qname,
78     const xsd_base64Binary *            instance,
79     globus_soap_message_handle_t        soap_message_handle,
80     globus_xsd_element_options_t        options)
81 0 {
82 0     globus_result_t                     result = GLOBUS_SUCCESS;
83 0     GlobusFuncName(xsd_base64Binary_serialize_contents);
84 0     GlobusSoapMessageDebugEnter();
85
86     /* serialize contents of type */
87 0     result = globus_soap_message_serialize_base64Binary(
88         soap_message_handle, instance);
89
90 0     GlobusSoapMessageDebugExit();
91 0     return result;
92 }
93
94 globus_result_t
95 xsd_base64Binary_deserialize_contents(
96     const xsd_QName *                   element_qn,
97     xsd_base64Binary *                  instance,
98     globus_soap_message_handle_t        soap_message_handle,
99     globus_xsd_element_options_t        options)
100 0 {
101 0     globus_result_t                     result = GLOBUS_SUCCESS;
102 0     GlobusFuncName(xsd_base64Binary_deserialize_contents);
103 0     GlobusSoapMessageDebugEnter();
104     
105 0     result = globus_soap_message_deserialize_base64Binary(
106         soap_message_handle, instance);
107
108 0     GlobusSoapMessageDebugExit();
109 0     return result;