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
7d24f921
Commit
7d24f921
authored
Dec 12, 2008
by
dt
Browse files
Merge branch '0.9.1-beta' of git@scm.dev.nokia.troll.no:creator/mainline into 0.9.1-beta
parents
a7227782
8e297ace
Changes
44
Hide whitespace changes
Inline
Side-by-side
doc/coding-style.qdoc
0 → 100644
View file @
7d24f921
/*!
\contentpage{index.html}{Qt Creator}
\page coding-style.html
\title Qt Creator Coding Rules
THIS IS PRELIMINARY.
\section1 Introduction
The aim of this section is to serve as a guide for the developers, to aid us
to build understandable and maintainable code, to create less confusion and
surprises when working on Qt Creator.
As usual: Rules are not set in stone. If there's a good reason to break one,
do it, preferably after making sure that there are others agreeing.
This document is incomplete.
In general, if you want to contribute to the main source, we expect at least
that you:
\list 1
\o The most important rule first: KISS (keep it simple ...): always
use a simple implementation in favor of a more complicated one.
This eases maintenance a lot.
\o Write good C++ code: Readable, well commented when necessary,
and taking advantage of the OO model. Follow the \l{Formatting} guidelines.
There are also certain \l{Code Constructs} that we try to follow.
\o Adapt the code to the structures already existing in Qt Creator, or in
the case that you have better ideas, discuss them with other developers
before writing the code.
\o Take advantage of Qt. Don't re-invent the wheel. Think about what parts
of your code are generic enough that they might be incorporated into
Qt proper.
\o Document interfaces. Right now we use qdoc, but changing to doxygen
is being considered.
\endlist
\section1 Submitting Code
It is implicitly understood that all patches contributed to The Qt Creator
Project are made under under the Gnu General Public License, version 2 or later
and
If you have a problem with that, don't contribute code.
Also please don't just pop up out of the blue with a huge patch (or
small) that changes something substantial in Qt Creator. Always discuss your
ideas with the other developers on mailing list first.
When you create the patch, please use git or use "diff -up" since we find
that a lot easier to read than the other diff formats. Also please do not
send patches that implements or fixes several different things; several
patches is a much better option.
We also require you to provide a commit message entry with every patch,
this describes in detail what the patch is doing.
\section1 Code Constructs
We have several guidelines on code constructs, some of these exist to
make the code faster, others to make the code clearer. Yet others
exist to allow us to take advantage of the strong type checking
in C++.
\list 1
\o Declaration of variables should wait as long as possible. The rule
is: "Don't declare it until you need it." In C++ there are a lot of
user defined types, and these can very often be expensive to
initialize. This rule connects to the next rule too.
\o Make the scope of a variable as small as possible.
\o Prefer preincrement to postincrement whenever possible.
Preincrement has potential of being faster than postincrement. Just
think about the obvious implementations of pre/post-increment. This
rule applies to decrement too.
\code
++T;
--U;
-NOT-
T++; // not used in Qt Creator
U--; // not used in Qt Creator
\endcode
\o Try to minimize evaluation of the same code over and over. This is
aimed especially at loops.
\code
Container::iterator end = large.end();
for (Container::iterator it = large.begin(); it != end; ++it) {
...;
}
-NOT-
for (Container::iterator it = large.begin();
it != large.end(); ++it) {
...;
}
\endcode
\section1 Formatting
\section2 Declarations
Only one declaration on each line.
\code
int a;
int b;
-NOT-
int a, b; // not used in Qt Creator
\endcode
This is especially important when initialization is done at the same
time.
\code
QString a = "Joe";
QString b = "Foo";
-NOT-
QString a = "Joe", b = "Foo"; // not used in Qt Creator
\endcode
[Note that 'QString a = "Joe"' is formally calling a copy constructor
on a temporary constructed from a string literal and therefore has the
potential of being more expensive then direct construction by
'QString a("joe")'. However the compiler is allowed to elide the copy
(even if it had side effects), and modern compilers typically do so.
Given these equal costs, Qt Creator code favours the '=' idiom as it is in
line with the traditional C-style initialization, _and_ cannot be
mistaken as function declaration, _and_ reduces the level of nested
parantheses in more initializations.]
\section2 Pointers and references
\code
char *p = "flop";
char &c = *p;
-NOT-
char* p = "flop"; // not used in Qt Creator
char & c = *p; // not used in Qt Creator
\endcode
This is simply in line with the official Qt guide lines.
Also note that we will have:
\code
const char *p;
-NOT-
char const * p; // not used in Qt Creator
\endcode
Using a plain 0 for Null pointer constants is always correct and least effort
to type. So:
\code
void *p = 0;
-NOT-
void *p = NULL; // not used in Qt Creator
-NOT-
void *p = '\0'; // not used in Qt Creator
-NOT-
void *p = 42 - 7 * 6; // also not used in Qt Creator
\endcode
Note: As an exception, imported third party code as well as code
interfacing the "native" APIs (src/support/os_*) can use NULL.
\section2 Operator names and parentheses
\code
operator==(type)
-NOT-
operator == (type) // not used in Qt Creator
\endcode
The == is part of the function name, separating it makes the
declaration look like an expression.
\section2 Function names and parentheses
\code
void mangle()
-NOT-
void mangle () // not used in Qt Creator
\endcode
\section2 Naming rules
Simply follow the style of Qt proper. As examples:
\list
\o Use descriptive but simple and short names. Do not abbreviate.
\o Class names are capitalized, and function names lowercased.
Enums are named like Classes, values are in lower-case.
\endlist
\section2 Formatting
Adapt the formatting of your code to the one used in the
other parts of Qt Creator. In case there is different formatting for
the same construct, use the one used more often.
\section2 Declarations
- Use this order for the access sections of your class: public,
protected, private. The public section is interesting for every
user of the class. The private section is only of interest for the
implementors of the class (you). [Obviously not true since this is
for developers, and we do not want one developer only to be able to
read and understand the implementation of class internals. Lgb]
- Avoid declaring global objects in the declaration file of the class.
If the same variable is used for all objects, use a static member.
- Avoid global or static variables.
\section2 File headers
If you create a new file, the top of the file should include a
header comment equal to the one found in other source files of Qt Creator.
\section2 Documentation
The documentation is generated from source and header files.
You document for the other developers, not for yourself.
In the header you should document interfaces, i.e. what the function does,
not the implementation.
In the .cpp files you document the implementation if the implementation
in non-obvious.
*/
src/libs/cplusplus/CppDocument.h
View file @
7d24f921
...
...
@@ -40,7 +40,7 @@
#include <QByteArray>
#include <QList>
#include <Q
Set
>
#include <Q
Map
>
#include <QSharedPointer>
#include <QString>
#include <QStringList>
...
...
@@ -236,6 +236,16 @@ private:
QList
<
MacroUse
>
_macroUses
;
};
class
CPLUSPLUS_EXPORT
Snapshot
:
public
QMap
<
QString
,
Document
::
Ptr
>
{
public:
Snapshot
()
{
}
~
Snapshot
()
{
}
};
}
// end of namespace CPlusPlus
#endif // CPPDOCUMENT_H
src/libs/cplusplus/LookupContext.cpp
View file @
7d24f921
...
...
@@ -77,7 +77,7 @@ LookupContext::LookupContext(Control *control)
LookupContext
::
LookupContext
(
Symbol
*
symbol
,
Document
::
Ptr
expressionDocument
,
Document
::
Ptr
thisDocument
,
const
QMap
<
QString
,
Document
::
Ptr
>
&
documents
)
const
Snapshot
&
documents
)
:
_symbol
(
symbol
),
_expressionDocument
(
expressionDocument
),
_thisDocument
(
thisDocument
),
...
...
src/libs/cplusplus/LookupContext.h
View file @
7d24f921
...
...
@@ -57,7 +57,7 @@ public:
LookupContext
(
Symbol
*
symbol
,
Document
::
Ptr
expressionDocument
,
Document
::
Ptr
thisDocument
,
const
QMap
<
QString
,
Document
::
Ptr
>
&
documents
);
const
Snapshot
&
documents
);
LookupContext
(
Symbol
*
symbol
,
const
LookupContext
&
context
);
...
...
@@ -87,7 +87,7 @@ public:
QList
<
Symbol
*>
resolveClassOrNamespace
(
Name
*
name
)
const
{
return
resolveClassOrNamespace
(
name
,
visibleScopes
());
}
QMap
<
QString
,
Document
::
Ptr
>
documents
()
const
Snapshot
snapshot
()
const
{
return
_documents
;
}
enum
ResolveMode
{
...
...
@@ -140,7 +140,7 @@ private:
Document
::
Ptr
_thisDocument
;
// All documents.
QMap
<
QString
,
Document
::
Ptr
>
_documents
;
Snapshot
_documents
;
// Visible scopes.
QList
<
Scope
*>
_visibleScopes
;
...
...
src/libs/cplusplus/TypeOfExpression.cpp
View file @
7d24f921
...
...
@@ -46,9 +46,9 @@ TypeOfExpression::TypeOfExpression():
{
}
void
TypeOfExpression
::
set
Documents
(
const
QMap
<
QString
,
Document
::
Ptr
>
&
documents
)
void
TypeOfExpression
::
set
Snapshot
(
const
Snapshot
&
documents
)
{
m_
documents
=
documents
;
m_
snapshot
=
documents
;
m_lookupContext
=
LookupContext
();
}
...
...
@@ -59,12 +59,12 @@ QList<TypeOfExpression::Result> TypeOfExpression::operator()(const QString &expr
{
QString
code
=
expression
;
if
(
mode
==
Preprocess
)
code
=
preprocessedExpression
(
expression
,
m_
documents
,
document
);
code
=
preprocessedExpression
(
expression
,
m_
snapshot
,
document
);
Document
::
Ptr
expressionDoc
=
documentForExpression
(
code
);
m_ast
=
extractExpressionAST
(
expressionDoc
);
m_lookupContext
=
LookupContext
(
lastVisibleSymbol
,
expressionDoc
,
document
,
m_
documents
);
document
,
m_
snapshot
);
ResolveExpression
resolveExpression
(
m_lookupContext
);
return
resolveExpression
(
m_ast
);
...
...
@@ -103,10 +103,12 @@ Document::Ptr TypeOfExpression::documentForExpression(const QString &expression)
return
doc
;
}
void
TypeOfExpression
::
processEnvironment
(
QMap
<
QString
,
Document
::
Ptr
>
documents
,
void
TypeOfExpression
::
processEnvironment
(
Snapshot
documents
,
Document
::
Ptr
doc
,
Environment
*
env
,
QSet
<
QString
>
*
processed
)
const
{
if
(
!
doc
)
return
;
if
(
processed
->
contains
(
doc
->
fileName
()))
return
;
processed
->
insert
(
doc
->
fileName
());
...
...
@@ -120,7 +122,7 @@ void TypeOfExpression::processEnvironment(QMap<QString, Document::Ptr> documents
}
QString
TypeOfExpression
::
preprocessedExpression
(
const
QString
&
expression
,
QMap
<
QString
,
Document
::
Ptr
>
documents
,
Snapshot
documents
,
Document
::
Ptr
thisDocument
)
const
{
Environment
env
;
...
...
src/libs/cplusplus/TypeOfExpression.h
View file @
7d24f921
...
...
@@ -61,7 +61,7 @@ public:
* Also clears the lookup context, so can be used to make sure references
* to the documents previously used are removed.
*/
void
set
Documents
(
const
QMap
<
QString
,
Document
::
Ptr
>
&
documents
);
void
set
Snapshot
(
const
Snapshot
&
documents
);
enum
PreprocessMode
{
NoPreprocess
,
...
...
@@ -100,15 +100,15 @@ private:
ExpressionAST
*
extractExpressionAST
(
Document
::
Ptr
doc
)
const
;
Document
::
Ptr
documentForExpression
(
const
QString
&
expression
)
const
;
void
processEnvironment
(
QMap
<
QString
,
CPlusPlus
::
Document
::
Ptr
>
documents
,
void
processEnvironment
(
CPlusPlus
::
Snapshot
documents
,
CPlusPlus
::
Document
::
Ptr
doc
,
CPlusPlus
::
Environment
*
env
,
QSet
<
QString
>
*
processed
)
const
;
QString
preprocessedExpression
(
const
QString
&
expression
,
QMap
<
QString
,
CPlusPlus
::
Document
::
Ptr
>
documents
,
CPlusPlus
::
Snapshot
documents
,
CPlusPlus
::
Document
::
Ptr
thisDocument
)
const
;
QMap
<
QString
,
Document
::
Ptr
>
m_documents
;
Snapshot
m_snapshot
;
ExpressionAST
*
m_ast
;
LookupContext
m_lookupContext
;
};
...
...
src/libs/utils/pathchooser.cpp
View file @
7d24f921
...
...
@@ -46,11 +46,12 @@
#include <QtGui/QHBoxLayout>
#include <QtGui/QLineEdit>
#include <QtGui/QToolButton>
#include <QtGui/QPushButton>
namespace
Core
{
namespace
Utils
{
#ifdef Q_OS_
OSX
#ifdef Q_OS_
MAC
/*static*/
const
char
*
const
PathChooser
::
browseButtonLabel
=
"Choose..."
;
#else
/*static*/
const
char
*
const
PathChooser
::
browseButtonLabel
=
"Browse..."
;
...
...
@@ -112,7 +113,11 @@ PathChooser::PathChooser(QWidget *parent) :
hLayout
->
addWidget
(
m_d
->
m_lineEdit
);
hLayout
->
setSizeConstraint
(
QLayout
::
SetMinimumSize
);
#ifdef Q_OS_MAC
QPushButton
*
browseButton
=
new
QPushButton
;
#else
QToolButton
*
browseButton
=
new
QToolButton
;
#endif
browseButton
->
setText
(
tr
(
browseButtonLabel
));
connect
(
browseButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
slotBrowse
()));
...
...
src/plugins/coreplugin/navigationwidget.cpp
View file @
7d24f921
...
...
@@ -342,6 +342,10 @@ NavigationSubWidget::NavigationSubWidget(NavigationWidget *parentWidget)
m_navigationComboBox
=
new
NavComboBox
(
this
);
m_navigationWidget
=
0
;
#ifdef Q_OS_MAC
// this is to avoid ugly tool bar behavior
m_navigationComboBox
->
setMaximumWidth
(
130
);
#endif
m_toolbar
=
new
QToolBar
(
this
);
m_toolbar
->
setContentsMargins
(
0
,
0
,
0
,
0
);
...
...
src/plugins/coreplugin/versiondialog.cpp
View file @
7d24f921
...
...
@@ -72,7 +72,7 @@ VersionDialog::VersionDialog(QWidget *parent)
"<br/>"
"Built on "
__DATE__
" at "
__TIME__
"<br />"
#ifdef IDE_REVISION
"
Using
revision %5<br/>"
"
From
revision %5<br/>"
#endif
"<br/>"
"<br/>"
...
...
src/plugins/cppeditor/cppeditor.cpp
View file @
7d24f921
...
...
@@ -427,7 +427,9 @@ void CPPEditor::switchDeclarationDefinition()
if
(
!
m_modelManager
)
return
;
Document
::
Ptr
doc
=
m_modelManager
->
document
(
file
()
->
fileName
());
const
Snapshot
snapshot
=
m_modelManager
->
snapshot
();
Document
::
Ptr
doc
=
snapshot
.
value
(
file
()
->
fileName
());
if
(
!
doc
)
return
;
Symbol
*
lastSymbol
=
doc
->
findSymbolAt
(
line
,
column
);
...
...
@@ -445,7 +447,7 @@ void CPPEditor::switchDeclarationDefinition()
if
(
f
)
{
TypeOfExpression
typeOfExpression
;
typeOfExpression
.
set
Documents
(
m_modelManager
->
documents
());
typeOfExpression
.
set
Snapshot
(
m_modelManager
->
snapshot
());
QList
<
TypeOfExpression
::
Result
>
resolvedSymbols
=
typeOfExpression
(
QString
(),
doc
,
lastSymbol
);
const
LookupContext
&
context
=
typeOfExpression
.
lookupContext
();
...
...
@@ -474,10 +476,12 @@ void CPPEditor::jumpToDefinition()
if
(
!
m_modelManager
)
return
;
const
Snapshot
snapshot
=
m_modelManager
->
snapshot
();
// Find the last symbol up to the cursor position
int
line
=
0
,
column
=
0
;
convertPosition
(
position
(),
&
line
,
&
column
);
Document
::
Ptr
doc
=
m_modelManager
->
document
(
file
()
->
fileName
());
Document
::
Ptr
doc
=
snapshot
.
value
(
file
()
->
fileName
());
if
(
!
doc
)
return
;
...
...
@@ -503,7 +507,7 @@ void CPPEditor::jumpToDefinition()
// Evaluate the type of the expression
TypeOfExpression
typeOfExpression
;
typeOfExpression
.
set
Documents
(
m_modelManager
->
documents
());
typeOfExpression
.
set
Snapshot
(
m_modelManager
->
snapshot
());
QList
<
TypeOfExpression
::
Result
>
resolvedSymbols
=
typeOfExpression
(
expression
,
doc
,
lastSymbol
);
...
...
@@ -572,7 +576,7 @@ Symbol *CPPEditor::findDefinition(Symbol *lastSymbol)
QualifiedNameId
*
q
=
control
.
qualifiedNameId
(
&
qualifiedName
[
0
],
qualifiedName
.
size
());
LookupContext
context
(
&
control
);
const
QMap
<
QString
,
Document
::
Ptr
>
documents
=
m_modelManager
->
documents
();
const
Snapshot
documents
=
m_modelManager
->
snapshot
();
foreach
(
Document
::
Ptr
doc
,
documents
)
{
QList
<
Scope
*>
visibleScopes
;
visibleScopes
.
append
(
doc
->
globalSymbols
());
...
...
@@ -744,7 +748,8 @@ void CPPEditor::unCommentSelection()
QString
endText
=
endBlock
.
text
();
int
endPos
=
end
-
endBlock
.
position
();
bool
hasTrailingCharacters
=
!
endText
.
mid
(
endPos
).
trimmed
().
isEmpty
();
bool
hasTrailingCharacters
=
!
endText
.
left
(
endPos
).
remove
(
QLatin1String
(
"//"
)).
trimmed
().
isEmpty
()
&&
!
endText
.
mid
(
endPos
).
trimmed
().
isEmpty
();
if
((
endPos
<=
endText
.
length
()
-
2
&&
endText
.
at
(
endPos
)
==
QLatin1Char
(
'*'
)
&&
endText
.
at
(
endPos
+
1
)
==
QLatin1Char
(
'/'
)))
{
...
...
src/plugins/cpptools/cppcodecompletion.cpp
View file @
7d24f921
...
...
@@ -434,10 +434,12 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
//if (! expression.isEmpty())
//qDebug() << "***** expression:" << expression;
if
(
Document
::
Ptr
thisDocument
=
m_manager
->
document
(
fileName
))
{
const
Snapshot
snapshot
=
m_manager
->
snapshot
();
if
(
Document
::
Ptr
thisDocument
=
snapshot
.
value
(
fileName
))
{
Symbol
*
symbol
=
thisDocument
->
findSymbolAt
(
line
,
column
);
typeOfExpression
.
set
Documents
(
m_manager
->
documents
());
typeOfExpression
.
set
Snapshot
(
m_manager
->
snapshot
());
QList
<
TypeOfExpression
::
Result
>
resolvedTypes
=
typeOfExpression
(
expression
,
thisDocument
,
symbol
,
TypeOfExpression
::
Preprocess
);
...
...
@@ -964,8 +966,10 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item)
if
(
Function
*
function
=
symbol
->
type
()
->
asFunction
())
{
// If the member is a function, automatically place the opening parenthesis,
// except when it might take template parameters.
if
(
!
function
->
returnType
().
isValid
()
&&
(
function
->
identity
()
&&
!
function
->
identity
()
->
isDestructorNameId
()))
{
const
bool
hasReturnType
=
function
->
returnType
().
isValid
()
||
function
->
returnType
().
isSigned
()
||
function
->
returnType
().
isUnsigned
();
if
(
!
hasReturnType
&&
(
function
->
identity
()
&&
!
function
->
identity
()
->
isDestructorNameId
()))
{
// Don't insert any magic, since the user might have just wanted to select the class
}
else
if
(
function
->
templateParameterCount
()
!=
0
)
{
...
...
@@ -1034,7 +1038,7 @@ void CppCodeCompletion::cleanup()
// Set empty map in order to avoid referencing old versions of the documents
// until the next completion
typeOfExpression
.
set
Documents
(
QMap
<
QString
,
Document
::
Ptr
>
());
typeOfExpression
.
set
Snapshot
(
Snapshot
());
}
int
CppCodeCompletion
::
findStartOfName
(
const
TextEditor
::
ITextEditor
*
editor
)
...
...
src/plugins/cpptools/cpphoverhandler.cpp
View file @
7d24f921
...
...
@@ -165,9 +165,11 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
QTextCursor
tc
(
edit
->
document
());
tc
.
setPosition
(
pos
);
const
Snapshot
documents
=
m_manager
->
snapshot
();
const
int
lineNumber
=
tc
.
block
().
blockNumber
()
+
1
;
const
QString
fileName
=
editor
->
file
()
->
fileName
();
Document
::
Ptr
doc
=
m_manager
->
document
(
fileName
);
Document
::
Ptr
doc
=
document
s
.
value
(
fileName
);
if
(
doc
)
{
foreach
(
Document
::
DiagnosticMessage
m
,
doc
->
diagnosticMessages
())
{
if
(
m
.
line
()
==
lineNumber
)
{
...
...
@@ -212,7 +214,7 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
Symbol
*
lastSymbol
=
doc
->
findSymbolAt
(
line
,
column
);
TypeOfExpression
typeOfExpression
;
typeOfExpression
.
set
Documents
(
m_manager
->
documents
()
);
typeOfExpression
.
set
Snapshot
(
documents
);
QList
<
TypeOfExpression
::
Result
>
types
=
typeOfExpression
(
expression
,
doc
,
lastSymbol
);
if
(
!
types
.
isEmpty
())
{
...
...
src/plugins/cpptools/cppmodelmanager.cpp
View file @
7d24f921
...
...
@@ -143,7 +143,7 @@ protected:
private:
QPointer
<
CppModelManager
>
m_modelManager
;
CppModelManager
::
DocumentTable
m_documents
;
Snapshot
m_snapshot
;
Environment
env
;
pp
m_proc
;
QStringList
m_includePaths
;
...
...
@@ -160,7 +160,7 @@ private:
CppPreprocessor
::
CppPreprocessor
(
QPointer
<
CppModelManager
>
modelManager
)
:
m_modelManager
(
modelManager
),
m_
documents
(
modelManager
->
documents
()),
m_
snapshot
(
modelManager
->
snapshot
()),
m_proc
(
this
,
env
)
{
}
...
...
@@ -340,7 +340,7 @@ void CppPreprocessor::mergeEnvironment(Document::Ptr doc, QSet<QString> *process
processed
->
insert
(
fn
);
foreach
(
QString
includedFile
,
doc
->
includedFiles
())
{
mergeEnvironment
(
m_
documents
.
value
(
includedFile
),
processed
);
mergeEnvironment
(
m_
snapshot
.
value
(
includedFile
),
processed
);
}
foreach
(
const
Macro
macro
,
doc
->
definedMacros
())
{
...
...
@@ -386,7 +386,7 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type,
}
if
(
!
contents
.
isEmpty
())
{
Document
::
Ptr
cachedDoc
=
m_
documents
.
value
(
fileName
);
Document
::
Ptr
cachedDoc
=
m_
snapshot
.
value
(
fileName
);
if
(
cachedDoc
&&
m_currentDoc
)
{
mergeEnvironment
(
cachedDoc
);
}
else
{
...
...
@@ -477,11 +477,8 @@ CppModelManager::CppModelManager(QObject *parent) :
CppModelManager
::~
CppModelManager
()
{
}
Document
::
Ptr
CppModelManager
::
document
(
const
QString
&
fileName
)
const
{
return
m_documents
.
value
(
fileName
);
}
CppModelManager
::
DocumentTable
CppModelManager
::
documents
()
const
{
return
m_documents
;
}
Snapshot
CppModelManager
::
snapshot
()
const
{
return
m_snapshot
;
}
void
CppModelManager
::
ensureUpdated
()
{
...
...
@@ -672,7 +669,7 @@ void CppModelManager::emitDocumentUpdated(Document::Ptr doc)
void
CppModelManager
::
onDocumentUpdated
(
Document
::
Ptr
doc
)
{
const
QString
fileName
=
doc
->
fileName
();
m_
documents
[
fileName
]
=
doc
;
m_
snapshot
[
fileName
]
=
doc
;
QList
<
Core
::
IEditor
*>
openedEditors
=
m_core
->
editorManager
()
->
openedEditors
();
foreach
(
Core
::
IEditor
*
editor
,
openedEditors
)
{
if
(
editor
->
file
()
->
fileName
()
==
fileName
)
{
...
...
@@ -837,7 +834,7 @@ void CppModelManager::parse(QFutureInterface<void> &future,
void
CppModelManager
::
GC
()
{
DocumentTable
documents
=
m_
documents
;