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

Function layerSubstituteString

mapfile.c:5939–5962  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5937}
5938
5939static void layerSubstituteString(layerObj *layer, char *from, char *to) {
5940 int i;
5941 char *bindvals_key, *bindvals_val;
5942
5943 if(layer->data) layer->data = msCaseReplaceSubstring(layer->data, from, to);
5944 if(layer->tileindex) layer->tileindex = msCaseReplaceSubstring(layer->tileindex, from, to);
5945 if(layer->connection) layer->connection = msCaseReplaceSubstring(layer->connection, from, to);
5946 if(layer->filter.string) layer->filter.string = msCaseReplaceSubstring(layer->filter.string, from, to);
5947
5948 for(i=0; i<layer->numclasses; i++) {
5949 if(layer->class[i]->expression.string)
5950 layer->class[i]->expression.string = msCaseReplaceSubstring(layer->class[i]->expression.string, from, to);
5951 if(layer->class[i]->text.string)
5952 layer->class[i]->text.string = msCaseReplaceSubstring(layer->class[i]->text.string, from, to);
5953 }
5954
5955 /* The bindvalues are most useful when able to substitute values from the URL */
5956 bindvals_key = (char*)msFirstKeyFromHashTable(&layer->bindvals);
5957 while(bindvals_key != NULL) {
5958 bindvals_val = msStrdup((char*)msLookupHashTable(&layer->bindvals, bindvals_key));
5959 msInsertHashTable(&layer->bindvals, bindvals_key, msCaseReplaceSubstring(bindvals_val, from, to));
5960 bindvals_key = (char*)msNextKeyFromHashTable(&layer->bindvals, bindvals_key);
5961 }
5962}
5963
5964/*
5965** Loop through layer metadata for keys that have a default_%key% pattern to replace

Callers 2

msApplySubstitutionsFunction · 0.85

Calls 6

msCaseReplaceSubstringFunction · 0.85
msFirstKeyFromHashTableFunction · 0.85
msStrdupFunction · 0.85
msLookupHashTableFunction · 0.85
msInsertHashTableFunction · 0.85
msNextKeyFromHashTableFunction · 0.85

Tested by

no test coverage detected