libosmscout 1.1.1
Loading...
Searching...
No Matches
ImportErrorReporter.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_IMPORT_IMPORTERRORREPORTER_H
2#define OSMSCOUT_IMPORT_IMPORTERRORREPORTER_H
3
4/*
5 This source is part of the libosmscout library
6 Copyright (C) 2016 Tim Teulings
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21*/
22
23#include <mutex>
24#include <string>
25
27
28#include <osmscout/ObjectRef.h>
29#include <osmscout/TypeConfig.h>
30
34
36
37namespace osmscout {
38
43 class OSMSCOUT_IMPORT_API ImportErrorReporter CLASS_FINAL: public TagErrorReporter
44 {
45 public:
46 static const char* const FILENAME_INDEX_HTML;
47 static const char* const FILENAME_TAG_HTML;
48 static const char* const FILENAME_WAY_HTML;
49 static const char* const FILENAME_RELATION_HTML;
50 static const char* const FILENAME_LOCATION_HTML;
51
52
53 private:
54 enum Report {
55 reportLocation
56 };
57
58 private:
59 struct ReportError
60 {
61 Report report;
62 ObjectFileRef ref;
63 std::string error;
64
65 inline ReportError(Report report,
66 const ObjectFileRef& ref,
67 const std::string& error)
68 : report(report),
69 ref(ref),
70 error(error)
71 {
72 // no code
73 }
74 };
75
76 private:
77 Progress& progress;
78
79 TypeConfigRef typeConfig;
80 TagId nameTagId;
81
82 std::string destinationDirectory;
83
84 std::list<ReportError> errors;
85
86 HTMLWriter tagReport;
87 size_t tagErrorCount;
88
89 HTMLWriter wayReport;
90 size_t wayErrorCount;
91
92 HTMLWriter relationReport;
93 size_t relationErrorCount;
94
95 HTMLWriter locationReport;
96 size_t locationErrorCount;
97
98 HTMLWriter index;
99
100 std::mutex mutex;
101
102 private:
103 std::string GetName(const ObjectOSMRef& object,
104 const TagMap& tags) const;
105
106 public:
108 const TypeConfigRef& typeConfig,
109 const std::string& destinationDirectory);
110
112
113 void ReportTag(const ObjectOSMRef &object,
114 const TagMap& tags,
115 const std::string& error) override;
116
118 const TagMap& tags,
119 const std::string& error);
120
122 const TagMap& tags,
123 const std::string& error);
125 const TypeInfoRef& type,
126 const std::string& error);
127
129 const std::string& error);
130
131 void ReportLocation(const ObjectFileRef& object,
132 const std::string& error);
133
135 };
136
137 typedef std::shared_ptr<ImportErrorReporter> ImportErrorReporterRef;
138}
139
140#endif
#define OSMSCOUT_IMPORT_API
Definition ImportImportExport.h:45
Definition Area.h:88
void ReportWay(OSMId id, const TagMap &tags, const std::string &error)
void ReportLocationDebug(const ObjectFileRef &object, const std::string &error)
static const char *const FILENAME_INDEX_HTML
Definition ImportErrorReporter.h:46
void ReportRelation(OSMId id, const TagMap &tags, const std::string &error)
void ReportLocation(const ObjectFileRef &object, const std::string &error)
static const char *const FILENAME_TAG_HTML
Definition ImportErrorReporter.h:47
static const char *const FILENAME_WAY_HTML
Definition ImportErrorReporter.h:48
static const char *const FILENAME_RELATION_HTML
Definition ImportErrorReporter.h:49
~ImportErrorReporter() override
void ReportRelation(OSMId id, const TypeInfoRef &type, const std::string &error)
void ReportTag(const ObjectOSMRef &object, const TagMap &tags, const std::string &error) override
ImportErrorReporter(Progress &progress, const TypeConfigRef &typeConfig, const std::string &destinationDirectory)
static const char *const FILENAME_LOCATION_HTML
Definition ImportErrorReporter.h:50
Type type
The type of the cell.
Definition GroundTile.h:92
Definition TagErrorReporter.h:33
int64_t OSMId
Definition OSMScoutTypes.h:33
std::shared_ptr< TypeConfig > TypeConfigRef
Definition TypeConfig.h:1396
Definition Area.h:39
std::unordered_map< TagId, std::string > TagMap
Definition Tag.h:41
std::shared_ptr< ImportErrorReporter > ImportErrorReporterRef
Definition ImportErrorReporter.h:137
std::shared_ptr< TypeInfo > TypeInfoRef
Definition TypeConfig.h:61
uint16_t TagId
Definition Tag.h:39