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

Function processResultSetTag

maptemplate.c:980–1080  ·  view source on GitHub ↗

** Function to process a [resultset ...] tag. */

Source from the content-addressed store, hash-verified

978** Function to process a [resultset ...] tag.
979*/
980static int processResultSetTag(mapservObj *mapserv, char **line, FILE *stream)
981{
982 char lineBuffer[MS_BUFFER_LENGTH];
983 int foundTagEnd;
984
985 char *preTag, *postTag; /* text before and after the tag */
986
987 char *tag, *tagStart;
988 hashTableObj *tagArgs=NULL;
989
990 char *layerName=NULL;
991 char *nodata=NULL;
992
993 int layerIndex=-1;
994 layerObj *lp;
995
996 if(!*line) {
997 msSetError(MS_WEBERR, "Invalid line pointer.", "processResultSetTag()");
998 return(MS_FAILURE);
999 }
1000
1001 tagStart = findTag(*line, "resultset");
1002 if(!tagStart) return(MS_SUCCESS); /* OK, just return; */
1003
1004 while (tagStart) {
1005 /* initialize the tag arguments */
1006 layerName = NULL;
1007
1008
1009 /* check for any tag arguments */
1010 if(getTagArgs("resultset", tagStart, &tagArgs) != MS_SUCCESS) return(MS_FAILURE);
1011 if(tagArgs) {
1012 layerName = msLookupHashTable(tagArgs, "layer");
1013 nodata = msLookupHashTable(tagArgs, "nodata");
1014 }
1015
1016 if(!layerName) {
1017 msSetError(MS_WEBERR, "[resultset] tag missing required 'layer' argument.", "processResultSetTag()");
1018 return(MS_FAILURE);
1019 }
1020
1021 layerIndex = msGetLayerIndex(mapserv->map, layerName);
1022 if(layerIndex>=mapserv->map->numlayers || layerIndex<0) {
1023 msSetError(MS_MISCERR, "Layer named '%s' does not exist.", "processResultSetTag()", layerName);
1024 return MS_FAILURE;
1025 }
1026 lp = GET_LAYER(mapserv->map, layerIndex);
1027
1028 if(strstr(*line, "[/resultset]") == NULL) { /* read ahead */
1029 if(!stream) {
1030 msSetError(MS_WEBERR, "Invalid file pointer.", "processResultSetTag()");
1031 return(MS_FAILURE);
1032 }
1033
1034 foundTagEnd = MS_FALSE;
1035 while(!foundTagEnd) {
1036 if(fgets(lineBuffer, MS_BUFFER_LENGTH, stream) != NULL) {
1037 *line = msStringConcatenate(*line, lineBuffer);

Callers 1

processLineFunction · 0.85

Calls 11

msSetErrorFunction · 0.85
findTagFunction · 0.85
getTagArgsFunction · 0.85
msLookupHashTableFunction · 0.85
msGetLayerIndexFunction · 0.85
msStringConcatenateFunction · 0.85
getInlineTagFunction · 0.85
getPreTagTextFunction · 0.85
getPostTagTextFunction · 0.85
processFeatureTagFunction · 0.85
msFreeHashTableFunction · 0.85

Tested by

no test coverage detected