MCPcopy Create free account
hub / github.com/comaps/comaps / IndiaRoadShieldParser

Class IndiaRoadShieldParser

libs/indexer/road_shields_parser.cpp:246–273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

244};
245
246class IndiaRoadShieldParser : public RoadShieldParser
247{
248public:
249 explicit IndiaRoadShieldParser(std::string const & baseRoadNumber) : RoadShieldParser(baseRoadNumber) {}
250 RoadShield ParseRoadShield(std::string_view rawText, uint8_t index) const override
251 {
252 std::string shieldText(rawText);
253
254 std::erase_if(shieldText, [](char c) { return c == '-' || strings::IsASCIISpace(c); });
255
256 if (shieldText.size() <= 2)
257 return RoadShield(RoadShieldType::Default, rawText);
258
259 std::string_view roadType = std::string_view(shieldText).substr(0, 2);
260 std::string_view roadNumber = std::string_view(shieldText).substr(2);
261
262 if (roadType == "NE")
263 return RoadShield(RoadShieldType::Generic_Blue, roadNumber);
264
265 if (roadType == "NH")
266 return RoadShield(RoadShieldType::Generic_Orange, roadNumber);
267
268 if (roadType == "SH")
269 return RoadShield(RoadShieldType::Generic_Green, roadNumber);
270
271 return RoadShield(RoadShieldType::Default, rawText);
272 }
273};
274
275class DefaultTypeRoadShieldParser : public RoadShieldParser
276{

Callers 1

GetRoadShieldsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected