Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qqmlcompletioncontextstrings_p.h
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
4
#
ifndef
QQMLLSCOMPLETIONCONTEXTSTRINGS_H
5
#
define
QQMLLSCOMPLETIONCONTEXTSTRINGS_H
6
7
//
8
// W A R N I N G
9
// -------------
10
//
11
// This file is not part of the Qt API. It exists purely as an
12
// implementation detail. This header file may change from version to
13
// version without notice, or even be removed.
14
//
15
// We mean it.
16
//
17
18
#
include
<
QtCore
/
qtconfigmacros
.
h
>
19
#
include
<
QtCore
/
qstring
.
h
>
20
#
include
<
QtCore
/
qstringview
.
h
>
21
22
QT_BEGIN_NAMESPACE
23
24
// finds the filter string, the base (for fully qualified accesses) and the whole string
25
// just before pos in code
26
struct
CompletionContextStrings
27
{
28
CompletionContextStrings(QString code, qsizetype pos);
29
30
public
:
31
// line up until pos
32
QStringView preLine()
const
33
{
34
return
QStringView(m_code).mid(m_lineStart, m_pos - m_lineStart);
35
}
36
// the part used to filter the completion (normally actual filtering is left to the client)
37
QStringView filterChars()
const
38
{
39
return
QStringView(m_code).mid(m_filterStart, m_pos - m_filterStart);
40
}
41
// the base part (qualified access)
42
QStringView base()
const
43
{
44
return
QStringView(m_code).mid(m_baseStart, m_filterStart - m_baseStart);
45
}
46
// if we are at line start
47
bool
atLineStart()
const
{
return
m_atLineStart; }
48
49
qsizetype offset()
const
{
return
m_pos; }
50
51
private
:
52
QString m_code;
// the current code
53
qsizetype m_pos = {};
// current position of the cursor
54
qsizetype m_filterStart = {};
// start of the characters that are used to filter the suggestions
55
qsizetype m_lineStart = {};
// start of the current line
56
qsizetype m_baseStart = {};
// start of the dotted expression that ends at the cursor position
57
bool
m_atLineStart = {};
// if there are only spaces before base
58
};
59
60
QT_END_NAMESPACE
61
62
#
endif
// QQMLLSCOMPLETIONCONTEXTSTRINGS_H
qtdeclarative
src
qmlls
qqmlcompletioncontextstrings_p.h
Generated on
for Qt by
1.18.0