Logo Search packages:      
Sourcecode: codeblocks version File versions  Download package

Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes

astyle::ASFormatter Class Reference

Inheritance diagram for astyle::ASFormatter:
Inheritance graph
[legend]
Collaboration diagram for astyle::ASFormatter:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ASFormatter ()
virtual string beautify (const string &line)
bool getBlockIndent (void)
bool getBracketIndent (void)
bool getCaseIndent (void)
bool getClassIndent (void)
bool getEmptyLineFill (void)
int getFileType ()
bool getForceTabIndentation (void)
int getIndentLength (void)
bool getIndentManuallySet ()
string getIndentString (void)
bool getModeManuallySet ()
bool getSwitchIndent (void)
virtual bool hasMoreLines () const
virtual void init (ASSourceIterator *iter)
void init ()
virtual string nextLine ()
void setAddBracketsMode (bool state)
void setAddOneLineBracketsMode (bool state)
void setBlockIndent (bool state)
void setBracketFormatMode (BracketMode mode)
void setBracketIndent (bool state)
void setBreakBlocksMode (bool state)
void setBreakClosingHeaderBlocksMode (bool state)
void setBreakClosingHeaderBracketsMode (bool state)
void setBreakElseIfsMode (bool state)
void setBreakOneLineBlocksMode (bool state)
void setCaseIndent (bool state)
void setClassIndent (bool state)
void setCStyle ()
void setDeleteEmptyLinesMode (bool state)
void setEmptyLineFill (bool state)
void setFormattingStyle (FormatStyle style)
void setIndentManuallySet (bool state)
void setJavaStyle ()
void setLabelIndent (bool state)
void setMaxInStatementIndentLength (int max)
void setMinConditionalIndentLength (int min)
void setModeManuallySet (bool state)
void setNamespaceIndent (bool state)
void setOperatorPaddingMode (bool mode)
void setParensHeaderPaddingMode (bool mode)
void setParensInsidePaddingMode (bool mode)
void setParensOutsidePaddingMode (bool mode)
void setParensUnPaddingMode (bool state)
void setPointerAlignment (PointerAlign alignment)
void setPreprocessorIndent (bool state)
void setSharpStyle ()
void setSingleStatementsMode (bool state)
void setSpaceIndentation (int length=4)
void setSwitchIndent (bool state)
void setTabIndentation (int length=4, bool forceTabs=false)
void setTabSpaceConversionMode (bool state)
virtual ~ASFormatter ()

Protected Member Functions

void buildAssignmentOperators (vector< const string * > &assignmentOperators)
void buildCastOperators (vector< const string * > &castOperators)
void buildHeaders (vector< const string * > &headers, int fileType, bool beautifier=false)
void buildIndentableHeaders (vector< const string * > &indentableHeaders)
void buildNonAssignmentOperators (vector< const string * > &nonAssignmentOperators)
void buildNonParenHeaders (vector< const string * > &nonParenHeaders, int fileType, bool beautifier=false)
void buildOperators (vector< const string * > &operators)
void buildPreBlockStatements (vector< const string * > &preBlockStatements, int fileType)
void buildPreCommandHeaders (vector< const string * > &preCommandHeaders, int fileType)
void buildPreDefinitionHeaders (vector< const string * > &preDefinitionHeaders, int fileType)
void deleteStaticVectors ()
const string * findHeader (const string &line, int i, const vector< const string * > &possibleHeaders) const
bool findKeyword (const string &line, int i, const string &keyword) const
const string * findOperator (const string &line, int i, const vector< const string * > &possibleOperators) const
string getCurrentWord (const string &line, size_t charNum) const
int getNextProgramCharDistance (const string &line, int i) const
int indexOf (vector< const string * > &container, const string *element)
void init (int fileTypeArg)
bool isCharPotentialHeader (const string &line, size_t i) const
bool isCharPotentialOperator (char ch) const
bool isCStyle () const
bool isJavaStyle () const
bool isLegalNameChar (char ch) const
bool isSharpStyle () const
bool isWhiteSpace (char ch) const
char peekNextChar (const string &line, int i) const
string trim (const string &str)

Protected Attributes

