|
clang
5.0.0
|
Base class for single line tokens that can be broken. More...
Public Member Functions | |
| unsigned | getLineCount () const override |
| Returns the number of lines in this token in the original code. More... | |
| unsigned | getLineLengthAfterSplit (unsigned LineIndex, unsigned TailOffset, StringRef::size_type Length) const override |
Returns the number of columns required to format the piece of line at LineIndex, from byte offset TailOffset with length Length. More... | |
Public Member Functions inherited from clang::format::BreakableToken | |
| virtual | ~BreakableToken () |
| virtual Split | getSplit (unsigned LineIndex, unsigned TailOffset, unsigned ColumnLimit, llvm::Regex &CommentPragmasRegex) const =0 |
Returns a range (offset, length) at which to break the line at LineIndex, if previously broken at TailOffset. More... | |
| virtual void | insertBreak (unsigned LineIndex, unsigned TailOffset, Split Split, WhitespaceManager &Whitespaces)=0 |
Emits the previously retrieved Split via Whitespaces. More... | |
| unsigned | getLineLengthAfterCompression (unsigned RemainingTokenColumns, Split Split) const |
Returns the number of columns required to format the piece of line at LineIndex, from byte offset TailOffset after the whitespace range Split has been compressed into a single space. More... | |
| virtual void | compressWhitespace (unsigned LineIndex, unsigned TailOffset, Split Split, WhitespaceManager &Whitespaces)=0 |
Replaces the whitespace range described by Split with a single space. More... | |
| virtual Split | getSplitBefore (unsigned LineIndex, unsigned PreviousEndColumn, unsigned ColumnLimit, llvm::Regex &CommentPragmasRegex) const |
Returns a whitespace range (offset, length) of the content at LineIndex such that the content preceding this range needs to be reformatted before any breaks are made to this line. More... | |
| virtual unsigned | getLineLengthAfterSplitBefore (unsigned LineIndex, unsigned TailOffset, unsigned PreviousEndColumn, unsigned ColumnLimit, Split SplitBefore) const |
Returns the number of columns required to format the piece of line at LineIndex after the content preceding the whitespace range specified SplitBefore has been reformatted, but before any breaks are made to this line. More... | |
| virtual void | replaceWhitespaceBefore (unsigned LineIndex, unsigned PreviousEndColumn, unsigned ColumnLimit, Split SplitBefore, WhitespaceManager &Whitespaces) |
Replaces the whitespace between LineIndex-1 and LineIndex. More... | |
| virtual void | updateNextToken (LineState &State) const |
Updates the next token of State to the next token after this one. More... | |
Protected Member Functions | |
| BreakableSingleLineToken (const FormatToken &Tok, unsigned StartColumn, StringRef Prefix, StringRef Postfix, bool InPPDirective, encoding::Encoding Encoding, const FormatStyle &Style) | |
Protected Member Functions inherited from clang::format::BreakableToken | |
| BreakableToken (const FormatToken &Tok, bool InPPDirective, encoding::Encoding Encoding, const FormatStyle &Style) | |
Protected Attributes | |
| unsigned | StartColumn |
| StringRef | Prefix |
| StringRef | Postfix |
| StringRef | Line |
Protected Attributes inherited from clang::format::BreakableToken | |
| const FormatToken & | Tok |
| const bool | InPPDirective |
| const encoding::Encoding | Encoding |
| const FormatStyle & | Style |
Additional Inherited Members | |
Public Types inherited from clang::format::BreakableToken | |
| typedef std::pair < StringRef::size_type, unsigned > | Split |
| Contains starting character index and length of split. More... | |
Base class for single line tokens that can be broken.
getSplit() needs to be implemented by child classes.
Definition at line 167 of file BreakableToken.h.
|
protected |
Definition at line 192 of file BreakableToken.cpp.
References Line, and clang::format::FormatToken::TokenText.
|
overridevirtual |
Returns the number of lines in this token in the original code.
Implements clang::format::BreakableToken.
Definition at line 181 of file BreakableToken.cpp.
|
overridevirtual |
Returns the number of columns required to format the piece of line at LineIndex, from byte offset TailOffset with length Length.
Note that previous breaks are not taken into account. TailOffset is always specified from the start of the (original) line. Length can be set to StringRef::npos, which means "to the end of line".
Implements clang::format::BreakableToken.
Definition at line 183 of file BreakableToken.cpp.
References clang::format::encoding::columnWidthWithTabs(), clang::format::BreakableToken::Encoding, Line, Postfix, Prefix, StartColumn, clang::format::BreakableToken::Style, and clang::format::FormatStyle::TabWidth.
|
protected |
Definition at line 186 of file BreakableToken.h.
Referenced by BreakableSingleLineToken(), getLineLengthAfterSplit(), and clang::format::BreakableStringLiteral::getSplit().
|
protected |
Definition at line 184 of file BreakableToken.h.
Referenced by getLineLengthAfterSplit(), clang::format::BreakableStringLiteral::getSplit(), and clang::format::BreakableStringLiteral::insertBreak().
|
protected |
Definition at line 182 of file BreakableToken.h.
Referenced by getLineLengthAfterSplit(), clang::format::BreakableStringLiteral::getSplit(), and clang::format::BreakableStringLiteral::insertBreak().
|
protected |
Definition at line 180 of file BreakableToken.h.
Referenced by getLineLengthAfterSplit(), clang::format::BreakableStringLiteral::getSplit(), and clang::format::BreakableStringLiteral::insertBreak().
1.8.6