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