MCPcopy Create free account
hub / github.com/MapServer/MapServer / msWCSParseTimeOrScalar20

Function msWCSParseTimeOrScalar20

mapwcs20.c:116–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114/************************************************************************/
115
116static int msWCSParseTimeOrScalar20(timeScalarUnion *u, const char *string)
117{
118 struct tm time;
119 if (string)
120 {
121 while(*string == ' ')
122 string ++;
123 }
124
125 if (!string || strlen(string) == 0 || !u)
126 {
127 msSetError(MS_WCSERR, "Invalid string", "msWCSParseTimeOrScalar20()");
128 return MS_WCS20_ERROR_VALUE;
129 }
130 /* if the string is equal to "*" it means the value
131 * of the interval is unbounded */
132 if (EQUAL(string, "*"))
133 {
134 u->scalar = MS_WCS20_UNBOUNDED;
135 u->unbounded = 1;
136 return MS_WCS20_UNDEFINED_VALUE;
137 }
138
139 /* if returned a valid value, use it */
140 if (msStringParseDouble(string, &(u->scalar)) == MS_SUCCESS)
141 {
142 return MS_WCS20_SCALAR_VALUE;
143 }
144 /* otherwise it might be a time value */
145 msTimeInit(&time);
146 if (msParseTime(string, &time) == MS_TRUE)
147 {
148 u->time = mktime(&time);
149 return MS_WCS20_TIME_VALUE;
150 }
151 /* the value could neither be parsed as a double nor as a time value */
152 else
153 {
154 msSetError(MS_WCSERR,
155 "String %s could not be parsed to a time or scalar value",
156 "msWCSParseTimeOrScalar20()");
157 return MS_WCS20_ERROR_VALUE;
158 }
159}
160
161/************************************************************************/
162/* msStringIsNCName() */

Callers 1

msWCSParseSubset20Function · 0.85

Calls 4

msSetErrorFunction · 0.85
msStringParseDoubleFunction · 0.85
msTimeInitFunction · 0.85
msParseTimeFunction · 0.85

Tested by

no test coverage detected