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
7446f5ca
Commit
7446f5ca
authored
May 11, 2010
by
Roberto Raggi
Browse files
Describe the LookupContext API.
parent
6d6e18aa
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/libs/cplusplus/LookupContext.cpp
View file @
7446f5ca
...
...
@@ -738,7 +738,7 @@ void CreateBindings::process(Document::Ptr doc)
}
}
ClassOrNamespace
*
CreateBindings
::
enter
Entity
(
Symbol
*
symbol
)
ClassOrNamespace
*
CreateBindings
::
enter
ClassOrNamespaceBinding
(
Symbol
*
symbol
)
{
ClassOrNamespace
*
entity
=
_currentClassOrNamespace
->
findOrCreate
(
symbol
->
name
());
entity
->
addSymbol
(
symbol
);
...
...
@@ -746,7 +746,7 @@ ClassOrNamespace *CreateBindings::enterEntity(Symbol *symbol)
return
switchCurrentClassOrNamespace
(
entity
);
}
ClassOrNamespace
*
CreateBindings
::
enterGlobal
Entity
(
Symbol
*
symbol
)
ClassOrNamespace
*
CreateBindings
::
enterGlobal
ClassOrNamespace
(
Symbol
*
symbol
)
{
ClassOrNamespace
*
entity
=
_globalNamespace
->
findOrCreate
(
symbol
->
name
());
entity
->
addSymbol
(
symbol
);
...
...
@@ -756,7 +756,7 @@ ClassOrNamespace *CreateBindings::enterGlobalEntity(Symbol *symbol)
bool
CreateBindings
::
visit
(
Namespace
*
ns
)
{
ClassOrNamespace
*
previous
=
enter
Entity
(
ns
);
ClassOrNamespace
*
previous
=
enter
ClassOrNamespaceBinding
(
ns
);
for
(
unsigned
i
=
0
;
i
<
ns
->
memberCount
();
++
i
)
process
(
ns
->
memberAt
(
i
));
...
...
@@ -792,7 +792,7 @@ bool CreateBindings::visit(Class *klass)
bool
CreateBindings
::
visit
(
ForwardClassDeclaration
*
klass
)
{
if
(
!
klass
->
isFriend
())
{
ClassOrNamespace
*
previous
=
enter
Entity
(
klass
);
ClassOrNamespace
*
previous
=
enter
ClassOrNamespaceBinding
(
klass
);
_currentClassOrNamespace
=
previous
;
}
...
...
@@ -872,7 +872,7 @@ bool CreateBindings::visit(NamespaceAlias *a)
bool
CreateBindings
::
visit
(
ObjCClass
*
klass
)
{
ClassOrNamespace
*
previous
=
enterGlobal
Entity
(
klass
);
ClassOrNamespace
*
previous
=
enterGlobal
ClassOrNamespace
(
klass
);
process
(
klass
->
baseClass
());
...
...
@@ -899,14 +899,14 @@ bool CreateBindings::visit(ObjCBaseClass *b)
bool
CreateBindings
::
visit
(
ObjCForwardClassDeclaration
*
klass
)
{
ClassOrNamespace
*
previous
=
enterGlobal
Entity
(
klass
);
ClassOrNamespace
*
previous
=
enterGlobal
ClassOrNamespace
(
klass
);
_currentClassOrNamespace
=
previous
;
return
false
;
}
bool
CreateBindings
::
visit
(
ObjCProtocol
*
proto
)
{
ClassOrNamespace
*
previous
=
enterGlobal
Entity
(
proto
);
ClassOrNamespace
*
previous
=
enterGlobal
ClassOrNamespace
(
proto
);
for
(
unsigned
i
=
0
;
i
<
proto
->
protocolCount
();
++
i
)
process
(
proto
->
protocolAt
(
i
));
...
...
@@ -931,7 +931,7 @@ bool CreateBindings::visit(ObjCBaseProtocol *b)
bool
CreateBindings
::
visit
(
ObjCForwardProtocolDeclaration
*
proto
)
{
ClassOrNamespace
*
previous
=
enterGlobal
Entity
(
proto
);
ClassOrNamespace
*
previous
=
enterGlobal
ClassOrNamespace
(
proto
);
_currentClassOrNamespace
=
previous
;
return
false
;
}
...
...
src/libs/cplusplus/LookupContext.h
View file @
7446f5ca
...
...
@@ -115,33 +115,52 @@ public:
CreateBindings
(
Document
::
Ptr
thisDocument
,
const
Snapshot
&
snapshot
);
virtual
~
CreateBindings
();
/// Returns the binding for the global namespace.
ClassOrNamespace
*
globalNamespace
()
const
;
ClassOrNamespace
*
findClassOrNamespace
(
Symbol
*
s
);
// ### rename
/// Finds the binding associated to the given symbol.
ClassOrNamespace
*
findClassOrNamespace
(
Symbol
*
symbol
);
/// Find the binding with the given path.
/// \internal
ClassOrNamespace
*
findClassOrNamespace
(
const
QList
<
const
Name
*>
&
path
);
/// Returns the Control that must be used to create temporary symbols.
/// \internal
Control
*
control
()
const
;
/// Searches in \a scope for symbols with the given \a name.
/// Store the result in \a results.
/// \internal
void
lookupInScope
(
const
Name
*
name
,
Scope
*
scope
,
QList
<
Symbol
*>
*
result
,
const
TemplateNameId
*
templateId
);
/// Create bindings for the symbols reachable from \a rootSymbol.
/// \internal
void
process
(
Symbol
*
s
,
ClassOrNamespace
*
classOrNamespace
);
void
process
(
Symbol
*
rootSymbol
,
ClassOrNamespace
*
classOrNamespace
);
/// Create an empty ClassOrNamespace binding with the given \a parent.
/// \internal
ClassOrNamespace
*
allocClassOrNamespace
(
ClassOrNamespace
*
parent
);
protected:
using
SymbolVisitor
::
visit
;
/// Change the current ClassOrNamespace binding.
ClassOrNamespace
*
switchCurrentClassOrNamespace
(
ClassOrNamespace
*
classOrNamespace
);
ClassOrNamespace
*
enterEntity
(
Symbol
*
symbol
);
ClassOrNamespace
*
enterGlobalEntity
(
Symbol
*
symbol
);
void
process
(
Document
::
Ptr
doc
);
void
process
(
Symbol
*
symbol
);
/// Enters the ClassOrNamespace binding associated with the given \a symbol.
ClassOrNamespace
*
enterClassOrNamespaceBinding
(
Symbol
*
symbol
);
/// Enters a ClassOrNamespace binding for the given \a symbol in the global
/// namespace binding.
ClassOrNamespace
*
enterGlobalClassOrNamespace
(
Symbol
*
symbol
);
/// Creates bindings for the given \a document.
void
process
(
Document
::
Ptr
document
);
/// Creates bindings for the symbols reachable from the \a root symbol.
void
process
(
Symbol
*
root
);
virtual
bool
visit
(
Namespace
*
ns
);
virtual
bool
visit
(
Class
*
klass
);
...
...
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