KOSMIndoorMap

osmpbfwriter.h
1/*
2 SPDX-FileCopyrightText: 2023 Volker Krause <vkrause@kde.org>
3 SPDX-License-Identifier: LGPL-2.0-or-later
4*/
5
6#ifndef OSM_OSMPBFWRITER_H
7#define OSM_OSMPBFWRITER_H
8
9#include "abstractwriter.h"
10
11#include <cstdint>
12#include <cstring>
13#include <string>
14
15#include <QDebug>
16
17namespace OSMPBF {
18class PrimitiveBlock;
19}
20
21namespace OSM {
22
23/** Serialize an OSM::DataSet into the PBF file format. */
25{
26public:
27 explicit OsmPbfWriter();
28 ~OsmPbfWriter() override;
29private:
30 void writeToIODevice(const OSM::DataSet &dataSet, QIODevice *io) override;
31
32 void writeNodes(const OSM::DataSet &dataSet);
33 void writeWays(const OSM::DataSet &dataSet);
34 void writeRelations(const OSM::DataSet &dataSet);
35
36 [[nodiscard]] int32_t stringTableEntry(const char *s);
37 void createBlockIfNeeded();
38 [[nodiscard]] bool blockSizeLimitReached() const;
39 void writeBlob();
40
41 std::unique_ptr<OSMPBF::PrimitiveBlock> m_block;
42 std::map<std::string_view, int32_t> m_stringTable;
43 std::size_t m_blockSizeEstimate = 0;
44 QIODevice *m_io = nullptr;
45};
46
47}
48
49#endif
Abstract base class for OSM file format writers.
A set of nodes, ways and relations.
Definition datatypes.h:343
Serialize an OSM::DataSet into the PBF file format.
Low-level types and functions to work with raw OSM data as efficiently as possible.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 3 2024 11:50:52 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.