Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Q
qt-creator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tobias Hunger
qt-creator
Commits
aa8a6706
Commit
aa8a6706
authored
Dec 15, 2009
by
Roberto Raggi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide the implementation details of CppModelManagerInterface::WorkingCopy.
parent
b168eec2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
19 deletions
+42
-19
src/plugins/cpptools/cppfindreferences.cpp
src/plugins/cpptools/cppfindreferences.cpp
+9
-9
src/plugins/cpptools/cppmodelmanager.cpp
src/plugins/cpptools/cppmodelmanager.cpp
+9
-9
src/plugins/cpptools/cppmodelmanagerinterface.h
src/plugins/cpptools/cppmodelmanagerinterface.h
+24
-1
No files found.
src/plugins/cpptools/cppfindreferences.cpp
View file @
aa8a6706
...
...
@@ -68,15 +68,15 @@ namespace {
class
ProcessFile
:
public
std
::
unary_function
<
QString
,
QList
<
Usage
>
>
{
const
QHash
<
QString
,
QString
>
workingList
;
const
CppTools
::
CppModelManagerInterface
::
WorkingCopy
workingCopy
;
const
Snapshot
snapshot
;
Symbol
*
symbol
;
public:
ProcessFile
(
const
QHash
<
QString
,
QString
>
workingList
,
const
Snapshot
snapshot
,
Symbol
*
symbol
)
:
working
List
(
workingList
),
snapshot
(
snapshot
),
symbol
(
symbol
)
ProcessFile
(
const
CppTools
::
CppModelManagerInterface
::
WorkingCopy
&
workingCopy
,
const
Snapshot
snapshot
,
Symbol
*
symbol
)
:
working
Copy
(
workingCopy
),
snapshot
(
snapshot
),
symbol
(
symbol
)
{
}
QList
<
Usage
>
operator
()(
const
QString
&
fileName
)
...
...
@@ -92,8 +92,8 @@ public:
QByteArray
source
;
if
(
working
List
.
contains
(
fileName
))
source
=
snapshot
.
preprocessedCode
(
working
List
.
valu
e
(
fileName
),
fileName
);
if
(
working
Copy
.
contains
(
fileName
))
source
=
snapshot
.
preprocessedCode
(
working
Copy
.
sourc
e
(
fileName
),
fileName
);
else
{
QFile
file
(
fileName
);
if
(
!
file
.
open
(
QFile
::
ReadOnly
))
...
...
@@ -168,7 +168,7 @@ QList<int> CppFindReferences::references(Symbol *symbol,
}
static
void
find_helper
(
QFutureInterface
<
Usage
>
&
future
,
const
QHash
<
QString
,
QString
>
workingList
,
const
CppTools
::
CppModelManagerInterface
::
WorkingCopy
workingCopy
,
Snapshot
snapshot
,
Symbol
*
symbol
)
{
...
...
@@ -199,7 +199,7 @@ static void find_helper(QFutureInterface<Usage> &future,
future
.
setProgressRange
(
0
,
files
.
size
());
ProcessFile
process
(
working
List
,
snapshot
,
symbol
);
ProcessFile
process
(
working
Copy
,
snapshot
,
symbol
);
UpdateUI
reduce
(
&
future
);
QtConcurrent
::
blockingMappedReduced
<
QList
<
Usage
>
>
(
files
,
process
,
reduce
);
...
...
src/plugins/cpptools/cppmodelmanager.cpp
View file @
aa8a6706
...
...
@@ -171,7 +171,7 @@ public:
virtual
~
CppPreprocessor
();
void
setRevision
(
unsigned
revision
);
void
setWorkingCopy
(
const
QHash
<
QString
,
QString
>
&
workingCopy
);
void
setWorkingCopy
(
const
CppModelManagerInterface
::
WorkingCopy
&
workingCopy
);
void
setIncludePaths
(
const
QStringList
&
includePaths
);
void
setFrameworkPaths
(
const
QStringList
&
frameworkPaths
);
void
setProjectFiles
(
const
QStringList
&
files
);
...
...
@@ -215,7 +215,7 @@ private:
Preprocessor
preprocess
;
QStringList
m_includePaths
;
QStringList
m_systemIncludePaths
;
QHash
<
QString
,
QString
>
m_workingCopy
;
CppModelManagerInterface
::
WorkingCopy
m_workingCopy
;
QStringList
m_projectFiles
;
QStringList
m_frameworkPaths
;
QSet
<
QString
>
m_included
;
...
...
@@ -241,7 +241,7 @@ CppPreprocessor::~CppPreprocessor()
void
CppPreprocessor
::
setRevision
(
unsigned
revision
)
{
m_revision
=
revision
;
}
void
CppPreprocessor
::
setWorkingCopy
(
const
QHash
<
QString
,
QString
>
&
workingCopy
)
void
CppPreprocessor
::
setWorkingCopy
(
const
CppTools
::
CppModelManagerInterface
::
WorkingCopy
&
workingCopy
)
{
m_workingCopy
=
workingCopy
;
}
void
CppPreprocessor
::
setIncludePaths
(
const
QStringList
&
includePaths
)
...
...
@@ -263,13 +263,13 @@ class Process: public std::unary_function<Document::Ptr, void>
{
QPointer
<
CppModelManager
>
_modelManager
;
Snapshot
_snapshot
;
QHash
<
QString
,
QString
>
_workingCopy
;
CppModelManager
::
WorkingCopy
_workingCopy
;
Document
::
Ptr
_doc
;
public:
Process
(
QPointer
<
CppModelManager
>
modelManager
,
Snapshot
snapshot
,
const
QHash
<
QString
,
QString
>
&
workingCopy
)
const
CppModelManager
::
WorkingCopy
&
workingCopy
)
:
_modelManager
(
modelManager
),
_snapshot
(
snapshot
),
_workingCopy
(
workingCopy
)
...
...
@@ -335,7 +335,7 @@ bool CppPreprocessor::includeFile(const QString &absoluteFilePath, QString *resu
if
(
m_workingCopy
.
contains
(
absoluteFilePath
))
{
m_included
.
insert
(
absoluteFilePath
);
*
result
=
m_workingCopy
.
valu
e
(
absoluteFilePath
);
*
result
=
m_workingCopy
.
sourc
e
(
absoluteFilePath
);
return
true
;
}
...
...
@@ -797,19 +797,19 @@ CppModelManager::WorkingCopy CppModelManager::buildWorkingCopyList()
TextEditor
::
ITextEditor
*
textEditor
=
it
.
key
();
CppEditorSupport
*
editorSupport
=
it
.
value
();
QString
fileName
=
textEditor
->
file
()
->
fileName
();
workingCopy
[
fileName
]
=
editorSupport
->
contents
(
);
workingCopy
.
insert
(
fileName
,
editorSupport
->
contents
()
);
}
QSetIterator
<
AbstractEditorSupport
*>
jt
(
m_addtionalEditorSupport
);
while
(
jt
.
hasNext
())
{
AbstractEditorSupport
*
es
=
jt
.
next
();
workingCopy
[
es
->
fileName
()]
=
es
->
contents
(
);
workingCopy
.
insert
(
es
->
fileName
(),
es
->
contents
()
);
}
// add the project configuration file
QByteArray
conf
(
pp_configuration
);
conf
+=
definedMacros
();
workingCopy
[
pp_configuration_file
]
=
conf
;
workingCopy
.
insert
(
pp_configuration_file
,
conf
)
;
return
workingCopy
;
}
...
...
src/plugins/cpptools/cppmodelmanagerinterface.h
View file @
aa8a6706
...
...
@@ -78,7 +78,30 @@ public:
QStringList
frameworkPaths
;
};
typedef
QHash
<
QString
,
QString
>
WorkingCopy
;
class
WorkingCopy
{
public:
typedef
QHash
<
QString
,
QString
>
Table
;
typedef
Table
::
const_iterator
iterator
;
typedef
Table
::
const_iterator
const_iterator
;
public:
const_iterator
begin
()
const
{
return
_elements
.
begin
();
}
const_iterator
end
()
const
{
return
_elements
.
end
();
}
void
insert
(
const
QString
&
fileName
,
const
QString
&
source
)
{
_elements
.
insert
(
fileName
,
source
);
}
bool
contains
(
const
QString
&
fileName
)
const
{
return
_elements
.
contains
(
fileName
);
}
QString
source
(
const
QString
&
fileName
)
const
{
return
_elements
.
value
(
fileName
);
}
private:
Table
_elements
;
};
public:
CppModelManagerInterface
(
QObject
*
parent
=
0
)
:
QObject
(
parent
)
{}
...
...
Write
Preview
Markdown
is supported
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