static const string AS_ADD = string("add")
static const string AS_AND = string("&&")
static const string AS_AND_ASSIGN = string("&=")
static const string AS_BAR_EL = string("#el")
static const string AS_BAR_ENDIF = string("#endif")
static const string AS_BAR_IF = string("#if")
static const string AS_BAR_INCLUDE = string("#include")
static const string AS_BIT_AND = string("&")
static const string AS_BIT_NOT = string("~")
static const string AS_BIT_OR = string("|")
static const string AS_BIT_XOR = string("^")
static const string AS_BLPAREN_BLPAREN = string("[]")
static const string AS_CASE = string("case")
static const string AS_CATCH = string("catch")
static const string AS_CERR = string("cerr")
static const string AS_CLOSE_BRACKET = string("}")
static const string AS_CLOSE_COMMENT = string("*/")
static const string AS_COLON = string(":")
static const string AS_COMMA = string(",")
static const string AS_CONST = string("const")
static const string AS_COUT = string("cout")
static const string AS_DEFAULT = string("default")
static const string AS_DIV = string("/")
static const string AS_DYNAMIC_CAST = string("dynamic_cast")
static const string AS_ELSE = string("else")
static const string AS_ENUM = string("enum")
static const string AS_EQUAL_GR = string("=>")
static const string AS_FINALLY = string("finally")
static const string AS_FIXED = string("fixed")
static const string AS_GCC_MAX_ASSIGN = string(">?")
static const string AS_GR = string(">")
static const string AS_GR_EQUAL = string(">=")
static const string AS_GR_GR = string(">>")
static const string AS_GR_GR_GR = string(">>>")
static const string AS_GR_GR_GR_ASSIGN = string(">>>=")
static const string AS_INTERFACE = string("interface")
static const string AS_LOCK = string("lock")
static const string AS_LS = string("<")
static const string AS_LS_LS = string("<<")
static const string AS_LS_LS_ASSIGN = string("<<=")
static const string AS_LS_LS_LS = string("<<<")
static const string AS_LS_LS_LS_ASSIGN = string("<<<=")
static const string AS_MINUS = string("-")
static const string AS_MINUS_ASSIGN = string("-=")
static const string AS_MINUS_MINUS = string("--")
static const string AS_MOD = string("%")
static const string AS_MOD_ASSIGN = string("%=")
static const string AS_MULT = string("*")
static const string AS_MULT_ASSIGN = string("*=")
static const string AS_NAMESPACE = string("namespace")
static const string AS_NEW = string("new")
static const string AS_NOT_EQUAL = string("!=")
static const string AS_OPEN_COMMENT = string("/*")
static const string AS_OR = string("||")
static const string AS_OR_ASSIGN = string("|=")
static const string AS_PAREN_PAREN = string("()")
static const string AS_PLUS_ASSIGN = string("+=")
static const string AS_PLUS_PLUS = string("++")
static const string AS_PRIVATE = string("private")
static const string AS_PROTECTED = string("protected")
static const string AS_REINTERPRET_CAST = string("reinterpret_cast")
static const string AS_REMOVE = string("remove")
static const string AS_SEMICOLON = string(";")
static const string AS_SET = string("set")
static const string AS_STATIC_CAST = string("static_cast")
static const string AS_STRUCT = string("struct")
static const string AS_TEMPLATE = string("template")
static const string AS_THROWS = string("throws")
static const string AS_UNCHECKED = string("unchecked")
static const string AS_UNION = string("union")
static const string AS_UNSAFE = string("unsafe")
static const string AS_WHERE = string("where")
static const string AS_WHILE = string("while")
static const string AS_XOR_ASSIGN = string("^=")
int horstmannIndentInStatement
int inLineNumber
bool isInEnum
bool isInExtern
bool isNonInStatementArray
bool isSharpAccessor
bool isSharpDelegate
bool lineCommentNoBeautify
int nonInStatementBracket

Static Protected Attributes

static const string AS_ARROW = string("->")
static const string AS_ASM = string("asm")
static const string AS_ASSIGN = string("=")
static const string AS_BAR_DEFINE = string("#define")
static const string AS_CIN = string("cin")
static const string AS_CLASS = string("class")
static const string AS_COLON_COLON = string("::")
static const string AS_CONST_CAST = string("const_cast")
static const string AS_DELEGATE = string("delegate")
static const string AS_DIV_ASSIGN = string("/=")
static const string AS_DO = string("do")
static const string AS_EQUAL = string("==")
static const string AS_EXTERN = string("extern")
static const string AS_FOR = string("for")
static const string AS_FOREACH = string("foreach")
static const string AS_GCC_MIN_ASSIGN = string("<?")
static const string AS_GET = string("get")
static const string AS_GR_GR_ASSIGN = string(">>=")
static const string AS_IF = string("if")
static const string AS_LS_EQUAL = string("<=")
static const string AS_NOT = string("!")
static const string AS_OPEN_BRACKET = string("{")
static const string AS_OPEN_LINE_COMMENT = string("//")
static const string AS_OPERATOR = string("operator")
static const string AS_PLUS = string("+")
static const string AS_PUBLIC = string("public")
static const string AS_QUESTION = string("?")
static const string AS_QUESTION_QUESTION = string("??")
static const string AS_RETURN = string("return")
static const string AS_STATIC = string("static")
static const string AS_SWITCH = string("switch")
static const string AS_SYNCHRONIZED = string("synchronized")
static const string AS_TRY = string("try")

Private Member Functions

void addBracketsToStatement ()
void adjustComments ()
void appendChar (char ch, bool canBreakLine)
void appendCharInsideComments ()
void appendCurrentChar (bool canBreakLine=true)
void appendSequence (const string &sequence, bool canBreakLine=true)
void appendSpaceAfter ()
void appendSpacePad ()
void ASformatter (ASFormatter &copy)
void breakLine ()
void buildLanguageVectors ()
void checkForFollowingHeader (const string &firstLine)
bool commentAndHeaderFollows () const
void convertTabToSpaces ()
void deleteContainer (vector< BracketType > *&container)
template<typename T >
void deleteContainer (T &container)
const string * findHeader (const vector< const string * > &headers)
const string * findOperator (const vector< const string * > &headers)
void fixOptionVariableConflicts ()
void formatArrayBrackets (BracketType bracketType, bool isOpeningArrayBracket)
void formatArrayRunIn ()
void formatClosingBracket (BracketType bracketType)
void formatCommentBody ()
void formatCommentOpener ()
void formatLineCommentBody ()
void formatLineCommentOpener ()
void formatOpeningBracket (BracketType bracketType)
void formatPointerOrReference ()
void formatQuoteBody ()
void formatQuoteOpener ()
void formatRunIn ()
BracketType getBracketType ()
int getCurrentLineCommentAdjustment ()
bool getNextChar ()
bool getNextLine (bool emptyLineWasDeleted=false)
int getNextLineCommentAdjustment ()
string getPreviousWord (const string &line, int currPos) const
void goForward (int i)
template<typename T >
void initContainer (T &container, T value)
void initContainer (vector< BracketType > *&container, vector< BracketType > *value)
void initNewLine ()
bool isBeforeAnyComment () const
bool isBeforeAnyLineEndComment (int startPos) const
bool isBeforeComment () const
bool isBeforeMultipleLineEndComments (int startPos) const
bool isBracketType (BracketType a, BracketType b) const
bool isCurrentBracketBroken () const
bool isDereferenceOrAddressOf () const
bool isEmptyLine (const string &line) const
bool isInExponent () const
void isLineBreakBeforeClosingHeader ()
bool isNextCharOpeningBracket (int startChar) const
bool isNextWordSharpNonParenHeader (int startChar) const
bool isNonInStatementArrayBracket () const
bool isOkToBreakBlock (BracketType bracketType) const
bool isOneLineBlockReached () const
bool isPointerOrReference () const
bool isPointerOrReferenceCentered () const
bool isSequenceReached (const char *sequence) const
bool isUnaryOperator () const
ASFormatteroperator= (ASFormatter &)
void padOperators (const string *newOperator)
void padParens ()
char peekNextChar () const
string peekNextText (const string &firstLine, bool endOnEmptyLine=false) const
void processPreprocessor ()
void setBreakBlocksVariables ()

