MCPcopy Index your code
hub / github.com/MapServer/MapServer / msOWSPrintURLType

Function msOWSPrintURLType

mapows.c:1009–1192  ·  view source on GitHub ↗

msOWSPrintURLType() ** ** Attempt to output a URL item in capabilties. If corresponding metadata ** is not found then one of a number of predefined actions will be taken. ** Since it's a capability item, five metadata will be used to populate the ** XML elements. ** ** The 'name' argument is the basename of the metadata items relating to this ** URL type and the suffixes _type, _width, _height

Source from the content-addressed store, hash-verified

1007** Note that all values will be HTML-encoded.
1008**/
1009int msOWSPrintURLType(FILE *stream, hashTableObj *metadata,
1010 const char *namespaces, const char *name,
1011 int action_if_not_found, const char *tag_format,
1012 const char *tag_name, const char *type_format,
1013 const char *width_format, const char *height_format,
1014 const char *urlfrmt_format, const char *href_format,
1015 int type_is_mandatory, int width_is_mandatory,
1016 int height_is_mandatory, int format_is_mandatory,
1017 int href_is_mandatory, const char *default_type,
1018 const char *default_width, const char *default_height,
1019 const char *default_urlfrmt, const char *default_href,
1020 const char *tabspace)
1021{
1022 const char *value;
1023 char *metadata_name;
1024 size_t buffer_size = 0, buffer_size_tmp = 0;
1025 char *encoded;
1026 int status = MS_NOERR;
1027 char *type=NULL, *width=NULL, *height=NULL, *urlfrmt=NULL, *href=NULL;
1028
1029 buffer_size = strlen(name)+10;
1030 metadata_name = (char*)malloc(buffer_size);
1031
1032 /* Get type */
1033 if(type_format != NULL)
1034 {
1035 snprintf(metadata_name, buffer_size, "%s_type", name);
1036 value = msOWSLookupMetadata(metadata, namespaces, metadata_name);
1037 if(value != NULL)
1038 {
1039 encoded = msEncodeHTMLEntities(value);
1040 buffer_size_tmp = strlen(type_format)+strlen(encoded);
1041 type = (char*)malloc(buffer_size_tmp);
1042 snprintf(type, buffer_size_tmp, type_format, encoded);
1043 msFree(encoded);
1044 }
1045 }
1046
1047 /* Get width */
1048 if(width_format != NULL)
1049 {
1050 snprintf(metadata_name, buffer_size, "%s_width", name);
1051 value = msOWSLookupMetadata(metadata, namespaces, metadata_name);
1052 if(value != NULL)
1053 {
1054 encoded = msEncodeHTMLEntities(value);
1055 buffer_size_tmp = strlen(width_format)+strlen(encoded);
1056 width = (char*)malloc(buffer_size_tmp);
1057 snprintf(width, buffer_size_tmp, width_format, encoded);
1058 msFree(encoded);
1059 }
1060 }
1061
1062 /* Get height */
1063 if(height_format != NULL)
1064 {
1065 snprintf(metadata_name, buffer_size, "%s_height", name);
1066 value = msOWSLookupMetadata(metadata, namespaces, metadata_name);

Callers 8

msWMSPrintAttributionFunction · 0.85
msDumpLayerFunction · 0.85
msWMSGetCapabilitiesFunction · 0.85
msWriteMapContextFunction · 0.85
msWFSDumpLayerFunction · 0.85

Calls 5

msOWSLookupMetadataFunction · 0.85
msEncodeHTMLEntitiesFunction · 0.85
msFreeFunction · 0.85
msIO_fprintfFunction · 0.85
msStrdupFunction · 0.85

Tested by

no test coverage detected