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

Function writeExpression

mapfile.c:2176–2206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2174}
2175
2176static void writeExpression(FILE *stream, int indent, const char *name, expressionObj *exp)
2177{
2178 char *string_tmp;
2179 if(!exp || !exp->string) return;
2180
2181 writeIndent(stream, ++indent);
2182 switch(exp->type) {
2183 case(MS_REGEX):
2184 fprintf(stream, "%s /%s/", name, exp->string);
2185 break;
2186 case(MS_STRING):
2187 if ( (strchr(exp->string, '\'') == NULL) && (strchr(exp->string, '\"') == NULL))
2188 fprintf(stream, "%s \"%s\"", name, exp->string);
2189 else if ( (strchr(exp->string, '\"') != NULL) && (strchr(exp->string, '\'') == NULL))
2190 fprintf(stream, "%s \'%s\'", name, exp->string);
2191 else if ( (strchr(exp->string, '\'') != NULL) && (strchr(exp->string, '\"') == NULL))
2192 fprintf(stream, "%s \"%s\"", name, exp->string);
2193 else {
2194 string_tmp = msStringEscape(exp->string);
2195 fprintf(stream, "%s \"%s\"", name, string_tmp);
2196 free(string_tmp);
2197 }
2198 break;
2199 case(MS_EXPRESSION):
2200 fprintf(stream, "%s (%s)", name, exp->string);
2201 break;
2202 }
2203 if((exp->type == MS_STRING || exp->type == MS_REGEX) && (exp->flags & MS_EXP_INSENSITIVE))
2204 fprintf(stream, "i");
2205 writeLineFeed(stream);
2206}
2207
2208int loadHashTable(hashTableObj *ptable)
2209{

Callers 3

writeClusterFunction · 0.85
writeClassFunction · 0.85
writeLayerFunction · 0.85

Calls 3

writeIndentFunction · 0.85
msStringEscapeFunction · 0.85
writeLineFeedFunction · 0.85

Tested by

no test coverage detected