C++: Add settings dialog for pointer declaration formatting

The dialog is at Tools > Options > C++ > Code Style > Edit... > Pointers
and References.

Currently the settings are referenced when applying the following
QuickFixes:
 - Adapting function signature in declaration/definition
   (FunctionDeclDefLink)
 - Inserting declaration from definition (InsertDeclOperation)
 - Inserting definition from declaration (InsertDefOperation)
 - Extracting a function (ExtractFunctionOperation)
 - Add Local Declaration (AddLocalDeclarationOp::Operation)

In these cases the code style of the current project is used. If there
is no current project open, the current global code style is used.

Task-number: QTCREATORBUG-6169

Change-Id: I3e4e502b3103f7f754ac9b39594ad461d89d9304
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Nikolai Kosjar
2013-01-15 14:26:24 +01:00
parent 138066792e
commit 8fe25d0a4a
7 changed files with 309 additions and 31 deletions

View File

@@ -40,6 +40,7 @@
#include <cplusplus/TranslationUnit.h>
#include <cplusplus/LookupContext.h>
#include <cplusplus/Overview.h>
#include <cpptools/cppcodestylesettings.h>
#include <cpptools/cpplocalsymbols.h>
#include <cpptools/cpprefactoringchanges.h>
#include <cpptools/symbolfinder.h>
@@ -590,7 +591,10 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ
if (!newFunction)
return changes;
Overview overview;
const Overview overviewFromCurrentProjectStyle
= CppCodeStyleSettings::currentProjectCodeStyleOverview();
Overview overview = overviewFromCurrentProjectStyle;
overview.showReturnTypes = true;
overview.showTemplateParameters = true;
overview.showArgumentNames = true;
@@ -664,7 +668,7 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ
UseMinimalNames q(targetCoN);
env.enter(&q);
Control *control = sourceContext.control().data();
Overview overview;
Overview overview = overviewFromCurrentProjectStyle;
// make a easy to access list of the target parameter declarations
QVarLengthArray<ParameterDeclarationAST *, 10> targetParameterDecls;