summaryrefslogtreecommitdiff
path: root/qmake/include/qregexp.h
Unidiff
Diffstat (limited to 'qmake/include/qregexp.h') (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/include/qregexp.h115
1 files changed, 115 insertions, 0 deletions
diff --git a/qmake/include/qregexp.h b/qmake/include/qregexp.h
new file mode 100644
index 0000000..7bb777a
--- a/dev/null
+++ b/qmake/include/qregexp.h
@@ -0,0 +1,115 @@
1/****************************************************************************
2** $Id$
3**
4** Definition of QRegExp class
5**
6** Created : 950126
7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
9**
10** This file is part of the tools module of the Qt GUI Toolkit.
11**
12** This file may be distributed under the terms of the Q Public License
13** as defined by Trolltech AS of Norway and appearing in the file
14** LICENSE.QPL included in the packaging of this file.
15**
16** This file may be distributed and/or modified under the terms of the
17** GNU General Public License version 2 as published by the Free Software
18** Foundation and appearing in the file LICENSE.GPL included in the
19** packaging of this file.
20**
21** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
22** licenses may use this file in accordance with the Qt Commercial License
23** Agreement provided with the Software.
24**
25** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27**
28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29** information about Qt Commercial License Agreements.
30** See http://www.trolltech.com/qpl/ for QPL licensing information.
31** See http://www.trolltech.com/gpl/ for GPL licensing information.
32**
33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you.
35**
36**********************************************************************/
37
38#ifndef QREGEXP_H
39#define QREGEXP_H
40
41#ifndef QT_H
42#include "qstringlist.h"
43#endif // QT_H
44
45#ifndef QT_NO_REGEXP
46class QRegExpEngine;
47struct QRegExpPrivate;
48
49class Q_EXPORT QRegExp
50{
51public:
52 enum CaretMode { CaretAtZero, CaretAtOffset, CaretWontMatch };
53
54 QRegExp();
55 QRegExp( const QString& pattern, bool caseSensitive = TRUE,
56 bool wildcard = FALSE );
57 QRegExp( const QRegExp& rx );
58 ~QRegExp();
59 QRegExp& operator=( const QRegExp& rx );
60
61 bool operator==( const QRegExp& rx ) const;
62 bool operator!=( const QRegExp& rx ) const { return !operator==( rx ); }
63
64 bool isEmpty() const;
65 bool isValid() const;
66 QString pattern() const;
67 void setPattern( const QString& pattern );
68 bool caseSensitive() const;
69 void setCaseSensitive( bool sensitive );
70#ifndef QT_NO_REGEXP_WILDCARD
71 bool wildcard() const;
72 void setWildcard( bool wildcard );
73#endif
74 bool minimal() const;
75 void setMinimal( bool minimal );
76
77 bool exactMatch( const QString& str ) const;
78#ifndef QT_NO_COMPAT
79 int match( const QString& str, int index = 0, int *len = 0,
80 bool indexIsStart = TRUE ) const;
81#endif
82
83#if defined(qdoc)
84 int search( const QString& str, int offset = 0,
85 CaretMode caretMode = CaretAtZero ) const;
86 int searchRev( const QString& str, int offset = -1,
87 CaretMode caretMode = CaretAtZero ) const;
88#else
89 // ### Qt 4.0: reduce these four to two functions
90 int search( const QString& str, int offset = 0 ) const;
91 int search( const QString& str, int offset, CaretMode caretMode ) const;
92 int searchRev( const QString& str, int offset = -1 ) const;
93 int searchRev( const QString& str, int offset, CaretMode caretMode ) const;
94#endif
95 int matchedLength() const;
96#ifndef QT_NO_REGEXP_CAPTURE
97 int numCaptures() const;
98 QStringList capturedTexts();
99 QString cap( int nth = 0 );
100 int pos( int nth = 0 );
101 QString errorString();
102#endif
103
104 static QString escape( const QString& str );
105
106private:
107 void compile( bool caseSensitive );
108
109 static int caretIndex( int offset, CaretMode caretMode );
110
111 QRegExpEngine *eng;
112 QRegExpPrivate *priv;
113};
114#endif // QT_NO_REGEXP
115#endif // QREGEXP_H