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_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
QStringView
\inmodule QtCore
Definition
qstringview.h:78
QStringView::mid
constexpr QStringView mid(qsizetype pos, qsizetype n=-1) const noexcept
Returns the substring of length length starting at position start in this object.
Definition
qstringview.h:203
QString
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition
qstring.h:129
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qstandardpaths_haiku.cpp:21
QT_END_NAMESPACE
Definition
qsharedpointer.cpp:1590
qsizetype
ptrdiff_t qsizetype
Definition
qtypes.h:165
pos
pos
[7]
Definition
src_corelib_io_qsettings.cpp:57
CompletionContextStrings
Definition
qqmlcompletioncontextstrings_p.h:27
CompletionContextStrings::filterChars
QStringView filterChars() const
Definition
qqmlcompletioncontextstrings_p.h:37
CompletionContextStrings::preLine
QStringView preLine() const
Definition
qqmlcompletioncontextstrings_p.h:32
CompletionContextStrings::offset
qsizetype offset() const
Definition
qqmlcompletioncontextstrings_p.h:49
CompletionContextStrings::atLineStart
bool atLineStart() const
Definition
qqmlcompletioncontextstrings_p.h:47
CompletionContextStrings::base
QStringView base() const
Definition
qqmlcompletioncontextstrings_p.h:42
CompletionContextStrings::CompletionContextStrings
CompletionContextStrings(QString code, qsizetype pos)
Definition
qqmlcompletioncontextstrings.cpp:6
qtdeclarative
src
qmlls
qqmlcompletioncontextstrings_p.h
Generated by
1.10.0