/ msOwsIsOutputFormatValid */ / Utlity function to parse a comma separated list in a */ metedata object and select and outputformat. */ /
| 2188 | /* metedata object and select and outputformat. */ |
| 2189 | /************************************************************************/ |
| 2190 | outputFormatObj* msOwsIsOutputFormatValid(mapObj *map, const char *format, |
| 2191 | hashTableObj *metadata, |
| 2192 | const char *namespaces, const char *name) |
| 2193 | { |
| 2194 | char **tokens=NULL; |
| 2195 | int i,n; |
| 2196 | outputFormatObj *psFormat = NULL; |
| 2197 | const char * format_list=NULL; |
| 2198 | |
| 2199 | if (map && format && metadata && namespaces && name) |
| 2200 | { |
| 2201 | msApplyDefaultOutputFormats(map); |
| 2202 | format_list = msOWSLookupMetadata(metadata, namespaces, name); |
| 2203 | n = 0; |
| 2204 | if ( format_list) |
| 2205 | tokens = msStringSplit(format_list, ',', &n); |
| 2206 | |
| 2207 | if (tokens && n > 0) |
| 2208 | { |
| 2209 | for (i=0; i<n; i++) |
| 2210 | { |
| 2211 | int iFormat = msGetOutputFormatIndex( map, tokens[i]); |
| 2212 | const char *mimetype; |
| 2213 | if( iFormat == -1 ) |
| 2214 | continue; |
| 2215 | |
| 2216 | mimetype = map->outputformatlist[iFormat]->mimetype; |
| 2217 | |
| 2218 | msStringTrim(tokens[i]); |
| 2219 | if (strcasecmp(tokens[i], format) == 0) |
| 2220 | break; |
| 2221 | if (mimetype && strcasecmp(mimetype, format) == 0) |
| 2222 | break; |
| 2223 | } |
| 2224 | msFreeCharArray(tokens, n); |
| 2225 | if (i < n) |
| 2226 | psFormat = msSelectOutputFormat( map, format); |
| 2227 | } |
| 2228 | } |
| 2229 | |
| 2230 | return psFormat; |
| 2231 | } |
| 2232 | |
| 2233 | #endif /* USE_WMS_SVR || USE_WFS_SVR || USE_WCS_SVR */ |
| 2234 |
no test coverage detected