clang API Documentation
#include <BreakableToken.h>
Public Member Functions | |
BreakableLineComment (const FormatToken &Token, unsigned IndentLevel, unsigned StartColumn, bool InPPDirective, encoding::Encoding Encoding, const FormatStyle &Style) | |
Creates a breakable token for a line comment. | |
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 133 of file BreakableToken.h.
clang::format::BreakableLineComment::BreakableLineComment | ( | const FormatToken & | Token, |
unsigned | IndentLevel, | ||
unsigned | StartColumn, | ||
bool | InPPDirective, | ||
encoding::Encoding | Encoding, | ||
const FormatStyle & | Style | ||
) |
Creates a breakable token for a line comment.
StartColumn
specifies the column in which the comment will start after formatting.
Definition at line 200 of file BreakableToken.cpp.
References clang::isAlphanumeric(), clang::format::BreakableSingleLineToken::Prefix, and clang::format::FormatToken::TokenText.
BreakableToken::Split clang::format::BreakableLineComment::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 217 of file BreakableToken.cpp.
References clang::format::BreakableToken::Encoding, clang::format::getCommentSplit(), clang::format::BreakableSingleLineToken::Line, clang::format::BreakableSingleLineToken::Prefix, clang::format::BreakableSingleLineToken::StartColumn, clang::format::BreakableToken::Style, and clang::format::FormatStyle::TabWidth.
void clang::format::BreakableLineComment::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 223 of file BreakableToken.cpp.
References clang::format::BreakableToken::IndentLevel, clang::format::BreakableToken::InPPDirective, clang::format::BreakableSingleLineToken::Postfix, clang::format::BreakableSingleLineToken::Prefix, clang::format::WhitespaceManager::replaceWhitespaceInToken(), clang::format::BreakableSingleLineToken::StartColumn, and clang::format::BreakableToken::Tok.
void clang::format::BreakableLineComment::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 231 of file BreakableToken.cpp.
References clang::format::WhitespaceManager::replaceWhitespaceInToken(), and clang::format::BreakableToken::Tok.
void clang::format::BreakableLineComment::replaceWhitespaceBefore | ( | unsigned | LineIndex, |
WhitespaceManager & | Whitespaces | ||
) | [override, virtual] |
Replaces the whitespace between LineIndex-1
and LineIndex
.
Reimplemented from clang::format::BreakableToken.
Definition at line 241 of file BreakableToken.cpp.
References clang::format::BreakableSingleLineToken::Prefix, clang::format::WhitespaceManager::replaceWhitespaceInToken(), and clang::format::BreakableToken::Tok.