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::ASBeautifier Class Reference

Inheritance diagram for astyle::ASBeautifier:
Inheritance graph
Collaboration diagram for astyle::ASBeautifier:
Collaboration graph

List of all members.

Public Member Functions

 ASBeautifier ()
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)
string getIndentString (void)
bool getSwitchIndent (void)
virtual bool hasMoreLines () const
void init ()
virtual void init (ASSourceIterator *iter)
virtual string nextLine ()
void setBlockIndent (bool state)
void setBracketIndent (bool state)
void setCaseIndent (bool state)
void setClassIndent (bool state)
void setCStyle ()
void setEmptyLineFill (bool state)
void setJavaStyle ()
void setLabelIndent (bool state)
void setMaxInStatementIndentLength (int max)
void setMinConditionalIndentLength (int min)
void setNamespaceIndent (bool state)
void setPreprocessorIndent (bool state)
void setSharpStyle ()
void setSpaceIndentation (int length=4)
void setSwitchIndent (bool state)
void setTabIndentation (int length=4, bool forceTabs=false)
virtual ~ASBeautifier ()

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

 ASBeautifier (const ASBeautifier &copy)
int convertTabToSpaces (int i, int tabIncrementIn) const
template<typename T >
void deleteContainer (T &container)
void deleteContainer (vector< vector< const string * > * > *&container)
template<typename T >
void initContainer (T &container, T value)
void initStatic ()
bool isClassAccessModifier (string &line) const
ASBeautifieroperator= (ASBeautifier &)
string preLineWS (int spaceTabCount, int tabCount)
void registerInStatementIndent (const string &line, int i, int spaceTabCount, int tabIncrementIn, int minIndent, bool updateParenStack)

Private Attributes

vector< ASBeautifier * > * activeBeautifierStack
vector< int > * activeBeautifierStackLengthStack
bool backslashEndsPrevLine
bool blockCommentNoBeautify
bool blockCommentNoIndent
bool blockIndent
vector< int > * blockParenDepthStack
vector< bool > * blockStatementStack
int blockTabCount
vector< bool > * bracketBlockStateStack
bool bracketIndent
bool caseIndent
bool classIndent
int classInitializerTabs
const string * currentHeader
char currentNonLegalCh
char currentNonSpaceCh
int defineTabCount
bool emptyLineFill
int fileType
bool haveLineContinuationChar
vector< const string * > * headerStack
int indentLength
string indentString
vector< int > * inStatementIndentStack
vector< int > * inStatementIndentStackSizeStack
bool isInCase
bool isInClassHeader
bool isInClassHeaderTab
bool isInComment
bool isInConditional
bool isInDefine
bool isInDefineDefinition
bool isInHeader
bool isInQuestion
bool isInQuote
bool isInStatement
bool isInTemplate
bool isInVerbatimQuote
bool isMinimalConditinalIndentSet
bool labelIndent
bool lineOpensComment
int maxInStatementIndent
int minConditionalIndent
bool namespaceIndent
int parenDepth
vector< int > * parenIndentStack
vector< bool > * parenStatementStack
bool preprocessorIndent
int prevFinalLineSpaceTabCount
int prevFinalLineTabCount
const string * previousLastLineHeader
bool previousLineProbationTab
char prevNonLegalCh
char prevNonSpaceCh
const string * probationHeader
char quoteChar
bool shouldForceTabIndentation
bool switchIndent
int templateDepth
vector< vector< const string * > * > * tempStacks
vector< ASBeautifier * > * waitingBeautifierStack
vector< int > * waitingBeautifierStackLengthStack

Static Private Attributes

static vector< const string * > assignmentOperators
static int beautifierFileType = 9
static vector< const string * > headers
static vector< const string * > indentableHeaders
static vector< const string * > nonAssignmentOperators
static vector< const string * > nonParenHeaders
static vector< const string * > preBlockStatements

Detailed Description

Definition at line 259 of file astyle.h.

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

Generated by  Doxygen 1.6.0   Back to index