MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / parseRegion

Method parseRegion

src/common/TimeZoneUtil.cpp:506–541  ·  view source on GitHub ↗

Parses a time zone id from a region string.

Source from the content-addressed store, hash-verified

504
505// Parses a time zone id from a region string.
506USHORT TimeZoneUtil::parseRegion(const char* str, unsigned strLen)
507{
508 const char* end = str + strLen;
509
510 skipSpaces(str, end);
511
512 const char* start = str;
513
514 while (str < end &&
515 ((*str >= 'a' && *str <= 'z') ||
516 (*str >= 'A' && *str <= 'Z') ||
517 *str == '_' ||
518 *str == '/' ||
519 (str != start && *str >= '0' && *str <= '9') ||
520 (str != start && *str == '+') ||
521 (str != start && *str == '-')))
522 {
523 ++str;
524 }
525
526 unsigned len = str - start;
527
528 skipSpaces(str, end);
529
530 if (str == end)
531 {
532 string s(start, len);
533 USHORT id;
534
535 if (timeZoneStartup().getId(s, id))
536 return id;
537 }
538
539 status_exception::raise(Arg::Gds(isc_invalid_timezone_region) << string(start, end));
540 return 0;
541}
542
543// Format a time zone to string, as offset or region.
544unsigned TimeZoneUtil::format(char* buffer, size_t bufferSize, USHORT timeZone, bool fallback, SLONG offset)

Callers

nothing calls this directly

Calls 4

skipSpacesFunction · 0.85
raiseFunction · 0.85
GdsClass · 0.85
getIdMethod · 0.45

Tested by

no test coverage detected