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
4e76b54d
Commit
4e76b54d
authored
Dec 05, 2008
by
Thorbjørn Lindeijer
Browse files
Use QFlags for indicating symbols to search for
parent
923bfa52
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/cpptools/searchsymbols.cpp
View file @
4e76b54d
...
...
@@ -40,13 +40,13 @@ using namespace CPlusPlus;
using
namespace
CppTools
::
Internal
;
SearchSymbols
::
SearchSymbols
()
:
symbolsToSearchFor
(
Classes
Methods
Functions
And
Enums
)
symbolsToSearchFor
(
Classes
|
Functions
|
Enums
)
{
}
void
SearchSymbols
::
setSymbolsToSearchFor
(
SymbolType
type
)
void
SearchSymbols
::
setSymbolsToSearchFor
(
SymbolType
s
type
s
)
{
symbolsToSearchFor
=
type
;
symbolsToSearchFor
=
type
s
;
}
QList
<
ModelItemInfo
>
SearchSymbols
::
operator
()(
Document
::
Ptr
doc
,
const
QString
&
scope
)
...
...
@@ -69,7 +69,7 @@ QString SearchSymbols::switchScope(const QString &scope)
bool
SearchSymbols
::
visit
(
Enum
*
symbol
)
{
if
(
symbolsToSearchFor
!=
ClassesMethodsFunctionsAnd
Enums
)
if
(
!
(
symbolsToSearchFor
&
Enums
)
)
return
false
;
QString
name
=
symbolName
(
symbol
);
...
...
@@ -89,7 +89,7 @@ bool SearchSymbols::visit(Enum *symbol)
bool
SearchSymbols
::
visit
(
Function
*
symbol
)
{
if
(
symbolsToSearchFor
!=
ClassesMethods
Functions
AndEnums
)
if
(
!
(
symbolsToSearchFor
&
Functions
)
)
return
false
;
QString
name
=
symbolName
(
symbol
);
...
...
@@ -131,6 +131,9 @@ bool SearchSymbols::visit(Declaration *symbol)
bool
SearchSymbols
::
visit
(
Class
*
symbol
)
{
if
(
!
(
symbolsToSearchFor
&
Classes
))
return
false
;
QString
name
=
symbolName
(
symbol
);
QString
previousScope
=
switchScope
(
name
);
QIcon
icon
=
icons
.
iconForSymbol
(
symbol
);
...
...
src/plugins/cpptools/searchsymbols.h
View file @
4e76b54d
...
...
@@ -80,15 +80,16 @@ class SearchSymbols: public std::unary_function<CPlusPlus::Document::Ptr, QList<
protected
CPlusPlus
::
SymbolVisitor
{
public:
// TODO: Probably should use QFlags
enum
SymbolType
{
Classes
,
ClassesMethodsFunctionsAndEnums
Classes
=
0x1
,
Functions
=
0x2
,
Enums
=
0x4
};
Q_DECLARE_FLAGS
(
SymbolTypes
,
SymbolType
)
SearchSymbols
();
void
setSymbolsToSearchFor
(
SymbolType
type
);
void
setSymbolsToSearchFor
(
SymbolType
s
type
s
);
QList
<
ModelItemInfo
>
operator
()(
CPlusPlus
::
Document
::
Ptr
doc
)
{
return
operator
()(
doc
,
QString
());
}
...
...
@@ -117,9 +118,11 @@ private:
CPlusPlus
::
Overview
overview
;
CPlusPlus
::
Icons
icons
;
QList
<
ModelItemInfo
>
items
;
SymbolType
symbolsToSearchFor
;
SymbolType
s
symbolsToSearchFor
;
};
Q_DECLARE_OPERATORS_FOR_FLAGS
(
SearchSymbols
::
SymbolTypes
)
}
// namespace Internal
}
// namespace CppTools
...
...
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