Eneboo - Documentación para desarrolladores
|
00001 /**************************************************************************** 00002 ** $Id: qt/qregexp.h 3.3.8 edited Jan 11 14:38 $ 00003 ** 00004 ** Definition of QRegExp class 00005 ** 00006 ** Created : 950126 00007 ** 00008 ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved. 00009 ** 00010 ** This file is part of the tools module of the Qt GUI Toolkit. 00011 ** 00012 ** This file may be distributed under the terms of the Q Public License 00013 ** as defined by Trolltech ASA of Norway and appearing in the file 00014 ** LICENSE.QPL included in the packaging of this file. 00015 ** 00016 ** This file may be distributed and/or modified under the terms of the 00017 ** GNU General Public License version 2 as published by the Free Software 00018 ** Foundation and appearing in the file LICENSE.GPL included in the 00019 ** packaging of this file. 00020 ** 00021 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition 00022 ** licenses may use this file in accordance with the Qt Commercial License 00023 ** Agreement provided with the Software. 00024 ** 00025 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00026 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00027 ** 00028 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 00029 ** information about Qt Commercial License Agreements. 00030 ** See http://www.trolltech.com/qpl/ for QPL licensing information. 00031 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 00032 ** 00033 ** Contact info@trolltech.com if any conditions of this licensing are 00034 ** not clear to you. 00035 ** 00036 **********************************************************************/ 00037 00038 #ifndef QREGEXP_H 00039 #define QREGEXP_H 00040 00041 #ifndef QT_H 00042 #include "qstringlist.h" 00043 #endif // QT_H 00044 00045 #ifndef QT_NO_REGEXP 00046 class QRegExpEngine; 00047 struct QRegExpPrivate; 00048 00049 class Q_EXPORT QRegExp 00050 { 00051 public: 00052 enum CaretMode { CaretAtZero, CaretAtOffset, CaretWontMatch }; 00053 00054 QRegExp(); 00055 QRegExp( const QString& pattern, bool caseSensitive = TRUE, 00056 bool wildcard = FALSE ); 00057 QRegExp( const QRegExp& rx ); 00058 ~QRegExp(); 00059 QRegExp& operator=( const QRegExp& rx ); 00060 00061 bool operator==( const QRegExp& rx ) const; 00062 bool operator!=( const QRegExp& rx ) const { return !operator==( rx ); } 00063 00064 bool isEmpty() const; 00065 bool isValid() const; 00066 QString pattern() const; 00067 void setPattern( const QString& pattern ); 00068 bool caseSensitive() const; 00069 void setCaseSensitive( bool sensitive ); 00070 #ifndef QT_NO_REGEXP_WILDCARD 00071 bool wildcard() const; 00072 void setWildcard( bool wildcard ); 00073 #endif 00074 bool minimal() const; 00075 void setMinimal( bool minimal ); 00076 00077 bool exactMatch( const QString& str ) const; 00078 #ifndef QT_NO_COMPAT 00079 int match( const QString& str, int index = 0, int *len = 0, 00080 bool indexIsStart = TRUE ) const; 00081 #endif 00082 00083 #if defined(Q_QDOC) 00084 int search( const QString& str, int offset = 0, 00085 CaretMode caretMode = CaretAtZero ) const; 00086 int searchRev( const QString& str, int offset = -1, 00087 CaretMode caretMode = CaretAtZero ) const; 00088 #else 00089 // ### Qt 4.0: reduce these four to two functions 00090 int search( const QString& str, int offset = 0 ) const; 00091 int search( const QString& str, int offset, CaretMode caretMode ) const; 00092 int searchRev( const QString& str, int offset = -1 ) const; 00093 int searchRev( const QString& str, int offset, CaretMode caretMode ) const; 00094 #endif 00095 int matchedLength() const; 00096 #ifndef QT_NO_REGEXP_CAPTURE 00097 int numCaptures() const; 00098 QStringList capturedTexts(); 00099 QString cap( int nth = 0 ); 00100 int pos( int nth = 0 ); 00101 QString errorString(); 00102 #endif 00103 00104 static QString escape( const QString& str ); 00105 00106 private: 00107 void prepareEngine() const; 00108 void prepareEngineForMatch( const QString& str ) const; 00109 void invalidateEngine(); 00110 00111 static int caretIndex( int offset, CaretMode caretMode ); 00112 00113 QRegExpEngine *eng; 00114 QRegExpPrivate *priv; 00115 }; 00116 #endif // QT_NO_REGEXP 00117 #endif // QREGEXP_H