File indexing completed on 2024-07-21 09:27:11

0001 /*
0002     SPDX-FileCopyrightText: 2020 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef MARBLE_OSMPBFPARSER_H
0008 #define MARBLE_OSMPBFPARSER_H
0009 
0010 #include "OsmNode.h"
0011 #include "OsmWay.h"
0012 #include "OsmRelation.h"
0013 
0014 namespace OSMPBF {
0015 class PrimitiveBlock;
0016 class PrimitiveGroup;
0017 }
0018 
0019 namespace Marble {
0020 
0021 class OsmPbfParser
0022 {
0023 public:
0024     void parse(const uint8_t *data, std::size_t len);
0025 
0026     OsmNodes m_nodes;
0027     OsmWays m_ways;
0028     OsmRelations m_relations;
0029 
0030 private:
0031     bool parseBlob(const uint8_t *&it, const uint8_t *end);
0032     void parsePrimitiveBlock(const uint8_t *data, std::size_t len);
0033     void parseDenseNodes(const OSMPBF::PrimitiveBlock &block,  const OSMPBF::PrimitiveGroup &group);
0034     void parseWays(const OSMPBF::PrimitiveBlock &block, const OSMPBF::PrimitiveGroup &group);
0035     void parseRelations(const OSMPBF::PrimitiveBlock &block, const OSMPBF::PrimitiveGroup &group);
0036 
0037     QByteArray m_zlibBuffer;
0038     QSet<QString> m_stringPool;
0039 };
0040 
0041 }
0042 
0043 #endif // MARBLE_OSMPBFPARSER_H