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

Function EatVersion

libs/search/processor.cpp:126–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126bool EatVersion(string & s, uint32_t & version)
127{
128 TrimLeadingSpaces(s);
129
130 if (!s.empty() && s.front() == '0' && (s.size() == 1 || !isdigit(s[1])))
131 {
132 version = 0;
133 s = s.substr(1);
134 return true;
135 }
136
137 size_t constexpr kVersionLength = 6;
138 if (s.size() >= kVersionLength && all_of(s.begin(), s.begin() + kVersionLength, ::isdigit) &&
139 (s.size() == kVersionLength || !isdigit(s[kVersionLength + 1])))
140 {
141 VERIFY(strings::to_uint32(s.substr(0, kVersionLength), version), ());
142 s = s.substr(kVersionLength);
143 return true;
144 }
145
146 return false;
147}
148} // namespace
149
150Processor::Processor(DataSource const & dataSource, CategoriesHolder const & categories,

Callers 1

SearchByFeatureIdMethod · 0.85

Calls 6

TrimLeadingSpacesFunction · 0.85
to_uint32Function · 0.85
frontMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected