Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
f6f0c810
Commit
f6f0c810
authored
Dec 30, 2008
by
Roberto Raggi
Browse files
Improved CppCodeCompletion::completeScope(). Added simple support for typedefs.
parent
702e078a
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/cpptools/cppcodecompletion.cpp
View file @
f6f0c810
...
...
@@ -515,7 +515,7 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
}
if
((
m_completionOperator
==
T_DOT
||
m_completionOperator
==
T_ARROW
)
&&
completeMember
(
exprTy
,
resolvedTypes
,
context
))
{
return
m_startPosition
;
}
else
if
(
m_completionOperator
==
T_COLON_COLON
&&
completeScope
(
exprTy
,
resolvedTypes
,
context
))
{
}
else
if
(
m_completionOperator
==
T_COLON_COLON
&&
completeScope
(
resolvedTypes
,
context
))
{
return
m_startPosition
;
}
else
if
(
m_completionOperator
==
T_SIGNAL
&&
completeSignal
(
exprTy
,
resolvedTypes
,
context
))
{
return
m_startPosition
;
...
...
@@ -682,32 +682,45 @@ bool CppCodeCompletion::completeMember(FullySpecifiedType,
return
false
;
}
bool
CppCodeCompletion
::
completeScope
(
FullySpecifiedType
exprTy
,
const
QList
<
TypeOfExpression
::
Result
>
&
resolvedTypes
,
bool
CppCodeCompletion
::
completeScope
(
const
QList
<
TypeOfExpression
::
Result
>
&
results
,
const
LookupContext
&
context
)
{
if
(
results
.
isEmpty
())
return
false
;
// nothing to do.
// Search for a class or a namespace.
foreach
(
TypeOfExpression
::
Result
p
,
resolvedTypes
)
{
if
(
p
.
first
->
isClass
()
||
p
.
first
->
isNamespace
())
{
exprTy
=
p
.
first
;
TypeOfExpression
::
Result
result
(
FullySpecifiedType
(),
0
);
foreach
(
result
,
results
)
{
FullySpecifiedType
ty
=
result
.
first
;
if
(
ty
->
isClass
()
||
ty
->
isNamespace
())
break
;
}
}
if
(
exprTy
->
asNamespace
())
{
FullySpecifiedType
exprTy
=
result
.
first
;
if
(
!
exprTy
)
{
return
false
;
}
else
if
(
exprTy
->
asNamespace
())
{
QList
<
Symbol
*>
candidates
;
foreach
(
TypeOfExpression
::
Result
p
,
res
olvedType
s
)
{
foreach
(
TypeOfExpression
::
Result
p
,
res
ult
s
)
{
if
(
Namespace
*
ns
=
p
.
first
->
asNamespace
())
candidates
.
append
(
ns
);
}
completeNamespace
(
candidates
,
context
);
}
else
if
(
exprTy
->
isClass
())
{
QList
<
Symbol
*>
candidates
;
foreach
(
TypeOfExpression
::
Result
p
,
res
olvedType
s
)
{
foreach
(
TypeOfExpression
::
Result
p
,
res
ult
s
)
{
if
(
Class
*
k
=
p
.
first
->
asClass
())
candidates
.
append
(
k
);
}
completeClass
(
candidates
,
context
);
}
else
if
(
Symbol
*
symbol
=
result
.
second
)
{
if
(
symbol
->
isTypedef
())
{
SymbolsForDotAccess
symbolsForDotAccess
;
const
QList
<
Symbol
*>
candidates
=
symbolsForDotAccess
(
result
,
context
);
completeClass
(
candidates
,
context
);
}
}
return
!
m_completions
.
isEmpty
();
...
...
src/plugins/cpptools/cppcodecompletion.h
View file @
f6f0c810
...
...
@@ -100,8 +100,7 @@ private:
const
QList
<
CPlusPlus
::
TypeOfExpression
::
Result
>
&
,
const
CPlusPlus
::
LookupContext
&
context
);
bool
completeScope
(
CPlusPlus
::
FullySpecifiedType
exprTy
,
const
QList
<
CPlusPlus
::
TypeOfExpression
::
Result
>
&
,
bool
completeScope
(
const
QList
<
CPlusPlus
::
TypeOfExpression
::
Result
>
&
,
const
CPlusPlus
::
LookupContext
&
context
);
void
completeNamespace
(
const
QList
<
CPlusPlus
::
Symbol
*>
&
candidates
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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