astyle::ASBeautifier Class Reference
#include <astyle.h>
Inheritance diagram for astyle::ASBeautifier:


Public Member Functions | |
ASBeautifier () | |
ASBeautifier's constructor. | |
virtual | ~ASBeautifier () |
ASBeautifier's destructor. | |
virtual void | init (ASSourceIterator *iter) |
initialize the ASBeautifier. | |
virtual void | init () |
initialize the ASBeautifier. | |
virtual bool | hasMoreLines () const |
check if there are any indented lines ready to be read by nextLine() | |
virtual string | nextLine () |
get the next indented line. | |
virtual string | beautify (const string &line) |
beautify a line of source code. | |
void | setTabIndentation (int length=4, bool forceTabs=false) |
indent using one tab per indentation | |
void | setSpaceIndentation (int length=4) |
indent using a number of spaces per indentation. | |
void | setMaxInStatementIndentLength (int max) |
set the maximum indentation between two lines in a multi-line statement. | |
void | setMinConditionalIndentLength (int min) |
set the minimum indentation between two lines in a multi-line condition. | |
void | setClassIndent (bool state) |
set the state of the class indentation option. | |
void | setSwitchIndent (bool state) |
set the state of the switch indentation option. | |
void | setCaseIndent (bool state) |
set the state of the case indentation option. | |
void | setBracketIndent (bool state) |
set the state of the bracket indentation option. | |
void | setBlockIndent (bool state) |
set the state of the block indentation option. | |
void | setNamespaceIndent (bool state) |
set the state of the namespace indentation option. | |
void | setLabelIndent (bool state) |
set the state of the label indentation option. | |
void | setCStyle () |
set indentation style to ANSI C/C++. | |
void | setJavaStyle () |
set indentation style to Java / K&R. | |
void | setEmptyLineFill (bool state) |
set the state of the empty line fill option. | |
void | setPreprocessorIndent (bool state) |
set the state of the preprocessor indentation option. | |
Protected Member Functions | |
int | getNextProgramCharDistance (const string &line, int i) |
get distance to the next non-white sspace, non-comment character in the line. | |
bool | isLegalNameChar (char ch) const |
check if a specific character can be used in a legal variable/method/class name | |
bool | isWhiteSpace (char ch) const |
check if a specific character can be used in a legal variable/method/class name | |
const string * | findHeader (const string &line, int i, const vector< const string * > &possibleHeaders, bool checkBoundry=true) |
check if a specific line position contains a header, out of several possible headers. | |
string | trim (const string &str) |
trim removes the white space surrounding a line. | |
int | indexOf (vector< const string * > &container, const string *element) |
find the index number of a string element in a container of strings | |
Private Member Functions | |
ASBeautifier (const ASBeautifier ©) | |
void | operator= (ASBeautifier &) |
void | initStatic () |
void | registerInStatementIndent (const string &line, int i, int spaceTabCount, int minIndent, bool updateParenStack) |
register an in-statement indent. | |
string | preLineWS (int spaceTabCount, int tabCount) |
Private Attributes | |
ASSourceIterator * | sourceIterator |
vector< ASBeautifier * > * | waitingBeautifierStack |
vector< ASBeautifier * > * | activeBeautifierStack |
vector< int > * | waitingBeautifierStackLengthStack |
vector< int > * | activeBeautifierStackLengthStack |
vector< const string * > * | headerStack |
vector< vector< const string * > * > * | tempStacks |
vector< int > * | blockParenDepthStack |
vector< bool > * | blockStatementStack |
vector< bool > * | parenStatementStack |
vector< int > * | inStatementIndentStack |
vector< int > * | inStatementIndentStackSizeStack |
vector< int > * | parenIndentStack |
vector< bool > * | bracketBlockStateStack |
string | indentString |
const string * | currentHeader |
const string * | previousLastLineHeader |
const string * | immediatelyPreviousAssignmentOp |
const string * | probationHeader |
bool | isInQuote |
bool | isInComment |
bool | isInCase |
bool | isInQuestion |
bool | isInStatement |
bool | isInHeader |
bool | isCStyle |
bool | isInOperator |
bool | isInTemplate |
bool | isInConst |
bool | isInDefine |
bool | isInDefineDefinition |
bool | classIndent |
bool | isInClassHeader |
bool | isInClassHeaderTab |
bool | switchIndent |
bool | caseIndent |
bool | namespaceIndent |
bool | bracketIndent |
bool | blockIndent |
bool | labelIndent |
bool | preprocessorIndent |
bool | isInConditional |
bool | isMinimalConditinalIndentSet |
bool | shouldForceTabIndentation |
int | minConditionalIndent |
int | parenDepth |
int | indentLength |
int | blockTabCount |
int | leadingWhiteSpaces |
int | maxInStatementIndent |
int | templateDepth |
char | quoteChar |
char | prevNonSpaceCh |
char | currentNonSpaceCh |
char | currentNonLegalCh |
char | prevNonLegalCh |
int | prevFinalLineSpaceTabCount |
int | prevFinalLineTabCount |
bool | emptyLineFill |
bool | backslashEndsPrevLine |
int | defineTabCount |
Static Private Attributes | |
vector< const string * > | headers |
vector< const string * > | nonParenHeaders |
vector< const string * > | preprocessorHeaders |
vector< const string * > | preBlockStatements |
vector< const string * > | assignmentOperators |
vector< const string * > | nonAssignmentOperators |
bool | calledInitStatic = false |
Constructor & Destructor Documentation
|
|
ASBeautifier's destructor.
Definition at line 297 of file ASBeautifier.cpp. References blockParenDepthStack, blockStatementStack, bracketBlockStateStack, DELETE_CONTAINER, headerStack, inStatementIndentStack, inStatementIndentStackSizeStack, parenIndentStack, parenStatementStack, and tempStacks. |
|
Member Function Documentation
|
|
check if a specific line position contains a header, out of several possible headers.
Definition at line 1811 of file ASBeautifier.cpp. References isLegalNameChar(). Referenced by beautify(). |
|
get distance to the next non-white sspace, non-comment character in the line. if no such character exists, return the length remaining to the end of the line. Definition at line 1754 of file ASBeautifier.cpp. References isWhiteSpace(). Referenced by registerInStatementIndent(). |
|
check if there are any indented lines ready to be read by nextLine()
Reimplemented in astyle::ASFormatter. Definition at line 564 of file ASBeautifier.cpp. References astyle::ASSourceIterator::hasMoreLines(), and sourceIterator. |
|
find the index number of a string element in a container of strings
Definition at line 1886 of file ASBeautifier.cpp. Referenced by beautify(). |
|
initialize the ASBeautifier.
Definition at line 333 of file ASBeautifier.cpp. References activeBeautifierStack, activeBeautifierStackLengthStack, backslashEndsPrevLine, blockParenDepthStack, blockStatementStack, blockTabCount, bracketBlockStateStack, currentNonLegalCh, currentNonSpaceCh, defineTabCount, headerStack, immediatelyPreviousAssignmentOp, INIT_CONTAINER, inStatementIndentStack, inStatementIndentStackSizeStack, isInCase, isInClassHeader, isInClassHeaderTab, isInComment, isInConditional, isInConst, isInDefine, isInDefineDefinition, isInHeader, isInOperator, isInQuestion, isInQuote, isInStatement, isInTemplate, leadingWhiteSpaces, parenDepth, parenIndentStack, parenStatementStack, prevFinalLineSpaceTabCount, prevFinalLineTabCount, previousLastLineHeader, prevNonLegalCh, prevNonSpaceCh, probationHeader, templateDepth, tempStacks, waitingBeautifierStack, and waitingBeautifierStackLengthStack. Referenced by init(). |
|
initialize the ASBeautifier. init() should be called every time a ABeautifier object is to start beautifying a NEW source file. init() recieves a pointer to a DYNAMICALLY CREATED ASSourceIterator object that will be used to iterate through the source code. This object will be deleted during the ASBeautifier's destruction, and thus should not be deleted elsewhere.
Reimplemented in astyle::ASFormatter. Definition at line 324 of file ASBeautifier.cpp. References init(), and sourceIterator. |
|
nonParenHeaders.push_back(&AS_ASM); Definition at line 63 of file ASBeautifier.cpp. References assignmentOperators, calledInitStatic, headers, nonAssignmentOperators, nonParenHeaders, and preBlockStatements. Referenced by ASBeautifier(). |
|
check if a specific character can be used in a legal variable/method/class name
Definition at line 1799 of file ASBeautifier.cpp. References isCStyle. Referenced by beautify(), findHeader(), astyle::ASFormatter::isPointerOrReference(), and astyle::ASFormatter::nextLine(). |
|
check if a specific character can be used in a legal variable/method/class name
Definition at line 1874 of file ASBeautifier.cpp. Referenced by astyle::ASFormatter::appendSpacePad(), beautify(), astyle::ASFormatter::getNextChar(), getNextProgramCharDistance(), astyle::ASFormatter::isBeforeComment(), astyle::ASFormatter::isPointerOrReference(), astyle::ASFormatter::nextLine(), astyle::ASFormatter::peekNextChar(), trim(), and astyle::ASFormatter::trimNewLine(). |
|
get the next indented line.
Reimplemented in astyle::ASFormatter. Definition at line 574 of file ASBeautifier.cpp. References beautify(), astyle::ASSourceIterator::nextLine(), and sourceIterator. |
|
|
|
Definition at line 1691 of file ASBeautifier.cpp. Referenced by beautify(). |
|
register an in-statement indent.
Definition at line 1708 of file ASBeautifier.cpp. References getNextProgramCharDistance(), indentLength, inStatementIndentStack, and parenIndentStack. Referenced by beautify(). |
|
set the state of the block indentation option. If true, entire blocks will be indented one additional indent, similar to the GNU indent style.
Definition at line 470 of file ASBeautifier.cpp. References blockIndent, and setBracketIndent(). Referenced by ASBeautifier(), and KDevFormatter::KDevFormatter(). |
|
set the state of the bracket indentation option. If true, brackets will be indented one additional indent.
Definition at line 459 of file ASBeautifier.cpp. References bracketIndent. Referenced by ASBeautifier(), KDevFormatter::KDevFormatter(), and setBlockIndent(). |
|
set the state of the case indentation option. If true, lines of 'case' statements will be indented one additional indent.
Definition at line 505 of file ASBeautifier.cpp. References caseIndent. Referenced by ASBeautifier(), and KDevFormatter::KDevFormatter(). |
|
set the state of the class indentation option. If true, C++ class definitions will be indented one additional indent.
Definition at line 483 of file ASBeautifier.cpp. References classIndent. Referenced by ASBeautifier(), and KDevFormatter::KDevFormatter(). |
|
set indentation style to ANSI C/C++.
Definition at line 392 of file ASBeautifier.cpp. References isCStyle. Referenced by ASBeautifier(). |
|
set the state of the empty line fill option. If true, empty lines will be filled with the whitespace. of their previous lines. If false, these lines will remain empty.
Definition at line 554 of file ASBeautifier.cpp. References emptyLineFill. Referenced by ASBeautifier(). |
|
set indentation style to Java / K&R.
Definition at line 400 of file ASBeautifier.cpp. References isCStyle. Referenced by KDevFormatter::KDevFormatter(). |
|
set the state of the label indentation option. If true, labels will be indented one indent LESS than the current indentation level. If false, labels will be flushed to the left with NO indent at all.
Definition at line 530 of file ASBeautifier.cpp. References labelIndent. Referenced by ASBeautifier(), and KDevFormatter::KDevFormatter(). |
|
set the maximum indentation between two lines in a multi-line statement.
Definition at line 437 of file ASBeautifier.cpp. References maxInStatementIndent. Referenced by ASBeautifier(), and KDevFormatter::KDevFormatter(). |
|
set the minimum indentation between two lines in a multi-line condition.
Definition at line 447 of file ASBeautifier.cpp. References isMinimalConditinalIndentSet, and minConditionalIndent. Referenced by KDevFormatter::KDevFormatter(). |
|
set the state of the namespace indentation option. If true, blocks of 'namespace' statements will be indented one additional indent. Otherwise, NO indentation will be added.
Definition at line 516 of file ASBeautifier.cpp. References namespaceIndent. Referenced by ASBeautifier(), and KDevFormatter::KDevFormatter(). |
|
set the state of the preprocessor indentation option. If true, multiline #define statements will be indented.
Definition at line 541 of file ASBeautifier.cpp. References preprocessorIndent. Referenced by ASBeautifier(). |
|
indent using a number of spaces per indentation.
Definition at line 423 of file ASBeautifier.cpp. References indentLength, indentString, length(), and minConditionalIndent. Referenced by ASBeautifier(), and KDevFormatter::KDevFormatter(). |
|
set the state of the switch indentation option. If true, blocks of 'switch' statements will be indented one additional indent.
Definition at line 494 of file ASBeautifier.cpp. References switchIndent. Referenced by ASBeautifier(), and KDevFormatter::KDevFormatter(). |
|
indent using one tab per indentation
Definition at line 408 of file ASBeautifier.cpp. References indentLength, indentString, minConditionalIndent, and shouldForceTabIndentation. Referenced by KDevFormatter::KDevFormatter(). |
|
trim removes the white space surrounding a line.
Definition at line 1903 of file ASBeautifier.cpp. References isWhiteSpace(). Referenced by beautify(), and astyle::ASFormatter::nextLine(). |
Member Data Documentation
|
Definition at line 149 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Definition at line 151 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Reimplemented in astyle::ASFormatter. Definition at line 57 of file ASBeautifier.cpp. Referenced by beautify(), and initStatic(). |
|
Definition at line 206 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Definition at line 185 of file astyle.h. Referenced by ASBeautifier(), beautify(), and setBlockIndent(). |
|
Definition at line 154 of file astyle.h. Referenced by ASBeautifier(), beautify(), init(), and ~ASBeautifier(). |
|
Definition at line 155 of file astyle.h. Referenced by ASBeautifier(), beautify(), init(), and ~ASBeautifier(). |
|
Definition at line 194 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Definition at line 160 of file astyle.h. Referenced by ASBeautifier(), beautify(), init(), and ~ASBeautifier(). |
|
Definition at line 184 of file astyle.h. Referenced by ASBeautifier(), beautify(), and setBracketIndent(). |
|
Reimplemented in astyle::ASFormatter. Definition at line 52 of file ASBeautifier.cpp. Referenced by initStatic(). |
|
Definition at line 182 of file astyle.h. Referenced by ASBeautifier(), and setCaseIndent(). |
|
Definition at line 178 of file astyle.h. Referenced by ASBeautifier(), beautify(), and setClassIndent(). |
|
Reimplemented in astyle::ASFormatter. Definition at line 162 of file astyle.h. Referenced by ASBeautifier(), and beautify(). |
|
Definition at line 201 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Definition at line 200 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Definition at line 207 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Definition at line 205 of file astyle.h. Referenced by ASBeautifier(), and setEmptyLineFill(). |
|
Reimplemented in astyle::ASFormatter. Definition at line 54 of file ASBeautifier.cpp. Referenced by beautify(), and initStatic(). |
|
Definition at line 152 of file astyle.h. Referenced by ASBeautifier(), beautify(), init(), and ~ASBeautifier(). |
|
Definition at line 164 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Definition at line 193 of file astyle.h. Referenced by ASBeautifier(), registerInStatementIndent(), setSpaceIndentation(), and setTabIndentation(). |
|
Definition at line 161 of file astyle.h. Referenced by ASBeautifier(), setSpaceIndentation(), and setTabIndentation(). |
|
Definition at line 157 of file astyle.h. Referenced by ASBeautifier(), beautify(), init(), registerInStatementIndent(), and ~ASBeautifier(). |
|
Definition at line 158 of file astyle.h. Referenced by ASBeautifier(), beautify(), init(), and ~ASBeautifier(). |
|
Definition at line 172 of file astyle.h. Referenced by ASBeautifier(), beautify(), isLegalNameChar(), setCStyle(), and setJavaStyle(). |
|
Definition at line 168 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Definition at line 179 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Definition at line 180 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Reimplemented in astyle::ASFormatter. Definition at line 167 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Definition at line 188 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Definition at line 175 of file astyle.h. Referenced by ASBeautifier(), and init(). |
|
Definition at line 176 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Definition at line 177 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Reimplemented in astyle::ASFormatter. Definition at line 171 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Definition at line 173 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Definition at line 169 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Reimplemented in astyle::ASFormatter. Definition at line 166 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Definition at line 170 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Reimplemented in astyle::ASFormatter. Definition at line 174 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Definition at line 189 of file astyle.h. Referenced by ASBeautifier(), and setMinConditionalIndentLength(). |
|
Definition at line 186 of file astyle.h. Referenced by ASBeautifier(), and setLabelIndent(). |
|
Definition at line 195 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Definition at line 196 of file astyle.h. Referenced by ASBeautifier(), and setMaxInStatementIndentLength(). |
|
Definition at line 191 of file astyle.h. Referenced by ASBeautifier(), beautify(), setMinConditionalIndentLength(), setSpaceIndentation(), and setTabIndentation(). |
|
Definition at line 183 of file astyle.h. Referenced by ASBeautifier(), beautify(), and setNamespaceIndent(). |
|
Definition at line 58 of file ASBeautifier.cpp. Referenced by beautify(), and initStatic(). |
|
Reimplemented in astyle::ASFormatter. Definition at line 55 of file ASBeautifier.cpp. Referenced by beautify(), and initStatic(). |
|
Definition at line 192 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Definition at line 159 of file astyle.h. Referenced by ASBeautifier(), beautify(), init(), registerInStatementIndent(), and ~ASBeautifier(). |
|
Definition at line 156 of file astyle.h. Referenced by ASBeautifier(), beautify(), init(), and ~ASBeautifier(). |
|
Definition at line 56 of file ASBeautifier.cpp. Referenced by beautify(), and initStatic(). |
|
Reimplemented in astyle::ASFormatter. |
|
Definition at line 187 of file astyle.h. Referenced by ASBeautifier(), beautify(), and setPreprocessorIndent(). |
|
Definition at line 203 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Definition at line 204 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Definition at line 163 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Definition at line 202 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Definition at line 199 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Definition at line 165 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Reimplemented in astyle::ASFormatter. Definition at line 198 of file astyle.h. Referenced by ASBeautifier(), and beautify(). |
|
Definition at line 190 of file astyle.h. Referenced by ASBeautifier(), and setTabIndentation(). |
|
Reimplemented in astyle::ASFormatter. Definition at line 147 of file astyle.h. Referenced by ASBeautifier(), hasMoreLines(), init(), and nextLine(). |
|
Definition at line 181 of file astyle.h. Referenced by ASBeautifier(), beautify(), and setSwitchIndent(). |
|
Definition at line 197 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Definition at line 153 of file astyle.h. Referenced by ASBeautifier(), beautify(), init(), and ~ASBeautifier(). |
|
Definition at line 148 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
|
Definition at line 150 of file astyle.h. Referenced by ASBeautifier(), beautify(), and init(). |
The documentation for this class was generated from the following files:
- lib/astyle/astyle.h
- lib/astyle/ASBeautifier.cpp