| 1 | /* | |
| 2 | * Portions of this file Copyright 1999-2005 University of Chicago | |
| 3 | * Portions of this file Copyright 1999-2005 The University of Southern California. | |
| 4 | * | |
| 5 | * This file or a portion of this file is licensed under the | |
| 6 | * terms of the Globus Toolkit Public License, found at | |
| 7 | * http://www.globus.org/toolkit/download/license.html. | |
| 8 | * If you redistribute this file, with or without | |
| 9 | * modifications, you must include this notice in the file. | |
| 10 | */ | |
| 11 | ||
| 12 | #include "globus_i_xsd.h" | |
| 13 | #include "xsd_ID.h" | |
| 14 | ||
| 15 | GLOBUS_I_XSD_DEFINE_QNAME(xsd, ID); | |
| 16 | GLOBUS_I_XSD_DEFINE_TYPE_INFO(xsd_ID); | |
| 17 | 0 | GLOBUS_I_XSD_DEFINE_TYPE_FUNCTIONS(xsd_ID); |
| 18 | 0 | GLOBUS_I_XSD_DEFINE_INIT_CONTENTS_GENERIC(xsd_ID); |
| 19 | ||
| 20 | void | |
| 21 | xsd_ID_destroy_contents( | |
| 22 | xsd_ID * instance) | |
| 23 | 0 | { |
| 24 | GlobusFuncName(xsd_ID_destroy_contents); | |
| 25 | 0 | GlobusSoapMessageDebugEnter(); |
| 26 | ||
| 27 | 0 | if(*instance) |
| 28 | { | |
| 29 | 0 | free(*instance); |
| 30 | 0 | *instance = NULL; |
| 31 | } | |
| 32 | ||
| 33 | 0 | GlobusSoapMessageDebugExit(); |
| 34 | } | |
| 35 | ||
| 36 | globus_result_t | |
| 37 | xsd_ID_copy_contents( | |
| 38 | xsd_ID * dest, | |
| 39 | const xsd_ID * src) | |
| 40 | 0 | { |
| 41 | 0 | globus_result_t result = GLOBUS_SUCCESS; |
| 42 | GlobusFuncName(xsd_ID_copy_contents); | |
| 43 | 0 | GlobusSoapMessageDebugEnter(); |
| 44 | ||
| 45 | 0 | if(dest) |
| 46 | { | |
| 47 | 0 | if(!src || !*src) |
| 48 | { | |
| 49 | 0 | *dest = NULL; |
| 50 | } | |
| 51 | else | |
| 52 | { | |
| 53 | 0 | *dest = globus_libc_strdup(*src); |
| 54 | 0 | if(!*dest) |
| 55 | { | |
| 56 | 0 | result = GlobusSoapMessageErrorOutOfMemory; |
| 57 | } | |
| 58 | } | |
| 59 | } | |
| 60 | ||
| 61 | 0 | GlobusSoapMessageDebugExit(); |
| 62 | 0 | return result; |
| 63 | } | |
| 64 | ||
| 65 | globus_result_t | |
| 66 | xsd_ID_serialize_contents( | |
| 67 | xsd_QName * element, | |
| 68 | xsd_ID * instance, | |
| 69 | globus_soap_message_handle_t message_handle, | |
| 70 | globus_xsd_element_options_t options) | |
| 71 | 0 | { |
| 72 | 0 | globus_result_t result = GLOBUS_SUCCESS; |
| 73 | GlobusFuncName(xsd_ID_serialize_contents); | |
| 74 | 0 | GlobusSoapMessageDebugEnter(); |
| 75 | ||
| 76 | /* serialize contents of type */ | |
| 77 | 0 | result = globus_soap_message_serialize_string( |
| 78 | message_handle, instance); | |
| 79 | ||
| 80 | 0 | GlobusSoapMessageDebugExit(); |
| 81 | 0 | return result; |
| 82 | } | |
| 83 | ||
| 84 | globus_result_t | |
| 85 | xsd_ID_deserialize_contents( | |
| 86 | xsd_QName * eqn, | |
| 87 | xsd_ID * instance, | |
| 88 | globus_soap_message_handle_t message_handle, | |
| 89 | globus_xsd_element_options_t options) | |
| 90 | 0 | { |
| 91 | 0 | globus_result_t result = GLOBUS_SUCCESS; |
| 92 | GlobusFuncName(xsd_ID_deserialize_contents); | |
| 93 | 0 | GlobusSoapMessageDebugEnter(); |
| 94 | ||
| 95 | 0 | result = globus_soap_message_deserialize_string( |
| 96 | message_handle, instance); | |
| 97 | ||
| 98 | 0 | GlobusSoapMessageDebugExit(); |
| 99 | 0 | return result; |
| 100 | } | |
| 101 | ||
| 102 | globus_result_t | |
| 103 | xsd_ID_serialize_attribute( | |
| 104 | xsd_QName * element_qname, | |
| 105 | xsd_ID * instance, | |
| 106 | globus_soap_message_handle_t message_handle, | |
| 107 | globus_xsd_element_options_t options) | |
| 108 | 0 | { |
| 109 | 0 | globus_result_t result = GLOBUS_SUCCESS; |
| 110 | GlobusFuncName(xsd_ID_serialize_attribute); | |
| 111 | 0 | GlobusSoapMessageDebugEnter(); |
| 112 | ||
| 113 | 0 | result = globus_soap_message_serialize_string_attribute( |
| 114 | message_handle, element_qname, instance); | |
| 115 | 0 | if(result != GLOBUS_SUCCESS) |
| 116 | { | |
| 117 | 0 | result = GlobusSoapMessageErrorSerializeFailed( |
| 118 | result, NULL, element_qname); | |
| 119 | goto exit; | |
| 120 | } | |
| 121 | ||
| 122 | 0 | exit: |
| 123 | ||
| 124 | 0 | GlobusSoapMessageDebugExit(); |
| 125 | 0 | return result; |
| 126 | } | |
| 127 | ||
| 128 | globus_result_t | |
| 129 | xsd_ID_deserialize_attribute( | |
| 130 | xsd_QName * element_qname, | |
| 131 | xsd_ID * ip, | |
| 132 | globus_soap_message_handle_t message_handle, | |
| 133 | globus_xsd_element_options_t options) | |
| 134 | 0 | { |
| 135 | 0 | globus_result_t result = GLOBUS_SUCCESS; |
| 136 | GlobusFuncName(xsd_ID_deserialize_attribute); | |
| 137 | 0 | GlobusSoapMessageDebugEnter(); |
| 138 | ||
| 139 | 0 | result = globus_soap_message_deserialize_string_attribute( |
| 140 | message_handle, element_qname, ip); | |
| 141 | 0 | if(GlobusSoapMessageStatusAttributeNotFoundCheck(result)) |
| 142 | { | |
| 143 | 0 | result = GLOBUS_SUCCESS; |
| 144 | 0 | goto exit; |
| 145 | } | |
| 146 | ||
| 147 | 0 | if(result != GLOBUS_SUCCESS) |
| 148 | { | |
| 149 | goto error_exit; | |
| 150 | } | |
| 151 | ||
| 152 | goto exit; | |
| 153 | ||
| 154 | 0 | error_exit: |
| 155 | ||
| 156 | 0 | GlobusSoapMessageErrorDeserializeFailed(result, element_qname); |
| 157 | ||
| 158 | 0 | exit: |
| 159 | ||
| 160 | 0 | GlobusSoapMessageDebugExit(); |
| 161 | 0 | return result; |
| 162 | } | |
| 163 | ||
| 164 | globus_result_t | |
| 165 | xsd_ID_deserialize_attribute_pointer( | |
| 166 | xsd_QName * element_qname, | |
| 167 | xsd_ID ** ip, | |
| 168 | globus_soap_message_handle_t message_handle, | |
| 169 | globus_xsd_element_options_t options) | |
| 170 | 0 | { |
| 171 | 0 | xsd_ID * instance = NULL; |
| 172 | 0 | globus_result_t result = GLOBUS_SUCCESS; |
| 173 | GlobusFuncName(xsd_ID_deserialize_attribute_pointer); | |
| 174 | 0 | GlobusSoapMessageDebugEnter(); |
| 175 | ||
| 176 | 0 | *ip = NULL; |
| 177 | ||
| 178 | 0 | result = xsd_ID_init(&instance); |
| 179 | 0 | if(result != GLOBUS_SUCCESS) |
| 180 | { | |
| 181 | 0 | goto error_exit; |
| 182 | } | |
| 183 | ||
| 184 | 0 | result = globus_soap_message_deserialize_string_attribute( |
| 185 | message_handle, element_qname, instance); | |
| 186 | 0 | if(GlobusSoapMessageStatusAttributeNotFoundCheck(result)) |
| 187 | { | |
| 188 | 0 | xsd_ID_destroy(instance); |
| 189 | 0 | result = GLOBUS_SUCCESS; |
| 190 | 0 | goto exit; |
| 191 | } | |
| 192 | ||
| 193 | 0 | if(result != GLOBUS_SUCCESS) |
| 194 | { | |
| 195 | 0 | goto error_exit; |
| 196 | } | |
| 197 | ||
| 198 | 0 | *ip = instance; |
| 199 | ||
| 200 | 0 | goto exit; |
| 201 | ||
| 202 | 0 | error_exit: |
| 203 | ||
| 204 | 0 | GlobusSoapMessageErrorDeserializeFailed(result, element_qname); |
| 205 | ||
| 206 | 0 | exit: |
| 207 | ||
| 208 | 0 | if(result != GLOBUS_SUCCESS && instance) |
| 209 | { | |
| 210 | 0 | xsd_ID_destroy(instance); |
| 211 | 0 | *ip = NULL; |
| 212 | } | |
| 213 | ||
| 214 | 0 | GlobusSoapMessageDebugExit(); |
| 215 | 0 | return result; |