Go to
the documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef QTEXTBOUNDARYFINDER_H
00043 #define QTEXTBOUNDARYFINDER_H
00044
00045 #include <QtCore/qchar.h>
00046 #include <QtCore/qstring.h>
00047
00048 QT_BEGIN_HEADER
00049
00050 QT_BEGIN_NAMESPACE
00051
00052 QT_MODULE(Core)
00053
00054 class QTextBoundaryFinderPrivate;
00055
00056 class Q_CORE_EXPORT QTextBoundaryFinder
00057 {
00058 public:
00059 QTextBoundaryFinder();
00060 QTextBoundaryFinder(const QTextBoundaryFinder &other);
00061 QTextBoundaryFinder &operator=(const QTextBoundaryFinder &other);
00062 ~QTextBoundaryFinder();
00063
00064 enum BoundaryType {
00065 Grapheme,
00066 Word,
00067 Line,
00068 Sentence
00069 };
00070
00071 enum BoundaryReason {
00072 NotAtBoundary = 0,
00073 StartWord = 1,
00074 EndWord = 2
00075
00076 };
00077 Q_DECLARE_FLAGS( BoundaryReasons, BoundaryReason )
00078
00079 QTextBoundaryFinder(BoundaryType type, const QString &string);
00080 QTextBoundaryFinder(BoundaryType type, const QChar *chars, int length, unsigned char *buffer = 0, int bufferSize = 0);
00081
00082 inline bool isValid() const { return d; }
00083
00084 inline BoundaryType type() const { return t; }
00085 QString string() const;
00086
00087 void toStart();
00088 void toEnd();
00089 int position() const;
00090 void setPosition(int position);
00091
00092 int toNextBoundary();
00093 int toPreviousBoundary();
00094
00095 bool isAtBoundary() const;
00096 BoundaryReasons boundaryReasons() const;
00097
00098 private:
00099 BoundaryType t;
00100 QString s;
00101 const QChar *chars;
00102 int length;
00103 int pos;
00104 uint freePrivate : 1;
00105 uint unused : 31;
00106 QTextBoundaryFinderPrivate *d;
00107 };
00108
00109 QT_END_NAMESPACE
00110
00111 QT_END_HEADER
00112
00113 #endif
00114