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
codechunk.h
Go to the documentation of this file.
1
// Copyright (C) 2019 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4
#
ifndef
CODECHUNK_H
5
#
define
CODECHUNK_H
6
7
#
include
<
QtCore
/
qstring
.
h
>
8
9
QT_BEGIN_NAMESPACE
10
11
// ### get rid of that class
12
13
class
CodeChunk
14
{
15
public
:
16
CodeChunk() : m_hotspot(-1) { }
17
18
void
append(
const
QString &lexeme);
19
void
appendHotspot()
20
{
21
if
(m_hotspot == -1)
22
m_hotspot = m_str.size();
23
}
24
25
[[nodiscard]]
bool
isEmpty()
const
{
return
m_str.isEmpty(); }
26
void
clear() { m_str.clear(); }
27
[[nodiscard]] QString toString()
const
{
return
m_str; }
28
[[nodiscard]] QString left()
const
29
{
30
return
m_str.left(m_hotspot == -1 ? m_str.size() : m_hotspot);
31
}
32
[[nodiscard]] QString right()
const
33
{
34
return
m_str.mid(m_hotspot == -1 ? m_str.size() : m_hotspot);
35
}
36
37
private
:
38
QString m_str {};
39
qsizetype m_hotspot {};
40
};
41
42
inline
bool
operator
==(
const
CodeChunk &c,
const
CodeChunk &d)
43
{
44
return
c.toString() == d.toString();
45
}
46
47
inline
bool
operator
!=(
const
CodeChunk &c,
const
CodeChunk &d)
48
{
49
return
!(c
==
d);
50
}
51
52
inline
bool
operator
<(
const
CodeChunk &c,
const
CodeChunk &d)
53
{
54
return
c.toString() < d.toString();
55
}
56
57
inline
bool
operator
>(
const
CodeChunk &c,
const
CodeChunk &d)
58
{
59
return
d
<
c;
60
}
61
62
inline
bool
operator
<=(
const
CodeChunk &c,
const
CodeChunk &d)
63
{
64
return
!(c
>
d);
65
}
66
67
inline
bool
operator
>=(
const
CodeChunk &c,
const
CodeChunk &d)
68
{
69
return
!(c
<
d);
70
}
71
72
QT_END_NAMESPACE
73
74
#
endif
needSpace
static const bool needSpace[9][9]
Definition
codechunk.cpp:40
category
static int category(QChar ch)
Definition
codechunk.cpp:53
charCategory
static const int charCategory[256]
Definition
codechunk.cpp:11
RAngle
@ RAngle
Definition
codechunk.cpp:8
Paren
@ Paren
Definition
codechunk.cpp:8
Comma
@ Comma
Definition
codechunk.cpp:8
RBrace
@ RBrace
Definition
codechunk.cpp:8
Other
@ Other
Definition
codechunk.cpp:8
Alnum
@ Alnum
Definition
codechunk.cpp:8
Gizmo
@ Gizmo
Definition
codechunk.cpp:8
LBrace
@ LBrace
Definition
codechunk.cpp:8
Colon
@ Colon
Definition
codechunk.cpp:8
operator>
bool operator>(const CodeChunk &c, const CodeChunk &d)
Definition
codechunk.h:57
operator<=
bool operator<=(const CodeChunk &c, const CodeChunk &d)
Definition
codechunk.h:62
operator>=
bool operator>=(const CodeChunk &c, const CodeChunk &d)
Definition
codechunk.h:67
operator<
bool operator<(const CodeChunk &c, const CodeChunk &d)
Definition
codechunk.h:52
operator==
bool operator==(const CodeChunk &c, const CodeChunk &d)
Definition
codechunk.h:42
operator!=
bool operator!=(const CodeChunk &c, const CodeChunk &d)
Definition
codechunk.h:47
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qttools
src
qdoc
qdoc
src
qdoc
codechunk.h
Generated on
for Qt by
1.18.0