| 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 "globus_i_xsd_type_info.h" | |
| 14 | #include "globus_soap_message.h" | |
| 15 | ||
| 16 | GLOBUS_I_XSD_DEFINE_QNAME(xsd, string); | |
| 17 | GLOBUS_I_XSD_DEFINE_TYPE_INFO(xsd_string); | |
| 18 | 35241 | GLOBUS_I_XSD_DEFINE_TYPE_FUNCTIONS(xsd_string); |
| 19 | 212 | GLOBUS_I_XSD_DEFINE_ATTR_FUNCTIONS(xsd_string, string); |
| 20 | 0 | GLOBUS_I_XSD_DEFINE_INIT_CONTENTS_GENERIC(xsd_string); |
| 21 | 0 | GLOBUS_I_XSD_DEFINE_LIST_FUNCTIONS(xsd_string, string); |
| 22 | 0 | GLOBUS_I_XSD_DEFINE_LIST_ATTR_FUNCTIONS(xsd_string, string); |
| 23 | ||
| 24 | globus_result_t | |
| 25 | xsd_string_copy_contents( | |
| 26 | xsd_string * dest, | |
| 27 | const xsd_string * src) | |
| 28 | { | |
| 29 | 4703 | globus_result_t result = GLOBUS_SUCCESS; |
| 30 | 4703 | GlobusFuncName(xsd_string_copy_contents); |
| 31 | 4703 | GlobusSoapMessageDebugEnter(); |
| 32 | ||
| 33 | 4703 | if(dest) |
| 34 | { | |
| 35 | 4703 | if(!src || !*src) |
| 36 | { | |
| 37 | 0 | *dest = NULL; |
| 38 | } | |
| 39 | else | |
| 40 | { | |
| 41 | 4703 | *dest = globus_libc_strdup(*src); |
| 42 | 4703 | if(!*dest) |
| 43 | { | |
| 44 | 0 | result = GlobusSoapMessageErrorOutOfMemory; |
| 45 | } | |
| 46 | } | |
| 47 | } | |
| 48 | ||
| 49 | 4703 | GlobusSoapMessageDebugExit(); |
| 50 | 4703 | return result; |
| 51 | } | |
| 52 | ||
| 53 | void | |
| 54 | xsd_string_destroy_contents( | |
| 55 | xsd_string * instance) | |
| 56 | 5624 | { |
| 57 | 5624 | GlobusFuncName(xsd_string_destroy_contents); |
| 58 | 5624 | GlobusSoapMessageDebugEnter(); |
| 59 | ||
| 60 | 5624 | if(*instance) |
| 61 | { | |
| 62 | 5624 | free(*instance); |
| 63 | 5624 | *instance = NULL; |
| 64 | } | |
| 65 | ||
| 66 | 5624 | GlobusSoapMessageDebugExit(); |
| 67 | } | |
| 68 | ||
| 69 | globus_result_t | |
| 70 | xsd_string_serialize_contents( | |
| 71 | xsd_QName * element, | |
| 72 | xsd_string * instance, | |
| 73 | globus_soap_message_handle_t soap_message_handle, | |
| 74 | globus_xsd_element_options_t options) | |
| 75 | 2338 | { |
| 76 | 2338 | globus_result_t result = GLOBUS_SUCCESS; |
| 77 | 2338 | GlobusFuncName(xsd_string_serialize_contents); |
| 78 | 2338 | GlobusSoapMessageDebugEnter(); |
| 79 | ||
| 80 | /* serialize contents of type */ | |
| 81 | 2338 | result = globus_soap_message_serialize_string( |
| 82 | soap_message_handle, instance); | |
| 83 | ||
| 84 | 2338 | GlobusSoapMessageDebugExit(); |
| 85 | 2338 | return result; |
| 86 | } | |
| 87 | ||
| 88 | globus_result_t | |
| 89 | xsd_string_deserialize_contents( | |
| 90 | xsd_QName * eqn, | |
| 91 | xsd_string * instance, | |
| 92 | globus_soap_message_handle_t soap_message_handle, | |
| 93 | globus_xsd_element_options_t options) | |
| 94 | 2533 | { |
| 95 | 2533 | globus_result_t result = GLOBUS_SUCCESS; |
| 96 | 2533 | GlobusFuncName(xsd_string_deserialize_contents); |
| 97 | 2533 | GlobusSoapMessageDebugEnter(); |
| 98 | ||
| 99 | 2533 | result = globus_soap_message_deserialize_string( |
| 100 | soap_message_handle, instance); | |
| 101 | ||
| 102 | 2533 | GlobusSoapMessageDebugExit(); |
| 103 | 2533 | return result; |
| 104 | } | |
| 105 | ||
| 106 | globus_result_t | |
| 107 | xsd_string_init_cstr( | |
| 108 | xsd_string ** ip, | |
| 109 | char * str) | |
| 110 | 37 | { |
| 111 | 37 | globus_result_t result = GLOBUS_SUCCESS; |
| 112 | 37 | GlobusFuncName(xsd_string_init_cstr); |
| 113 | 37 | GlobusSoapMessageDebugEnter(); |
| 114 | ||
| 115 | 37 | result = xsd_string_init(ip); |
| 116 | 37 | if(result == GLOBUS_SUCCESS) |
| 117 | { | |
| 118 | 37 | **ip = str; |
| 119 | } | |
| 120 | ||
| 121 | 37 | GlobusSoapMessageDebugExit(); |
| 122 | 37 | return result; |
| 123 | } | |
| 124 | ||
| 125 | globus_result_t | |
| 126 | xsd_string_init_contents_cstr( | |
| 127 | xsd_string * instance, | |
| 128 | char * str) | |
| 129 | 0 | { |
| 130 | 0 | globus_result_t result = GLOBUS_SUCCESS; |
| 131 | 0 | GlobusFuncName(xsd_string_init_contents_cstr); |
| 132 | 0 | GlobusSoapMessageDebugEnter(); |
| 133 | ||
| 134 | 0 | *instance = str; |
| 135 | ||
| 136 | 0 | GlobusSoapMessageDebugExit(); |
| 137 | 0 | return result; |
| 138 | } | |
| 139 | ||
| 140 | globus_result_t | |
| 141 | xsd_string_copy_cstr( | |
| 142 | xsd_string ** ip, | |
| 143 | const char * str) | |
| 144 | 0 | { |
| 145 | 0 | globus_result_t result = GLOBUS_SUCCESS; |
| 146 | 0 | GlobusFuncName(xsd_string_copy_cstr); |
| 147 | 0 | GlobusSoapMessageDebugEnter(); |
| 148 | ||
| 149 | 0 | result = xsd_string_copy(ip, (const xsd_string *) &str); |
| 150 | ||
| 151 | 0 | GlobusSoapMessageDebugExit(); |
| 152 | 0 | return result; |
| 153 | } | |
| 154 | ||
| 155 | globus_result_t | |
| 156 | xsd_string_copy_contents_cstr( | |
| 157 | xsd_string * instance, | |
| 158 | const char * str) | |
| 159 | 0 | { |
| 160 | 0 | globus_result_t result = GLOBUS_SUCCESS; |
| 161 | 0 | GlobusFuncName(xsd_string_copy_cstr); |
| 162 | 0 | GlobusSoapMessageDebugEnter(); |
| 163 | ||
| 164 | 0 | result = xsd_string_copy_contents(instance, (const xsd_string *) &str); |
| 165 | ||
| 166 | 0 | GlobusSoapMessageDebugExit(); |
| 167 | 0 | return result; |