Private Attributes

bool appendOpeningBracket
BracketMode bracketFormatMode
vector< BracketType > * bracketTypeStack
bool breakCurrentOneLineBlock
int charNum
bool clearNonInStatement
char currentChar
const string * currentHeader
string currentLine
bool currentLineBeginsWithBracket
size_t currentLineBracketNum
bool doesLineStartComment
bool endOfCodeReached
ASEnhancerenhancer
string formattedLine
size_t formattedLineCommentNum
FormatStyle formattingStyle
bool foundCastOperator
bool foundClassHeader
bool foundClosingHeader
bool foundInterfaceHeader
bool foundNamespaceHeader
bool foundPreCommandHeader
bool foundPreDefinitionHeader
bool foundQuestionMark
bool foundStructHeader
bool haveLineContinuationChar
int horstmannIndentChars
bool isAppendPostBlockEmptyLineRequested
bool isCharImmediatelyPostCloseBlock
bool isCharImmediatelyPostComment
bool isCharImmediatelyPostLineComment
bool isCharImmediatelyPostOpenBlock
bool isCharImmediatelyPostOperator
bool isCharImmediatelyPostReturn
bool isCharImmediatelyPostTemplate
bool isImmediatelyPostComment
bool isImmediatelyPostCommentOnly
bool isImmediatelyPostEmptyBlock
bool isImmediatelyPostEmptyLine
bool isImmediatelyPostHeader
bool isImmediatelyPostLineComment
bool isImmediatelyPostOperator
bool isImmediatelyPostPreprocessor
bool isImmediatelyPostReturn
bool isInBlParen
bool isInCase
bool isInComment
bool isIndentManuallySet
bool isInHeader
bool isInHorstmannRunIn
bool isInLineBreak
bool isInLineComment
bool isInPotentialCalculation
bool isInPreprocessor
bool isInQuote
bool isInQuoteContinuation
bool isInTemplate
bool isInVerbatimQuote
bool isJavaStaticConstructor
bool isLineReady
bool isModeManuallySet
bool isNonParenHeader
bool isPrependPostBlockEmptyLineRequested
bool isPreviousBracketBlockRelated
bool isPreviousCharPostComment
bool isSpecialChar
bool isVirgin
size_t leadingSpaces
bool lineCommentNoIndent
bool lineEndsInCommentOnly
bool lineIsEmpty
bool lineIsLineCommentOnly
bool needHeaderOpeningBracket
int nextLineSpacePadNum
bool noTrimCommentContinuation
vector< int > * parenStack
bool passedColon
bool passedSemicolon
PointerAlign pointerAlignment
vector< const string * > * preBracketHeaderStack
bool prependEmptyLine
int preprocBracketTypeStackSize
BracketType previousBracketType
char previousChar
char previousCommandChar
char previousNonWSChar
const string * previousOperator
size_t previousReadyFormattedLineLength
char quoteChar
string readyFormattedLine
bool shouldAddBrackets
bool shouldAddOneLineBrackets
bool shouldBreakBlocks
bool shouldBreakClosingHeaderBlocks
bool shouldBreakClosingHeaderBrackets
bool shouldBreakElseIfs
bool shouldBreakLineAtNextChar
bool shouldBreakOneLineBlocks
bool shouldBreakOneLineStatements
bool shouldConvertTabs
bool shouldDeleteEmptyLines
bool shouldPadHeader
bool shouldPadOperators
bool shouldPadParensInside
bool shouldPadParensOutside
bool shouldReparseCurrentChar
bool shouldUnPadParens
ASSourceIteratorsourceIterator
int spacePadNum
int tabIncrementIn
int templateDepth
int traceLineNumber

Static Private Attributes

static vector< const string * > assignmentOperators
static vector< const string * > castOperators
static int formatterFileType = 9
static vector< const string * > headers
static vector< const string * > nonParenHeaders
static vector< const string * > operators
static vector< const string * > preCommandHeaders
static vector< const string * > preDefinitionHeaders

Detailed Description

Definition at line 462 of file astyle.h.


The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index