1 #ifndef _GLIBMM_PATTERN_H
2 #define _GLIBMM_PATTERN_H
3 
4 /* pattern.h
5  *
6  * Copyright (C) 2002 The gtkmm Development Team
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, see <http://www.gnu.org/licenses/>.
20  */
21 
22 extern "C" {
23 using GPatternSpec = struct _GPatternSpec;
24 }
25 
26 #include <glibmm/ustring.h>
27 
28 namespace Glib
29 {
30 
31 /** @defgroup PatternMatching Glob-style Pattern Matching
32  * Match strings against patterns containing '*' (wildcard) and '?' (joker).
33  * @{
34  */
35 
36 class GLIBMM_API PatternSpec
37 {
38 public:
39   explicit PatternSpec(const Glib::ustring& pattern);
40   explicit PatternSpec(GPatternSpec* gobject);
41   ~PatternSpec() noexcept;
42 
43   // noncopyable
44   PatternSpec(const PatternSpec&) = delete;
45   PatternSpec& operator=(const PatternSpec&) = delete;
46 
47   bool match(const Glib::ustring& str) const;
48   bool match(const Glib::ustring& str, const Glib::ustring& str_reversed) const;
49 
50   bool operator==(const PatternSpec& rhs) const;
51   bool operator!=(const PatternSpec& rhs) const;
52 
gobj()53   GPatternSpec* gobj() { return gobject_; }
gobj()54   const GPatternSpec* gobj() const { return gobject_; }
55 
56 private:
57   GPatternSpec* gobject_;
58 };
59 
60 /** @} group PatternMatching */
61 
62 } // namespace Glib
63 
64 #endif /* _GLIBMM_PATTERN_H */
65