Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qtextboundaryfinder.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QTEXTBOUNDARYFINDER_H
5#define QTEXTBOUNDARYFINDER_H
6
7#include <QtCore/qchar.h>
8#include <QtCore/qstring.h>
9
11
12
13struct QCharAttributes;
14
15class Q_CORE_EXPORT QTextBoundaryFinder
16{
17public:
22
29
31 NotAtBoundary = 0,
32 BreakOpportunity = 0x1f,
33 StartOfItem = 0x20,
34 EndOfItem = 0x40,
35 MandatoryBreak = 0x80,
36 SoftHyphen = 0x100
37 };
38 Q_DECLARE_FLAGS( BoundaryReasons, BoundaryReason )
39
40 QTextBoundaryFinder(BoundaryType type, const QString &string);
41 QTextBoundaryFinder(BoundaryType type, const QChar *chars, qsizetype length, unsigned char *buffer = nullptr, qsizetype bufferSize = 0)
42 : QTextBoundaryFinder(type, QStringView(chars, length), buffer, bufferSize)
43 {}
44 QTextBoundaryFinder(BoundaryType type, QStringView str, unsigned char *buffer = nullptr, qsizetype bufferSize = 0);
45
46 inline bool isValid() const { return attributes; }
47
48 inline BoundaryType type() const { return t; }
49 QString string() const;
50
51 void toStart();
52 void toEnd();
53 qsizetype position() const;
55
56 qsizetype toNextBoundary();
57 qsizetype toPreviousBoundary();
58
59 bool isAtBoundary() const;
60 BoundaryReasons boundaryReasons() const;
61
62private:
63 BoundaryType t = Grapheme;
64 QString s;
65 QStringView sv;
66 qsizetype pos = 0;
67 uint freeBuffer : 1;
68 uint unused : 31;
69 QCharAttributes *attributes = nullptr;
70};
71
72Q_DECLARE_OPERATORS_FOR_FLAGS(QTextBoundaryFinder::BoundaryReasons)
73
75
76#endif
77
\inmodule QtCore
\inmodule QtCore
Definition qstringview.h:78
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
bool isValid() const
Returns true if the text boundary finder is valid; otherwise returns false.
BoundaryType type() const
Returns the type of the QTextBoundaryFinder.
QTextBoundaryFinder(BoundaryType type, const QChar *chars, qsizetype length, unsigned char *buffer=nullptr, qsizetype bufferSize=0)
This is an overloaded member function, provided for convenience. It differs from the above function o...
BoundaryReason
\value NotAtBoundary The boundary finder is not at a boundary position.
BoundaryType
\value Grapheme Finds a grapheme which is the smallest boundary.
QString str
[2]
Combined button and popup list for selecting options.
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
Definition qflags.h:194
n void setPosition(void) \n\
GLenum GLuint GLenum GLsizei length
GLenum GLuint buffer
GLenum type
GLdouble s
[6]
Definition qopenglext.h:235
GLdouble GLdouble t
Definition qopenglext.h:243
GLsizei const GLchar *const * string
[0]
Definition qopenglext.h:694
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
ptrdiff_t qsizetype
Definition qtypes.h:165
unsigned int uint
Definition qtypes.h:34
QSharedPointer< T > other(t)
[5]