forked from qt-creator/qt-creator
C++ indenter: Simplify debugging by making dump() more verbose.
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#include <texteditor/tabsettings.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QMetaEnum>
|
||||
#include <QtGui/QTextDocument>
|
||||
#include <QtGui/QTextCursor>
|
||||
#include <QtGui/QTextBlock>
|
||||
@@ -907,10 +908,12 @@ int CodeFormatter::tokenizeBlock(const QTextBlock &block, bool *endedJoined)
|
||||
|
||||
void CodeFormatter::dump() const
|
||||
{
|
||||
QMetaEnum metaEnum = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("StateType"));
|
||||
|
||||
qDebug() << "Current token index" << m_tokenIndex;
|
||||
qDebug() << "Current state:";
|
||||
foreach (State s, m_currentState) {
|
||||
qDebug() << s.type << s.savedIndentDepth << s.savedPaddingDepth;
|
||||
qDebug() << metaEnum.valueToKey(s.type) << s.savedIndentDepth << s.savedPaddingDepth;
|
||||
}
|
||||
qDebug() << "Current indent depth:" << m_indentDepth;
|
||||
qDebug() << "Current padding depth:" << m_paddingDepth;
|
||||
|
||||
@@ -57,6 +57,7 @@ class CppCodeFormatterData;
|
||||
|
||||
class CPPTOOLS_EXPORT CodeFormatter
|
||||
{
|
||||
Q_GADGET
|
||||
public:
|
||||
CodeFormatter();
|
||||
virtual ~CodeFormatter();
|
||||
@@ -98,7 +99,7 @@ protected:
|
||||
virtual void saveLexerState(QTextBlock *block, int state) const = 0;
|
||||
virtual int loadLexerState(const QTextBlock &block) const = 0;
|
||||
|
||||
protected:
|
||||
public: // must be public to make Q_GADGET introspection work
|
||||
enum StateType {
|
||||
invalid = 0,
|
||||
|
||||
@@ -170,7 +171,9 @@ protected:
|
||||
expression, // after a '=' in a declaration_start once we're sure it's not '= {'
|
||||
initializer, // after a '=' in a declaration start
|
||||
};
|
||||
Q_ENUMS(StateType)
|
||||
|
||||
protected:
|
||||
class State {
|
||||
public:
|
||||
State()
|
||||
|
||||
@@ -12,6 +12,7 @@ SOURCES += \
|
||||
$$SRCDIR/plugins/texteditor/basetextdocumentlayout.cpp
|
||||
|
||||
HEADERS += \
|
||||
$$SRCDIR/plugins/cpptools/cppcodeformatter.h \
|
||||
$$SRCDIR/plugins/texteditor/basetextdocumentlayout.h
|
||||
|
||||
INCLUDEPATH += $$SRCDIR/plugins $$SRCDIR/libs
|
||||
|
||||
Reference in New Issue
Block a user