C++: Introduce the new CodeFormatter.

Done-with: Erik Verbruggen
This commit is contained in:
Christian Kamm
2010-07-02 15:43:34 +02:00
parent 837e7b5abd
commit 88f2e340bd
8 changed files with 2043 additions and 7 deletions

View File

@@ -54,6 +54,18 @@ struct TEXTEDITOR_EXPORT Parenthesis
int pos;
};
class TEXTEDITOR_EXPORT CodeFormatterData
{
public:
CodeFormatterData(int blockRevision);
virtual ~CodeFormatterData();
int blockRevision() const { return m_blockRevision; }
void setBlockRevision(int revision) { m_blockRevision = revision; }
private:
int m_blockRevision;
};
class TEXTEDITOR_EXPORT TextBlockUserData : public QTextBlockUserData
{
@@ -64,7 +76,9 @@ public:
m_ifdefedOut(false),
m_foldingIndent(0),
m_foldingStartIncluded(false),
m_foldingEndIncluded(false){}
m_foldingEndIncluded(false),
m_codeFormatterData(0)
{}
~TextBlockUserData();
inline TextMarks marks() const { return m_marks; }
@@ -106,6 +120,11 @@ public:
void setFoldingEndIncluded(bool included) { m_foldingEndIncluded = included; }
bool foldingEndIncluded() const { return m_foldingEndIncluded; }
static int lexerState(const QTextBlock &block);
static void setLexerState(QTextBlock block, int state);
CodeFormatterData *codeFormatterData() const { return m_codeFormatterData; }
void setCodeFormatterData(CodeFormatterData *data);
private:
TextMarks m_marks;
@@ -115,6 +134,7 @@ private:
uint m_foldingStartIncluded : 1;
uint m_foldingEndIncluded : 1;
Parentheses m_parentheses;
CodeFormatterData *m_codeFormatterData;
};