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

Function msSLDParseExpression

mapogcsld.c:5446–5532  ·  view source on GitHub ↗

/ char *msSLDParseExpression(char *pszExpression) */ / Return an OGC filter for a mapserver locgical expression. */ TODO : move function to mapogcfilter.c */ /

Source from the content-addressed store, hash-verified

5444/* TODO : move function to mapogcfilter.c */
5445/************************************************************************/
5446char *msSLDParseExpression(char *pszExpression)
5447{
5448 int nElements = 0;
5449 char **aszElements = NULL;
5450 char szBuffer[500];
5451 char szFinalAtt[40];
5452 char szFinalValue[40];
5453 char szAttribute[40];
5454 char szValue[40];
5455 int i=0, nLength=0, iAtt=0, iVal=0;
5456 int bStartCopy=0, bSinglequote=0, bDoublequote=0;
5457 char *pszFilter = NULL;
5458
5459 if (!pszExpression)
5460 return NULL;
5461
5462 nLength = strlen(pszExpression);
5463
5464 aszElements = msStringSplit(pszExpression, ' ', &nElements);
5465
5466 szFinalAtt[0] = '\0';
5467 szFinalValue[0] = '\0';
5468 for (i=0; i<nElements; i++)
5469 {
5470 if (strcasecmp(aszElements[i], "=") == 0 ||
5471 strcasecmp(aszElements[i], "eq") == 0)
5472 {
5473 if (i > 0 && i < nElements-1)
5474 {
5475 snprintf(szAttribute, sizeof(szAttribute), "%s", aszElements[i-1]);
5476 snprintf(szValue, sizeof(szValue), "%s", aszElements[i+1]);
5477
5478 /* parse attribute */
5479 nLength = strlen(szAttribute);
5480 if (nLength > 0)
5481 {
5482 iAtt = 0;
5483 for (i=0; i<nLength; i++)
5484 {
5485 if (szAttribute[i] == '[')
5486 {
5487 bStartCopy = 1;
5488 continue;
5489 }
5490 if (szAttribute[i] == ']')
5491 break;
5492 if (bStartCopy)
5493 {
5494 szFinalAtt[iAtt] = szAttribute[i];
5495 iAtt++;
5496 }
5497 szFinalAtt[iAtt] = '\0';
5498 }
5499 }
5500
5501 /* parse value */
5502 nLength = strlen(szValue);
5503 if (nLength > 0)

Callers

nothing calls this directly

Calls 3

msStringSplitFunction · 0.85
strcasecmpFunction · 0.85
msStrdupFunction · 0.85

Tested by

no test coverage detected