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

Function ParsePatternsList

libs/drape/tm_read_resources.hpp:15–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13
14template <typename ToDo>
15inline void ParsePatternsList(std::string const & patternsFile, ToDo && toDo)
16{
17 ReaderStreamBuf buffer(GetPlatform().GetReader(patternsFile));
18 std::istream is(&buffer);
19
20 std::string line;
21 while (std::getline(is, line))
22 {
23 buffer_vector<double, 8> pattern;
24 strings::Tokenize(line, " ", [&](std::string_view token)
25 {
26 double d = 0.0;
27 VERIFY(strings::to_double(token, d), ());
28 pattern.push_back(d);
29 });
30
31 bool isValid = true;
32 for (size_t i = 0; i < pattern.size(); i++)
33 {
34 if (fabs(pattern[i]) < 1e-5)
35 {
36 LOG(LWARNING, ("Pattern was skipped", line));
37 isValid = false;
38 break;
39 }
40 }
41
42 if (isValid)
43 toDo(pattern);
44 }
45}
46
47} // namespace dp::impl

Callers 2

InitStipplePenMethod · 0.85
UNIT_TESTFunction · 0.85

Calls 5

TokenizeFunction · 0.50
to_doubleFunction · 0.50
GetReaderMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45

Tested by 1

UNIT_TESTFunction · 0.68