Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
85babacb
Commit
85babacb
authored
Jan 05, 2009
by
Roberto Raggi
Browse files
Replace a. with a[0]. when `a' has type array of T.
parent
7fbc2286
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plugins/cpptools/cppcodecompletion.cpp
View file @
85babacb
...
...
@@ -662,6 +662,24 @@ bool CppCodeCompletion::completeMember(const QList<TypeOfExpression::Result> &re
ty
=
refTy
->
elementType
();
NamedType
*
namedTy
=
0
;
if
(
ArrayType
*
arrayTy
=
ty
->
asArrayType
())
{
// Replace . with [0]. when `ty' is an array type.
FullySpecifiedType
elementTy
=
arrayTy
->
elementType
();
if
(
ReferenceType
*
refTy
=
elementTy
->
asReferenceType
())
elementTy
=
refTy
->
elementType
();
if
(
elementTy
->
isNamedType
()
||
elementTy
->
isPointerType
())
{
ty
=
elementTy
;
const
int
length
=
m_editor
->
position
()
-
m_startPosition
+
1
;
m_editor
->
setCurPos
(
m_startPosition
-
1
);
m_editor
->
replace
(
length
,
QLatin1String
(
"[0]."
));
m_startPosition
+=
3
;
}
}
if
(
PointerType
*
ptrTy
=
ty
->
asPointerType
())
{
// Replace . with ->
int
length
=
m_editor
->
position
()
-
m_startPosition
+
1
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment