forked from qt-creator/qt-creator
		
	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>
This commit is contained in:
		| @@ -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); | ||||
|     QtStyleCodeFormatter(const TextEditor::TabSettings &tabSettings, | ||||
|                          const CppCodeStyleSettings &settings); | ||||
|  | ||||
|     void setIndentSize(int size); | ||||
|  | ||||
|     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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user