| 
									
										
										
										
											2010-07-09 15:47:07 +02:00
										 |  |  | /**************************************************************************
 | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** This file is part of Qt Creator | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-01-11 16:28:15 +01:00
										 |  |  | ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). | 
					
						
							| 
									
										
										
										
											2010-07-09 15:47:07 +02:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-04-13 08:42:33 +02:00
										 |  |  | ** Contact: Nokia Corporation (info@qt.nokia.com) | 
					
						
							| 
									
										
										
										
											2010-07-09 15:47:07 +02:00
										 |  |  | ** | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** GNU Lesser General Public License Usage | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-04-13 08:42:33 +02:00
										 |  |  | ** This file may be used under the terms of the GNU Lesser General Public | 
					
						
							|  |  |  | ** License version 2.1 as published by the Free Software Foundation and | 
					
						
							|  |  |  | ** appearing in the file LICENSE.LGPL included in the packaging of this file. | 
					
						
							|  |  |  | ** Please review the following information to ensure the GNU Lesser General | 
					
						
							|  |  |  | ** Public License version 2.1 requirements will be met: | 
					
						
							|  |  |  | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 | 
					
						
							| 
									
										
										
										
											2010-07-09 15:47:07 +02:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2010-12-17 16:01:08 +01:00
										 |  |  | ** In addition, as a special exception, Nokia gives you certain additional | 
					
						
							| 
									
										
										
										
											2011-04-13 08:42:33 +02:00
										 |  |  | ** rights. These rights are described in the Nokia Qt LGPL Exception | 
					
						
							| 
									
										
										
										
											2010-12-17 16:01:08 +01:00
										 |  |  | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-04-13 08:42:33 +02:00
										 |  |  | ** Other Usage | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** Alternatively, this file may be used in accordance with the terms and | 
					
						
							|  |  |  | ** conditions contained in a signed written agreement between you and Nokia. | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2010-12-17 16:01:08 +01:00
										 |  |  | ** If you have questions regarding the use of this file, please contact | 
					
						
							|  |  |  | ** Nokia at qt-info@nokia.com. | 
					
						
							| 
									
										
										
										
											2010-07-09 15:47:07 +02:00
										 |  |  | ** | 
					
						
							|  |  |  | **************************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  | #ifndef CPPCODEFORMATTER_H
 | 
					
						
							|  |  |  | #define CPPCODEFORMATTER_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "cpptools_global.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <cplusplus/SimpleLexer.h>
 | 
					
						
							|  |  |  | #include <Token.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <QtCore/QChar>
 | 
					
						
							|  |  |  | #include <QtCore/QStack>
 | 
					
						
							|  |  |  | #include <QtCore/QList>
 | 
					
						
							|  |  |  | #include <QtCore/QVector>
 | 
					
						
							|  |  |  | #include <QtCore/QPointer>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QT_BEGIN_NAMESPACE | 
					
						
							|  |  |  | class QTextDocument; | 
					
						
							|  |  |  | class QTextBlock; | 
					
						
							|  |  |  | QT_END_NAMESPACE | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-08-12 14:00:15 +02:00
										 |  |  | namespace TextEditor { | 
					
						
							|  |  |  |     class TabSettings; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-12-16 12:05:48 +01:00
										 |  |  | namespace CppTools { | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  | namespace Internal { | 
					
						
							|  |  |  | class CppCodeFormatterData; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class CPPTOOLS_EXPORT CodeFormatter | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-09-24 15:07:42 +02:00
										 |  |  |     Q_GADGET | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  | public: | 
					
						
							|  |  |  |     CodeFormatter(); | 
					
						
							|  |  |  |     virtual ~CodeFormatter(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-06 14:41:34 +02:00
										 |  |  |     // updates all states up until block if necessary
 | 
					
						
							|  |  |  |     // it is safe to call indentFor on block afterwards
 | 
					
						
							| 
									
										
										
										
											2010-07-06 13:52:49 +02:00
										 |  |  |     void updateStateUntil(const QTextBlock &block); | 
					
						
							| 
									
										
										
										
											2010-07-06 14:41:34 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     // calculates the state change introduced by changing a single line
 | 
					
						
							|  |  |  |     void updateLineStateChange(const QTextBlock &block); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-10 14:12:14 +02:00
										 |  |  |     void indentFor(const QTextBlock &block, int *indent, int *padding); | 
					
						
							|  |  |  |     void indentForNewLineAfter(const QTextBlock &block, int *indent, int *padding); | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-05 13:39:23 +02:00
										 |  |  |     void setTabSize(int tabSize); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-07 11:01:38 +02:00
										 |  |  |     void invalidateCache(QTextDocument *document); | 
					
						
							| 
									
										
										
										
											2010-07-05 13:48:53 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  | protected: | 
					
						
							| 
									
										
										
										
											2010-09-10 14:12:14 +02:00
										 |  |  |     virtual void onEnter(int newState, int *indentDepth, int *savedIndentDepth, int *paddingDepth, int *savedPaddingDepth) const = 0; | 
					
						
							|  |  |  |     virtual void adjustIndent(const QList<CPlusPlus::Token> &tokens, int lexerState, int *indentDepth, int *paddingDepth) const = 0; | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-07 11:01:38 +02:00
										 |  |  |     class State; | 
					
						
							|  |  |  |     class BlockData | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |     public: | 
					
						
							|  |  |  |         BlockData(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         QStack<State> m_beginState; | 
					
						
							|  |  |  |         QStack<State> m_endState; | 
					
						
							|  |  |  |         int m_indentDepth; | 
					
						
							| 
									
										
										
										
											2010-09-10 14:12:14 +02:00
										 |  |  |         int m_paddingDepth; | 
					
						
							| 
									
										
										
										
											2010-07-07 11:01:38 +02:00
										 |  |  |         int m_blockRevision; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual void saveBlockData(QTextBlock *block, const BlockData &data) const = 0; | 
					
						
							|  |  |  |     virtual bool loadBlockData(const QTextBlock &block, BlockData *data) const = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual void saveLexerState(QTextBlock *block, int state) const = 0; | 
					
						
							|  |  |  |     virtual int loadLexerState(const QTextBlock &block) const = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-24 15:07:42 +02:00
										 |  |  | public: // must be public to make Q_GADGET introspection work
 | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  |     enum StateType { | 
					
						
							|  |  |  |         invalid = 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         topmost_intro, // The first line in a "topmost" definition.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         multiline_comment_start, // Inside the first line of a multi-line C style block comment.
 | 
					
						
							|  |  |  |         multiline_comment_cont, // Inside the following lines of a multi-line C style block comment.
 | 
					
						
							|  |  |  |         cpp_macro_start, // After the '#' token
 | 
					
						
							|  |  |  |         cpp_macro, // The start of a C preprocessor macro definition.
 | 
					
						
							|  |  |  |         cpp_macro_cont, // Subsequent lines of a multi-line C preprocessor macro definition.
 | 
					
						
							|  |  |  |         cpp_macro_conditional, // Special marker used for separating saved from current state when dealing with #ifdef
 | 
					
						
							|  |  |  |         qt_like_macro, // after an identifier starting with Q_ or QT_ at the beginning of the line
 | 
					
						
							| 
									
										
										
										
											2010-12-01 10:19:53 +01:00
										 |  |  |         label, // after an identifier followed by a colon
 | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         defun_open, // Brace that opens a top-level function definition.
 | 
					
						
							|  |  |  |         using_start, // right after the "using" token
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         class_start, // after the 'class' token
 | 
					
						
							|  |  |  |         class_open, // Brace that opens a class definition.
 | 
					
						
							| 
									
										
										
										
											2010-07-16 10:27:15 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  |         member_init_open, // After ':' that starts a member initialization list.
 | 
					
						
							| 
									
										
										
										
											2010-07-16 10:27:15 +02:00
										 |  |  |         member_init, // At the start and after every ',' in member_init_open
 | 
					
						
							|  |  |  |         member_init_paren_open, // After '(' in member_init.
 | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         enum_start, // After 'enum'
 | 
					
						
							| 
									
										
										
										
											2010-07-05 12:56:37 +02:00
										 |  |  |         enum_open, // Brace that opens a enum declaration.
 | 
					
						
							|  |  |  |         brace_list_open, // Open brace nested inside an enum or for a static array list.
 | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         namespace_start, // after the namespace token, before the opening brace.
 | 
					
						
							|  |  |  |         namespace_open, // Brace that opens a C++ namespace block.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         declaration_start, // shifted a token which could start a declaration.
 | 
					
						
							|  |  |  |         operator_declaration, // after 'operator' in declaration_start
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         template_start, // after the 'template' token
 | 
					
						
							|  |  |  |         template_param, // after the '<' in a template_start
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if_statement, // After 'if'
 | 
					
						
							|  |  |  |         maybe_else, // after the first substatement in an if
 | 
					
						
							|  |  |  |         else_clause, // The else line of an if-else construct.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         for_statement, // After the 'for' token
 | 
					
						
							|  |  |  |         for_statement_paren_open, // While inside the (...)
 | 
					
						
							|  |  |  |         for_statement_init, // The initializer part of the for statement
 | 
					
						
							|  |  |  |         for_statement_condition, // The condition part of the for statement
 | 
					
						
							|  |  |  |         for_statement_expression, // The expression part of the for statement
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         switch_statement, // After 'switch' token
 | 
					
						
							|  |  |  |         case_start, // after a 'case' or 'default' token
 | 
					
						
							|  |  |  |         case_cont, // after the colon in a case/default
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         statement_with_condition, // A statement that takes a condition after the start token.
 | 
					
						
							|  |  |  |         do_statement, // After 'do' token
 | 
					
						
							|  |  |  |         return_statement, // After 'return'
 | 
					
						
							|  |  |  |         block_open, // Statement block open brace.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         substatement, // The first line after a conditional or loop construct.
 | 
					
						
							|  |  |  |         substatement_open, // The brace that opens a substatement block.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         arglist_open, // after the lparen. TODO: check if this is enough.
 | 
					
						
							| 
									
										
										
										
											2010-07-15 16:14:22 +02:00
										 |  |  |         stream_op, // After a '<<' or '>>' in a context where it's likely a stream operator.
 | 
					
						
							|  |  |  |         stream_op_cont, // When finding another stream operator in stream_op
 | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  |         ternary_op, // The ? : operator
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         condition_open, // Start of a condition in 'if', 'while', entered after opening paren
 | 
					
						
							|  |  |  |         condition_paren_open, // After an lparen in a condition
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         assign_open, // after an assignment token
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         expression, // after a '=' in a declaration_start once we're sure it's not '= {'
 | 
					
						
							| 
									
										
										
										
											2010-12-16 12:05:48 +01:00
										 |  |  |         initializer // after a '=' in a declaration start
 | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  |     }; | 
					
						
							| 
									
										
										
										
											2010-09-24 15:07:42 +02:00
										 |  |  |     Q_ENUMS(StateType) | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-24 15:07:42 +02:00
										 |  |  | protected: | 
					
						
							| 
									
										
										
										
											2010-07-08 12:31:28 +02:00
										 |  |  |     class State { | 
					
						
							|  |  |  |     public: | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  |         State() | 
					
						
							|  |  |  |             : savedIndentDepth(0) | 
					
						
							| 
									
										
										
										
											2010-09-10 14:12:14 +02:00
										 |  |  |             , savedPaddingDepth(0) | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  |             , type(0) | 
					
						
							|  |  |  |         {} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-10 14:12:14 +02:00
										 |  |  |         State(quint8 ty, quint16 savedIndentDepth, qint16 savedPaddingDepth) | 
					
						
							|  |  |  |             : savedIndentDepth(savedIndentDepth) | 
					
						
							|  |  |  |             , savedPaddingDepth(savedPaddingDepth) | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  |             , type(ty) | 
					
						
							|  |  |  |         {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         quint16 savedIndentDepth; | 
					
						
							| 
									
										
										
										
											2010-09-10 14:12:14 +02:00
										 |  |  |         quint16 savedPaddingDepth; | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  |         quint8 type; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         bool operator==(const State &other) const { | 
					
						
							|  |  |  |             return type == other.type | 
					
						
							| 
									
										
										
										
											2010-09-10 14:12:14 +02:00
										 |  |  |                 && savedIndentDepth == other.savedIndentDepth | 
					
						
							|  |  |  |                 && savedPaddingDepth == other.savedPaddingDepth; | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  |         } | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     State state(int belowTop = 0) const; | 
					
						
							| 
									
										
										
										
											2010-07-05 12:56:37 +02:00
										 |  |  |     const QVector<State> &newStatesThisLine() const; | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  |     int tokenIndex() const; | 
					
						
							| 
									
										
										
										
											2010-07-05 12:56:37 +02:00
										 |  |  |     int tokenCount() const; | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  |     const CPlusPlus::Token ¤tToken() const; | 
					
						
							|  |  |  |     const CPlusPlus::Token &tokenAt(int idx) const; | 
					
						
							| 
									
										
										
										
											2010-07-05 13:39:23 +02:00
										 |  |  |     int column(int position) const; | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool isBracelessState(int type) const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-10 14:12:14 +02:00
										 |  |  |     void dump() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  | private: | 
					
						
							|  |  |  |     void recalculateStateAfter(const QTextBlock &block); | 
					
						
							| 
									
										
										
										
											2010-07-07 11:01:38 +02:00
										 |  |  |     void saveCurrentState(const QTextBlock &block); | 
					
						
							|  |  |  |     void restoreCurrentState(const QTextBlock &block); | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     QStringRef currentTokenText() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     int tokenizeBlock(const QTextBlock &block, bool *endedJoined = 0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void turnInto(int newState); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     bool tryExpression(bool alsoExpression = false); | 
					
						
							|  |  |  |     bool tryDeclaration(); | 
					
						
							|  |  |  |     bool tryStatement(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void enter(int newState); | 
					
						
							|  |  |  |     void leave(bool statementDone = false); | 
					
						
							|  |  |  |     void correctIndentation(const QTextBlock &block); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  |     static QStack<State> initialState(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QStack<State> m_beginState; | 
					
						
							|  |  |  |     QStack<State> m_currentState; | 
					
						
							| 
									
										
										
										
											2010-07-05 12:56:37 +02:00
										 |  |  |     QStack<State> m_newStates; | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     QList<CPlusPlus::Token> m_tokens; | 
					
						
							|  |  |  |     QString m_currentLine; | 
					
						
							|  |  |  |     CPlusPlus::Token m_currentToken; | 
					
						
							|  |  |  |     int m_tokenIndex; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     int m_indentDepth; | 
					
						
							| 
									
										
										
										
											2010-09-10 14:12:14 +02:00
										 |  |  |     int m_paddingDepth; | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-05 13:39:23 +02:00
										 |  |  |     int m_tabSize; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  |     friend class Internal::CppCodeFormatterData; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class CPPTOOLS_EXPORT QtStyleCodeFormatter : public CodeFormatter | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     QtStyleCodeFormatter(); | 
					
						
							| 
									
										
										
										
											2010-08-12 14:00:15 +02:00
										 |  |  |     explicit QtStyleCodeFormatter(const TextEditor::TabSettings &tabSettings); | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     void setIndentSize(int size); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-05 12:56:37 +02:00
										 |  |  |     void setIndentSubstatementBraces(bool onOff); | 
					
						
							|  |  |  |     void setIndentSubstatementStatements(bool onOff); | 
					
						
							|  |  |  |     void setIndentDeclarationBraces(bool onOff); | 
					
						
							|  |  |  |     void setIndentDeclarationMembers(bool onOff); | 
					
						
							| 
									
										
										
										
											2010-07-05 09:59:42 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  | protected: | 
					
						
							| 
									
										
										
										
											2010-09-10 14:12:14 +02:00
										 |  |  |     virtual void onEnter(int newState, int *indentDepth, int *savedIndentDepth, int *paddingDepth, int *savedPaddingDepth) const; | 
					
						
							|  |  |  |     virtual void adjustIndent(const QList<CPlusPlus::Token> &tokens, int lexerState, int *indentDepth, int *paddingDepth) const; | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-07 11:01:38 +02:00
										 |  |  |     virtual void saveBlockData(QTextBlock *block, const BlockData &data) const; | 
					
						
							|  |  |  |     virtual bool loadBlockData(const QTextBlock &block, BlockData *data) const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual void saveLexerState(QTextBlock *block, int state) const; | 
					
						
							|  |  |  |     virtual int loadLexerState(const QTextBlock &block) const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-10 14:12:14 +02:00
										 |  |  |     static bool shouldClearPaddingOnEnter(int state); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  | private: | 
					
						
							|  |  |  |     int m_indentSize; | 
					
						
							| 
									
										
										
										
											2010-07-05 12:56:37 +02:00
										 |  |  |     bool m_indentSubstatementBraces; | 
					
						
							|  |  |  |     bool m_indentSubstatementStatements; | 
					
						
							|  |  |  |     bool m_indentDeclarationBraces; | 
					
						
							|  |  |  |     bool m_indentDeclarationMembers; | 
					
						
							| 
									
										
										
										
											2010-07-02 15:43:34 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace CppTools
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif // CPPCODEFORMATTER_H
 |