10#include <QTextBoundaryFinder>
12#include "textbreaks_p.h"
16class TextBreaksPrivate
26TextBreaks::TextBreaks(
const QString &text)
27 : d(new TextBreaksPrivate())
32TextBreaks::~TextBreaks() =
default;
39void TextBreaks::setText(
const QString &text)
44TextBreaks::Positions TextBreaks::wordBreaks(
const QString &text)
54 while (boundaryFinder.position() < text.
length()) {
56 if (boundaryFinder.toNextBoundary() == -1) {
63 pos.start = boundaryFinder.position();
64 int end = boundaryFinder.toNextBoundary();
68 pos.length =
end - pos.start;
74 if (boundaryFinder.toNextBoundary() == -1) {
81TextBreaks::Positions TextBreaks::sentenceBreaks(
const QString &text)
91 while (boundaryFinder.position() < text.
length()) {
93 pos.start = boundaryFinder.position();
94 int end = boundaryFinder.toNextBoundary();
98 pos.length =
end - pos.start;
107TextBreaks::Positions TextBreaks::wordBreaks()
const
109 return wordBreaks(d->text);
112TextBreaks::Positions TextBreaks::sentenceBreaks()
const
114 return sentenceBreaks(d->text);
QAction * end(const QObject *recvr, const char *slot, QObject *parent)
bool isEmpty() const const
qsizetype length() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:29:33 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.