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.regexp;
15 extern(C++):
16 
17 import qt.config;
18 import qt.helpers;
19 version(QT_NO_REGEXP){}else
20 version(QT_NO_REGEXP_CAPTURE){}else
21     import qt.core.stringlist;
22 version(QT_NO_REGEXP){}else
23 {
24     import qt.core.metatype;
25     import qt.core.namespace;
26     import qt.core.string;
27 }
28 
29 version(QT_NO_REGEXP){}else
30 {
31 
32 
33 
34 struct QRegExpPrivate;
35 /+ class QStringList;
36 class QRegExp;
37 
38 Q_CORE_EXPORT uint qHash(const QRegExp &key, uint seed = 0) noexcept; +/
39 
40 @(QMetaType.Type.QRegExp) extern(C++, class) struct /+ Q_CORE_EXPORT +/ QRegExp
41 {
42 public:
43     enum PatternSyntax {
44         RegExp,
45         Wildcard,
46         FixedString,
47         RegExp2,
48         WildcardUnix,
49         W3CXmlSchema11 }
50     enum CaretMode { CaretAtZero, CaretAtOffset, CaretWontMatch }
51 
52     @disable this();
53     pragma(mangle, defaultConstructorMangling(__traits(identifier, typeof(this))))
54     ref typeof(this) rawConstructor();
55     static typeof(this) create()
56     {
57         typeof(this) r = typeof(this).init;
58         r.rawConstructor();
59         return r;
60     }
61 
62     /+ explicit +/this(ref const(QString) pattern, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive,
63                          PatternSyntax syntax = PatternSyntax.RegExp);
64     @disable this(this);
65     this(ref const(QRegExp) rx);
66     ~this();
67     /+ref QRegExp operator =(ref const(QRegExp) rx);+/
68     /+ QRegExp &operator=(QRegExp &&other) noexcept { swap(other); return *this; } +/
69     /+ void swap(QRegExp &other) noexcept { qSwap(priv, other.priv); } +/
70 
71     /+bool operator ==(ref const(QRegExp) rx) const;+/
72     /+pragma(inline, true) bool operator !=(ref const(QRegExp) rx) const { return !operator==(rx); }+/
73 
74     bool isEmpty() const;
75     bool isValid() const;
76     QString pattern() const;
77     void setPattern(ref const(QString) pattern);
78     /+ Qt:: +/qt.core.namespace.CaseSensitivity caseSensitivity() const;
79     void setCaseSensitivity(/+ Qt:: +/qt.core.namespace.CaseSensitivity cs);
80     PatternSyntax patternSyntax() const;
81     void setPatternSyntax(PatternSyntax syntax);
82 
83     bool isMinimal() const;
84     void setMinimal(bool minimal);
85 
86     bool exactMatch(ref const(QString) str) const;
87 
88     int indexIn(ref const(QString) str, int offset = 0, CaretMode caretMode = CaretMode.CaretAtZero) const;
89     int lastIndexIn(ref const(QString) str, int offset = -1, CaretMode caretMode = CaretMode.CaretAtZero) const;
90     int matchedLength() const;
91     version(QT_NO_REGEXP_CAPTURE){}else
92     {
93         int captureCount() const;
94         QStringList capturedTexts() const;
95         QStringList capturedTexts();
96         QString cap(int nth = 0) const;
97         QString cap(int nth = 0);
98         int pos(int nth = 0) const;
99         int pos(int nth = 0);
100         QString errorString() const;
101         QString errorString();
102     }
103 
104     static QString escape(ref const(QString) str);
105 
106     /+ friend Q_CORE_EXPORT uint qHash(const QRegExp &key, uint seed) noexcept; +/
107 
108 private:
109     QRegExpPrivate* priv;
110 }
111 
112 /+ Q_DECLARE_TYPEINFO(QRegExp, Q_MOVABLE_TYPE);
113 
114 #ifndef QT_NO_DATASTREAM
115 Q_CORE_EXPORT QDataStream &operator<<(QDataStream &out, const QRegExp &regExp);
116 Q_CORE_EXPORT QDataStream &operator>>(QDataStream &in, QRegExp &regExp);
117 #endif
118 
119 #ifndef QT_NO_DEBUG_STREAM
120 Q_CORE_EXPORT QDebug operator<<(QDebug, const QRegExp &);
121 #endif +/
122 
123 
124 }
125 version(QT_NO_REGEXP)
126 {
127 extern(C++, class) struct QRegExp;
128 }
129 
130