1 /****************************************************************************
2 **
3 ** DQt - D bindings for the Qt Toolkit
4 **
5 ** GNU Lesser General Public License Usage
6 ** This file may be used under the terms of the GNU Lesser
7 ** General Public License version 3 as published by the Free Software
8 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
9 ** packaging of this file. Please review the following information to
10 ** ensure the GNU Lesser General Public License version 3 requirements
11 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
12 **
13 ****************************************************************************/
14 module qt.core.stringmatcher;
15 extern(C++):
16 
17 import qt.config;
18 import qt.core.global;
19 import qt.core.namespace;
20 import qt.core.qchar;
21 import qt.core.string;
22 import qt.core.stringview;
23 import qt.helpers;
24 
25 extern(C++, class) struct QStringMatcherPrivate;
26 
27 extern(C++, class) struct /+ Q_CORE_EXPORT +/ QStringMatcher
28 {
29 public:
30     @disable this();
31     pragma(mangle, defaultConstructorMangling(__traits(identifier, typeof(this))))
32     ref typeof(this) rawConstructor();
33     static typeof(this) create()
34     {
35         typeof(this) r = typeof(this).init;
36         r.rawConstructor();
37         return r;
38     }
39 
40     /+ explicit +/this(ref const(QString) pattern,
41                        /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive);
42     this(const(QChar)* uc, int len,
43                        /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive);
44     this(QStringView pattern,
45                        /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive);
46     @disable this(this);
47     this(ref const(QStringMatcher) other);
48     ~this();
49 
50     /+ref QStringMatcher operator =(ref const(QStringMatcher) other);+/
51 
52     void setPattern(ref const(QString) pattern);
53     void setCaseSensitivity(/+ Qt:: +/qt.core.namespace.CaseSensitivity cs);
54 
55     int indexIn(ref const(QString) str, int from = 0) const;
56     int indexIn(const(QChar)* str, int length, int from = 0) const;
57     qsizetype indexIn(QStringView str, qsizetype from = 0) const;
58     QString pattern() const;
59     pragma(inline, true) /+ Qt:: +/qt.core.namespace.CaseSensitivity caseSensitivity() const { return q_cs; }
60 
61 private:
62     QStringMatcherPrivate* d_ptr;
63     QString q_pattern;
64     /+ Qt:: +/qt.core.namespace.CaseSensitivity q_cs;
65     struct Data {
66         uchar[256] q_skiptable;
67         const(QChar)* uc;
68         int len;
69     }
70     union {
71         uint[256] q_data;
72         Data p;
73     }
74 }
75