libosmscout 1.1.1
Loading...
Searching...
No Matches
StringMatcher.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_UTIL_STRINGMATCHER_H
2#define OSMSCOUT_UTIL_STRINGMATCHER_H
3
4/*
5 This source is part of the libosmscout library
6 Copyright (C) 2017 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 <memory>
24#include <string>
25
27
28namespace osmscout {
29
31 {
32 public:
39
40 public:
41 virtual ~StringMatcher() = default;
42
43 virtual Result Match(const std::string& text) const = 0;
44 };
45
46 using StringMatcherRef = std::shared_ptr<StringMatcher>;
47
49 {
50 private:
51 std::string pattern;
52
53 public:
54 explicit StringMatcherCI(const std::string& pattern);
55
56 Result Match(const std::string& text) const override;
57 };
58
60 {
61 public:
62 virtual ~StringMatcherFactory() = default;
63
64 virtual StringMatcherRef CreateMatcher(const std::string& pattern) const = 0;
65 };
66
67 using StringMatcherFactoryRef = std::shared_ptr<StringMatcherFactory>;
68
70 {
71 public:
72 StringMatcherRef CreateMatcher(const std::string& pattern) const override;
73 };
74
76 {
77 private:
78 std::string pattern;
79 std::string transliteratedPattern;
80
81 public:
82 explicit StringMatcherTransliterate(const std::string &pattern);
83
84 StringMatcher::Result Match(const std::string &text) const override;
85 };
86
88 {
89 public:
90 StringMatcherRef CreateMatcher(const std::string& pattern) const override;
91 };
92
93}
94#endif
#define OSMSCOUT_API
Definition CoreImportExport.h:45
Definition StringMatcher.h:70
StringMatcherRef CreateMatcher(const std::string &pattern) const override
StringMatcherCI(const std::string &pattern)
Result Match(const std::string &text) const override
Definition StringMatcher.h:60
virtual StringMatcherRef CreateMatcher(const std::string &pattern) const =0
virtual ~StringMatcherFactory()=default
Definition StringMatcher.h:31
Result
Definition StringMatcher.h:34
@ noMatch
Definition StringMatcher.h:35
@ partialMatch
Definition StringMatcher.h:36
@ match
Definition StringMatcher.h:37
virtual ~StringMatcher()=default
virtual Result Match(const std::string &text) const =0
Definition StringMatcher.h:88
StringMatcherRef CreateMatcher(const std::string &pattern) const override
StringMatcherTransliterate(const std::string &pattern)
StringMatcher::Result Match(const std::string &text) const override
Definition Area.h:39
std::shared_ptr< StringMatcher > StringMatcherRef
Definition StringMatcher.h:46
std::shared_ptr< StringMatcherFactory > StringMatcherFactoryRef
Definition StringMatcher.h:67