libosmscout 1.1.1
Loading...
Searching...
No Matches
NameShortFeature.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_FEATURE_NAME_SHORT_FEATURE_H
2#define OSMSCOUT_FEATURE_NAME_SHORT_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
31 {
32 private:
33 std::string nameShort;
34
35 public:
37
38 explicit NameShortFeatureValue(const std::string& nameShort)
39 : nameShort(nameShort)
40 {
41 // no code
42 }
43
44 void SetNameShort(const std::string_view& nameShort)
45 {
46 this->nameShort=nameShort;
47 }
48
49 std::string GetNameShort() const
50 {
51 return nameShort;
52 }
53
54 std::string GetLabel(const Locale &/*locale*/, size_t /*labelIndex*/) const override
55 {
56 return nameShort;
57 }
58
59 void Read(FileScanner& scanner) override;
60 void Write(FileWriter& writer) override;
61
63 bool operator==(const FeatureValue& other) const override;
64 };
65
67 {
68 private:
69 TagId tagShortName=0;
70
71 public:
73 static const char* const NAME;
74
76 static const char* const NAME_LABEL;
77
79 static const size_t NAME_LABEL_INDEX;
80
81 public:
83 void Initialize(TagRegistry& tagRegistry) override;
84
85 std::string GetName() const override;
86
87 size_t GetValueAlignment() const override;
88 size_t GetValueSize() const override;
89 FeatureValue* AllocateValue(void* buffer) override;
90
91 void Parse(TagErrorReporter& reporter,
92 const TagRegistry& tagRegistry,
93 const FeatureInstance& feature,
94 const ObjectOSMRef& object,
95 const TagMap& tags,
96 FeatureValueBuffer& buffer) const override;
97 };
98
100}
101
102#endif
#define OSMSCOUT_API
Definition CoreImportExport.h:45
Definition TypeFeature.h:41
Definition FeatureReader.h:143
static const char *const NAME_LABEL
Definition NameShortFeature.h:76
std::string GetName() const override
size_t GetValueSize() const override
void Initialize(TagRegistry &tagRegistry) override
void Parse(TagErrorReporter &reporter, const TagRegistry &tagRegistry, const FeatureInstance &feature, const ObjectOSMRef &object, const TagMap &tags, FeatureValueBuffer &buffer) const override
static const char *const NAME
Definition NameShortFeature.h:73
size_t GetValueAlignment() const override
FeatureValue * AllocateValue(void *buffer) override
static const size_t NAME_LABEL_INDEX
Definition NameShortFeature.h:79
std::string GetNameShort() const
Definition NameShortFeature.h:49
NameShortFeatureValue(const std::string &nameShort)
Definition NameShortFeature.h:38
bool operator==(const FeatureValue &other) const override
void SetNameShort(const std::string_view &nameShort)
Definition NameShortFeature.h:44
std::string GetLabel(const Locale &, size_t) const override
Definition NameShortFeature.h:54
void Write(FileWriter &writer) override
void Read(FileScanner &scanner) override
NameShortFeatureValue & operator=(const FeatureValue &other) override
Definition TagErrorReporter.h:33
Definition Area.h:39
std::unordered_map< TagId, std::string > TagMap
Definition Tag.h:41
FeatureValueReader< NameShortFeature, NameShortFeatureValue > NameShortFeatureValueReader
Definition NameShortFeature.h:99
uint16_t TagId
Definition Tag.h:39