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
qqmlcompletioncontextstrings.cpp
Go to the documentation of this file.
1// Copyright (C) 2023 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
5
7 : m_code(code), m_pos(pos)
8{
9 // computes the context just before pos in code.
10 // After this code all the values of all the attributes should be correct (see above)
11 // handle also letter or numbers represented a surrogate pairs?
12 m_filterStart = m_pos;
13 while (m_filterStart != 0) {
14 QChar c = code.at(m_filterStart - 1);
15 if (!c.isLetterOrNumber() && c != u'_')
16 break;
17 else
18 --m_filterStart;
19 }
20 // handle spaces?
21 m_baseStart = m_filterStart;
22 while (m_baseStart != 0) {
23 QChar c = code.at(m_baseStart - 1);
24 if (c != u'.' || m_baseStart == 1)
25 break;
26 c = code.at(m_baseStart - 2);
27 if (!c.isLetterOrNumber() && c != u'_')
28 break;
29 qsizetype baseEnd = --m_baseStart;
30 while (m_baseStart != 0) {
31 QChar c = code.at(m_baseStart - 1);
32 if (!c.isLetterOrNumber() && c != u'_')
33 break;
34 else
35 --m_baseStart;
36 }
37 if (m_baseStart == baseEnd)
38 break;
39 }
40 m_atLineStart = true;
41 m_lineStart = m_baseStart;
42 while (m_lineStart != 0) {
43 QChar c = code.at(m_lineStart - 1);
44 if (c == u'\n' || c == u'\r')
45 break;
46 if (!c.isSpace())
47 m_atLineStart = false;
48 --m_lineStart;
49 }
50}
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
const QChar at(qsizetype i) const
Returns the character at the given index position in the string.
Definition qstring.h:1226
const GLubyte * c
ptrdiff_t qsizetype
Definition qtypes.h:165
CompletionContextStrings(QString code, qsizetype pos)