libosmscout 1.1.1
Loading...
Searching...
No Matches
AddressFeature.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_FEATURE_ADDRESS_FEATURE_H
2#define OSMSCOUT_FEATURE_ADDRESS_FEATURE_H
3
4/*
5 This source is part of the libosmscout library
6 Copyright (C) 2014 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 <osmscout/TypeConfig.h>
25
27
28namespace osmscout {
29
37 {
38 private:
39 std::string address;
40
41 public:
43 AddressFeatureValue(const AddressFeatureValue& featureValue) = default;
44
45 explicit AddressFeatureValue(const std::string& address)
46 : address(address)
47 {
48 // no code
49 }
50
51 void SetAddress(const std::string_view& address)
52 {
53 this->address=address;
54 }
55
56 std::string GetAddress() const
57 {
58 return address;
59 }
60
61 std::string GetLabel(const Locale &/*locale*/, size_t /*labelIndex*/) const override
62 {
63 return address;
64 }
65
66 void Read(FileScanner& scanner) override;
67 void Write(FileWriter& writer) override;
68
70 bool operator==(const FeatureValue& other) const override;
71 };
72
74 {
75 private:
76 TagId tagAddrHouseNr=0;
77 TagId tagAddrStreet=0;
78 TagId tagAddrPlace=0;
79
80 public:
82 static const char* const NAME;
83
85 static const char* const NAME_LABEL;
86
88 static const size_t NAME_LABEL_INDEX;
89
90 public:
92 void Initialize(TagRegistry& tagRegistry) override;
93
94 std::string GetName() const override;
95
96 size_t GetValueAlignment() const override;
97 size_t GetValueSize() const override;
98 FeatureValue* AllocateValue(void* buffer) override;
99
100 void Parse(TagErrorReporter& reporter,
101 const TagRegistry& tagRegistry,
102 const FeatureInstance& feature,
103 const ObjectOSMRef& object,
104 const TagMap& tags,
105 FeatureValueBuffer& buffer) const override;
106 };
107
109}
110
111#endif
#define OSMSCOUT_API
Definition CoreImportExport.h:45
static const size_t NAME_LABEL_INDEX
Definition AddressFeature.h:88
static const char *const NAME_LABEL
Definition AddressFeature.h:85
void Initialize(TagRegistry &tagRegistry) override
size_t GetValueSize() const override
static const char *const NAME
Definition AddressFeature.h:82
void Parse(TagErrorReporter &reporter, const TagRegistry &tagRegistry, const FeatureInstance &feature, const ObjectOSMRef &object, const TagMap &tags, FeatureValueBuffer &buffer) const override
std::string GetName() const override
FeatureValue * AllocateValue(void *buffer) override
size_t GetValueAlignment() const override
AddressFeatureValue(const std::string &address)
Definition AddressFeature.h:45
void Read(FileScanner &scanner) override
AddressFeatureValue(const AddressFeatureValue &featureValue)=default
std::string GetLabel(const Locale &, size_t) const override
Definition AddressFeature.h:61
std::string GetAddress() const
Definition AddressFeature.h:56
void Write(FileWriter &writer) override
bool operator==(const FeatureValue &other) const override
AddressFeatureValue & operator=(const FeatureValue &other) override
void SetAddress(const std::string_view &address)
Definition AddressFeature.h:51
Definition TypeFeature.h:41
Definition FeatureReader.h:143
Definition TagErrorReporter.h:33
Definition Area.h:39
std::unordered_map< TagId, std::string > TagMap
Definition Tag.h:41
FeatureValueReader< AddressFeature, AddressFeatureValue > AddressFeatureValueReader
Definition AddressFeature.h:108
uint16_t TagId
Definition Tag.h:39