Add firstLineChar member in ASBeautifier + Use symmetrical layout for closing brace in template argument list:
template < class Argument >
This commit is contained in:
parent
a28cde5425
commit
25c4fdac73
@ -252,6 +252,7 @@ ASBeautifier::ASBeautifier(const ASBeautifier& other) : ASBase(other)
|
||||
currentNonSpaceCh = other.currentNonSpaceCh;
|
||||
currentNonLegalCh = other.currentNonLegalCh;
|
||||
prevNonLegalCh = other.prevNonLegalCh;
|
||||
lineFirstChar = other.lineFirstChar;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -365,6 +366,7 @@ void ASBeautifier::init(ASSourceIterator* iter)
|
||||
prevNonLegalCh = '{';
|
||||
currentNonLegalCh = '{';
|
||||
quoteChar = ' ';
|
||||
lineFirstChar = ' ';
|
||||
probationHeader = NULL;
|
||||
lastLineHeader = NULL;
|
||||
backslashEndsPrevLine = false;
|
||||
@ -879,6 +881,7 @@ string ASBeautifier::beautify(const string& originalLine)
|
||||
haveLineContinuationChar = false;
|
||||
lineOpeningBlocksNum = 0;
|
||||
lineClosingBlocksNum = 0;
|
||||
lineFirstChar = ' ';
|
||||
if (isImmediatelyPostObjCMethodDefinition)
|
||||
clearObjCMethodDefinitionAlignment();
|
||||
|
||||
@ -920,6 +923,7 @@ string ASBeautifier::beautify(const string& originalLine)
|
||||
line = trim(originalLine);
|
||||
if (line.length() > 0)
|
||||
{
|
||||
lineFirstChar = line[0];
|
||||
if (line[0] == '{')
|
||||
lineBeginsWithOpenBracket = true;
|
||||
else if (line[0] == '}')
|
||||
@ -2110,6 +2114,21 @@ void ASBeautifier::computePreliminaryIndentation()
|
||||
}
|
||||
}
|
||||
|
||||
if (isInTemplate)
|
||||
{
|
||||
// Use symmetrical layout for closing brace in template argument list:
|
||||
//
|
||||
// template
|
||||
// <
|
||||
// class Argument
|
||||
// >
|
||||
if (lineFirstChar == '>' && !lineStartsInComment)
|
||||
{
|
||||
if (!inStatementIndentStack->empty())
|
||||
spaceIndentCount -= inStatementIndentStack->back();
|
||||
}
|
||||
}
|
||||
|
||||
if (isInClassInitializer || isInEnumTypeID)
|
||||
{
|
||||
indentCount += classInitializerIndents;
|
||||
|
@ -279,7 +279,6 @@ protected: // functions definitions are at the end of ASResource.cpp
|
||||
bool isCharPotentialOperator(char ch) const;
|
||||
bool isDigitSeparator(const string& line, int i) const;
|
||||
char peekNextChar(const string& line, int i) const;
|
||||
|
||||
}; // Class ASBase
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -517,6 +516,7 @@ private: // variables
|
||||
char currentNonSpaceCh;
|
||||
char currentNonLegalCh;
|
||||
char prevNonLegalCh;
|
||||
char lineFirstChar;
|
||||
}; // Class ASBeautifier
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -591,7 +591,6 @@ private:
|
||||
// SQL variables
|
||||
bool nextLineIsDeclareIndent; // begin declare section indent is reached
|
||||
bool isInDeclareSection; // need to indent a declare section
|
||||
|
||||
}; // Class ASEnhancer
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -987,7 +986,6 @@ private: // inline functions
|
||||
// sort comparison functions for ASResource
|
||||
bool sortOnLength(const string* a, const string* b);
|
||||
bool sortOnName(const string* a, const string* b);
|
||||
|
||||
} // end of astyle namespace
|
||||
|
||||
// end of astyle namespace --------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user