Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qt-creator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Hunger
qt-creator
Commits
0614e19d
Commit
0614e19d
authored
15 years ago
by
Roberto Raggi
Browse files
Options
Downloads
Patches
Plain Diff
Rename MyProcess and MyReduce.
parent
d185116c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/cpptools/cppfindreferences.cpp
+41
-37
41 additions, 37 deletions
src/plugins/cpptools/cppfindreferences.cpp
with
41 additions
and
37 deletions
src/plugins/cpptools/cppfindreferences.cpp
+
41
−
37
View file @
0614e19d
...
...
@@ -64,45 +64,19 @@
using
namespace
CppTools
::
Internal
;
using
namespace
CPlusPlus
;
CppFindReferences
::
CppFindReferences
(
CppTools
::
CppModelManagerInterface
*
modelManager
)
:
QObject
(
modelManager
),
_modelManager
(
modelManager
),
_resultWindow
(
ExtensionSystem
::
PluginManager
::
instance
()
->
getObject
<
Find
::
SearchResultWindow
>
())
{
m_watcher
.
setPendingResultsLimit
(
1
);
connect
(
&
m_watcher
,
SIGNAL
(
resultsReadyAt
(
int
,
int
)),
this
,
SLOT
(
displayResults
(
int
,
int
)));
connect
(
&
m_watcher
,
SIGNAL
(
finished
()),
this
,
SLOT
(
searchFinished
()));
}
CppFindReferences
::~
CppFindReferences
()
{
}
QList
<
int
>
CppFindReferences
::
references
(
Symbol
*
symbol
,
Document
::
Ptr
doc
,
const
Snapshot
&
snapshot
)
const
{
QList
<
int
>
references
;
FindUsages
findUsages
(
doc
,
snapshot
);
findUsages
.
setGlobalNamespaceBinding
(
bind
(
doc
,
snapshot
));
findUsages
(
symbol
);
references
=
findUsages
.
references
();
namespace
{
return
references
;
}
class
MyProcess
:
public
std
::
unary_function
<
QString
,
QList
<
Usage
>
>
class
ProcessFile
:
public
std
::
unary_function
<
QString
,
QList
<
Usage
>
>
{
const
QMap
<
QString
,
QString
>
w
l
;
const
QMap
<
QString
,
QString
>
w
orkingList
;
const
Snapshot
snapshot
;
Symbol
*
symbol
;
public:
My
Process
(
const
QMap
<
QString
,
QString
>
w
l
,
Process
File
(
const
QMap
<
QString
,
QString
>
w
orkingList
,
const
Snapshot
snapshot
,
Symbol
*
symbol
)
:
w
l
(
wl
),
snapshot
(
snapshot
),
symbol
(
symbol
)
:
w
orkingList
(
workingList
),
snapshot
(
snapshot
),
symbol
(
symbol
)
{
}
QList
<
Usage
>
operator
()(
const
QString
&
fileName
)
...
...
@@ -118,8 +92,8 @@ public:
QByteArray
source
;
if
(
w
l
.
contains
(
fileName
))
source
=
snapshot
.
preprocessedCode
(
w
l
.
value
(
fileName
),
fileName
);
if
(
w
orkingList
.
contains
(
fileName
))
source
=
snapshot
.
preprocessedCode
(
w
orkingList
.
value
(
fileName
),
fileName
);
else
{
QFile
file
(
fileName
);
if
(
!
file
.
open
(
QFile
::
ReadOnly
))
...
...
@@ -147,12 +121,12 @@ public:
}
};
class
MyReduce
:
public
std
::
binary_function
<
QList
<
Usage
>
&
,
QList
<
Usage
>
,
void
>
class
UpdateUI
:
public
std
::
binary_function
<
QList
<
Usage
>
&
,
QList
<
Usage
>
,
void
>
{
QFutureInterface
<
Usage
>
*
future
;
public:
MyReduce
(
QFutureInterface
<
Usage
>
*
future
)
:
future
(
future
)
{}
UpdateUI
(
QFutureInterface
<
Usage
>
*
future
)
:
future
(
future
)
{}
void
operator
()(
QList
<
Usage
>
&
,
const
QList
<
Usage
>
&
usages
)
{
...
...
@@ -163,6 +137,36 @@ public:
}
};
}
// end of anonymous namespace
CppFindReferences
::
CppFindReferences
(
CppTools
::
CppModelManagerInterface
*
modelManager
)
:
QObject
(
modelManager
),
_modelManager
(
modelManager
),
_resultWindow
(
ExtensionSystem
::
PluginManager
::
instance
()
->
getObject
<
Find
::
SearchResultWindow
>
())
{
m_watcher
.
setPendingResultsLimit
(
1
);
connect
(
&
m_watcher
,
SIGNAL
(
resultsReadyAt
(
int
,
int
)),
this
,
SLOT
(
displayResults
(
int
,
int
)));
connect
(
&
m_watcher
,
SIGNAL
(
finished
()),
this
,
SLOT
(
searchFinished
()));
}
CppFindReferences
::~
CppFindReferences
()
{
}
QList
<
int
>
CppFindReferences
::
references
(
Symbol
*
symbol
,
Document
::
Ptr
doc
,
const
Snapshot
&
snapshot
)
const
{
QList
<
int
>
references
;
FindUsages
findUsages
(
doc
,
snapshot
);
findUsages
.
setGlobalNamespaceBinding
(
bind
(
doc
,
snapshot
));
findUsages
(
symbol
);
references
=
findUsages
.
references
();
return
references
;
}
static
void
find_helper
(
QFutureInterface
<
Usage
>
&
future
,
const
QMap
<
QString
,
QString
>
wl
,
Snapshot
snapshot
,
...
...
@@ -195,8 +199,8 @@ static void find_helper(QFutureInterface<Usage> &future,
future
.
setProgressRange
(
0
,
files
.
size
());
My
Process
process
(
wl
,
snapshot
,
symbol
);
MyReduce
reduce
(
&
future
);
Process
File
process
(
wl
,
snapshot
,
symbol
);
UpdateUI
reduce
(
&
future
);
QtConcurrent
::
blockingMappedReduced
<
QList
<
Usage
>
>
(
files
,
process
,
reduce
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment