Files
comaps/drape/tm_read_resources.hpp
Konstantin Pastbin e3e4a1985a Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
2025-05-08 21:10:51 +07:00

48 lines
1002 B
C++

#pragma once
#include "platform/platform.hpp"
#include "coding/reader.hpp"
#include "coding/reader_streambuf.hpp"
#include "base/buffer_vector.hpp"
#include "base/logging.hpp"
#include "base/string_utils.hpp"
namespace dp::impl
{
template <typename ToDo>
inline void ParsePatternsList(std::string const & patternsFile, ToDo && toDo)
{
ReaderStreamBuf buffer(GetPlatform().GetReader(patternsFile));
std::istream is(&buffer);
std::string line;
while (std::getline(is, line))
{
buffer_vector<double, 8> pattern;
strings::Tokenize(line, " ", [&](std::string_view token)
{
double d = 0.0;
VERIFY(strings::to_double(token, d), ());
pattern.push_back(d);
});
bool isValid = true;
for (size_t i = 0; i < pattern.size(); i++)
{
if (fabs(pattern[i]) < 1e-5)
{
LOG(LWARNING, ("Pattern was skipped", line));
isValid = false;
break;
}
}
if (isValid)
toDo(pattern);
}
}
} // namespace dp::impl