read file

Signed-off-by: map-per <map-per@gmx.de>
This commit is contained in:
map-per
2025-12-09 18:13:23 +01:00
parent c3eb79d413
commit 76213281ec
2 changed files with 41 additions and 1 deletions

View File

@@ -1,9 +1,11 @@
#include "editor/feature_type_to_osm.hpp"
#include "base/logging.hpp"
#include "coding/reader_streambuf.hpp"
#include "indexer/classificator.hpp"
#include "platform/platform.hpp"
namespace editor
{
void FeatureTypeToOSM::loadConfigFile() {
@@ -14,6 +16,44 @@ void FeatureTypeToOSM::loadConfigFile() {
std::unique_ptr<ModelReader> reader = p.GetReader("mapcss-mapping.csv");
LOG(LINFO, ("File has size ", reader->Size()));
ReaderStreamBuf buffer(std::move(reader));
std::istream s(&buffer);
std::string line;
int lineNumber = 0;
while (s.good())
{
++lineNumber;
getline(s, line);
strings::Trim(line);
// skip empty lines and comments
if (line.empty() || line[0] == '#')
continue;
LOG(LINFO, ("Reading line: ", line));
std::vector<std::string_view> tokens = strings::Tokenize(line, ";");
if (tokens.size() == 2)
{
// OSM tags can be derived from type name
LOG(LINFO, ("simple type: ", tokens[0]));
}
else if (tokens.size() > 2)
{
LOG(LINFO, ("token size:", tokens.size(), " | osmTags: ", tokens[1]));
}
if (lineNumber > 70)
break;
}
ASSERT_FAIL("Don't run further tests-------------------");
}
std::vector<OSMTag> FeatureTypeToOSM::typeToOSM(uint32_t type)

View File

@@ -1,6 +1,6 @@
#include "editor/xml_feature.hpp"
#include "editor/feature_type_to_osm.hpp"
//#include "editor/feature_type_to_osm.hpp"
#include "editor/keys_to_remove.hpp"
#include "indexer/classificator.hpp"