clang API Documentation
#include <BreakableToken.h>


Public Member Functions | |
| BreakableBlockComment (const FormatToken &Token, unsigned IndentLevel, unsigned StartColumn, unsigned OriginaStartColumn, bool FirstInLine, bool InPPDirective, encoding::Encoding Encoding, const FormatStyle &Style) | |
| Creates a breakable token for a block comment. | |
| unsigned | getLineCount () const override |
| Returns the number of lines in this token in the original code. | |
| 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 Offset with length Length. | |
| Split | getSplit (unsigned LineIndex, unsigned TailOffset, unsigned ColumnLimit) const override |
Returns a range (offset, length) at which to break the line at LineIndex, if previously broken at TailOffset. If possible, do not violate ColumnLimit. | |
| void | insertBreak (unsigned LineIndex, unsigned TailOffset, Split Split, WhitespaceManager &Whitespaces) override |
Emits the previously retrieved Split via Whitespaces. | |
| void | replaceWhitespace (unsigned LineIndex, unsigned TailOffset, Split Split, WhitespaceManager &Whitespaces) override |
Replaces the whitespace range described by Split with a single space. | |
| void | replaceWhitespaceBefore (unsigned LineIndex, WhitespaceManager &Whitespaces) override |
Replaces the whitespace between LineIndex-1 and LineIndex. | |
Definition at line 157 of file BreakableToken.h.
| clang::format::BreakableBlockComment::BreakableBlockComment | ( | const FormatToken & | Token, |
| unsigned | IndentLevel, | ||
| unsigned | StartColumn, | ||
| unsigned | OriginaStartColumn, | ||
| bool | FirstInLine, | ||
| bool | InPPDirective, | ||
| encoding::Encoding | Encoding, | ||
| const FormatStyle & | Style | ||
| ) |
Creates a breakable token for a block comment.
StartColumn specifies the column in which the comment will start after formatting, while OriginalStartColumn specifies in which column the comment started before formatting. If the comment starts a line after formatting, set FirstInLine to true.
Definition at line 251 of file BreakableToken.cpp.
References clang::format::FormatToken::TokenText.
| unsigned clang::format::BreakableBlockComment::getLineCount | ( | ) | const [override, virtual] |
Returns the number of lines in this token in the original code.
Implements clang::format::BreakableToken.
Definition at line 356 of file BreakableToken.cpp.
| unsigned clang::format::BreakableBlockComment::getLineLengthAfterSplit | ( | unsigned | LineIndex, |
| unsigned | Offset, | ||
| StringRef::size_type | Length | ||
| ) | const [override, virtual] |
Returns the number of columns required to format the piece of line at LineIndex, from byte offset Offset with length Length.
Note that previous breaks are not taken into account. Offset 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 358 of file BreakableToken.cpp.
References clang::format::encoding::columnWidthWithTabs(), clang::format::BreakableToken::Encoding, clang::format::BreakableToken::Style, and clang::format::FormatStyle::TabWidth.
| BreakableToken::Split clang::format::BreakableBlockComment::getSplit | ( | unsigned | LineIndex, |
| unsigned | TailOffset, | ||
| unsigned | ColumnLimit | ||
| ) | const [override, virtual] |
Returns a range (offset, length) at which to break the line at LineIndex, if previously broken at TailOffset. If possible, do not violate ColumnLimit.
Implements clang::format::BreakableToken.
Definition at line 370 of file BreakableToken.cpp.
References clang::format::BreakableToken::Encoding, clang::format::getCommentSplit(), clang::format::BreakableToken::Style, and clang::format::FormatStyle::TabWidth.
| void clang::format::BreakableBlockComment::insertBreak | ( | unsigned | LineIndex, |
| unsigned | TailOffset, | ||
| Split | Split, | ||
| WhitespaceManager & | Whitespaces | ||
| ) | [override, virtual] |
Emits the previously retrieved Split via Whitespaces.
Implements clang::format::BreakableToken.
Definition at line 377 of file BreakableToken.cpp.
References clang::format::BreakableToken::IndentLevel, clang::format::BreakableToken::InPPDirective, clang::format::WhitespaceManager::replaceWhitespaceInToken(), clang::format::BreakableToken::Tok, and clang::format::FormatToken::TokenText.
| void clang::format::BreakableBlockComment::replaceWhitespace | ( | unsigned | LineIndex, |
| unsigned | TailOffset, | ||
| Split | Split, | ||
| WhitespaceManager & | Whitespaces | ||
| ) | [override, virtual] |
Replaces the whitespace range described by Split with a single space.
Implements clang::format::BreakableToken.
Definition at line 397 of file BreakableToken.cpp.
References clang::format::WhitespaceManager::replaceWhitespaceInToken(), clang::format::BreakableToken::Tok, and clang::format::FormatToken::TokenText.
| void clang::format::BreakableBlockComment::replaceWhitespaceBefore | ( | unsigned | LineIndex, |
| WhitespaceManager & | Whitespaces | ||
| ) | [override, virtual] |
Replaces the whitespace between LineIndex-1 and LineIndex.
Reimplemented from clang::format::BreakableToken.
Definition at line 410 of file BreakableToken.cpp.
References clang::format::BreakableToken::IndentLevel, clang::format::BreakableToken::InPPDirective, clang::format::WhitespaceManager::replaceWhitespaceInToken(), clang::format::BreakableToken::Tok, and clang::format::FormatToken::TokenText.