diff options
author | Christian Kamm <christian.d.kamm@nokia.com> | 2011-02-03 15:48:14 +0100 |
---|---|---|
committer | Christian Kamm <christian.d.kamm@nokia.com> | 2011-05-24 12:45:07 +0200 |
commit | 779fafcbfe6f92dd1288664fae512f69bc12418b (patch) | |
tree | 38a3b75cc3a18f386ab72102e97f06ffa24d4d29 /src/plugins/cpptools/cppcodeformatter.h | |
parent | f69eb52944a7fc8306cbb72b7325a610045dea7a (diff) | |
download | qt-creator-779fafcbfe6f92dd1288664fae512f69bc12418b.tar.gz |
Make C++ code style configurable.
Change-Id: Iaf08edb2361146e6b5e1cbafdb716a23c938875b
Done-with: Jarek Kobus
Task-number: QTCREATORBUG-2670
Task-number: QTCREATORBUG-4310
Task-number: QTCREATORBUG-2763
Task-number: QTCREATORBUG-3623
Task-number: QTCREATORBUG-567
Reviewed-on: http://codereview.qt.nokia.com/74
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@nokia.com>
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
Diffstat (limited to 'src/plugins/cpptools/cppcodeformatter.h')
-rw-r--r-- | src/plugins/cpptools/cppcodeformatter.h | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/src/plugins/cpptools/cppcodeformatter.h b/src/plugins/cpptools/cppcodeformatter.h index 2a21d2ffc0..21f06135a8 100644 --- a/src/plugins/cpptools/cppcodeformatter.h +++ b/src/plugins/cpptools/cppcodeformatter.h @@ -35,8 +35,10 @@ #include "cpptools_global.h" -#include <cplusplus/SimpleLexer.h> #include <Token.h> +#include <cplusplus/SimpleLexer.h> +#include <texteditor/tabsettings.h> +#include <cpptools/cppcodestylesettings.h> #include <QtCore/QChar> #include <QtCore/QStack> @@ -49,10 +51,6 @@ class QTextDocument; class QTextBlock; QT_END_NAMESPACE -namespace TextEditor { - class TabSettings; -} - namespace CppTools { namespace Internal { class CppCodeFormatterData; @@ -176,7 +174,7 @@ public: // must be public to make Q_GADGET introspection work assign_open, // after an assignment token expression, // after a '=' in a declaration_start once we're sure it's not '= {' - initializer // after a '=' in a declaration start + assign_open_or_initializer // after a '=' in a declaration start }; Q_ENUMS(StateType) @@ -261,14 +259,11 @@ class CPPTOOLS_EXPORT QtStyleCodeFormatter : public CodeFormatter { public: QtStyleCodeFormatter(); - explicit QtStyleCodeFormatter(const TextEditor::TabSettings &tabSettings); - - void setIndentSize(int size); + QtStyleCodeFormatter(const TextEditor::TabSettings &tabSettings, + const CppCodeStyleSettings &settings); - void setIndentSubstatementBraces(bool onOff); - void setIndentSubstatementStatements(bool onOff); - void setIndentDeclarationBraces(bool onOff); - void setIndentDeclarationMembers(bool onOff); + void setTabSettings(const TextEditor::TabSettings &tabSettings); + void setCodeStyleSettings(const CppCodeStyleSettings &settings); protected: virtual void onEnter(int newState, int *indentDepth, int *savedIndentDepth, int *paddingDepth, int *savedPaddingDepth) const; @@ -283,11 +278,8 @@ protected: static bool shouldClearPaddingOnEnter(int state); private: - int m_indentSize; - bool m_indentSubstatementBraces; - bool m_indentSubstatementStatements; - bool m_indentDeclarationBraces; - bool m_indentDeclarationMembers; + TextEditor::TabSettings m_tabSettings; + CppCodeStyleSettings m_styleSettings; }; } // namespace CppTools |