clang  3.9.0
Public Member Functions | List of all members
clang::format::BreakableLineComment Class Reference

#include <BreakableToken.h>

Inheritance diagram for clang::format::BreakableLineComment:
[legend]
Collaboration diagram for clang::format::BreakableLineComment:
[legend]

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. More...
 
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. More...
 
void insertBreak (unsigned LineIndex, unsigned TailOffset, Split Split, WhitespaceManager &Whitespaces) override
 Emits the previously retrieved Split via Whitespaces. More...
 
void replaceWhitespace (unsigned LineIndex, unsigned TailOffset, Split Split, WhitespaceManager &Whitespaces) override
 Replaces the whitespace range described by Split with a single space. More...
 
void replaceWhitespaceBefore (unsigned LineIndex, WhitespaceManager &Whitespaces) override
 Replaces the whitespace between LineIndex-1 and LineIndex. More...
 
- Public Member Functions inherited from clang::format::BreakableSingleLineToken
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 Offset with length Length. More...
 
- Public Member Functions inherited from clang::format::BreakableToken
virtual ~BreakableToken ()
 

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...
 
- Protected Member Functions inherited from clang::format::BreakableSingleLineToken
 BreakableSingleLineToken (const FormatToken &Tok, unsigned IndentLevel, 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, unsigned IndentLevel, bool InPPDirective, encoding::Encoding Encoding, const FormatStyle &Style)
 
- Protected Attributes inherited from clang::format::BreakableSingleLineToken
unsigned StartColumn
 
StringRef Prefix
 
StringRef Postfix
 
StringRef Line
 
- Protected Attributes inherited from clang::format::BreakableToken
const FormatTokenTok
 
const unsigned IndentLevel
 
const bool InPPDirective
 
const encoding::Encoding Encoding
 
const FormatStyleStyle
 

Detailed Description

Definition at line 133 of file BreakableToken.h.

Constructor & Destructor Documentation

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.

Member Function Documentation

BreakableToken::Split clang::format::BreakableLineComment::getSplit ( unsigned  LineIndex,
unsigned  TailOffset,
unsigned  ColumnLimit 
) const
overridevirtual
void clang::format::BreakableLineComment::insertBreak ( unsigned  LineIndex,
unsigned  TailOffset,
Split  Split,
WhitespaceManager Whitespaces 
)
overridevirtual
void clang::format::BreakableLineComment::replaceWhitespace ( unsigned  LineIndex,
unsigned  TailOffset,
Split  Split,
WhitespaceManager Whitespaces 
)
overridevirtual

Replaces the whitespace range described by Split with a single space.

Implements clang::format::BreakableToken.

Definition at line 233 of file BreakableToken.cpp.

References clang::format::WhitespaceManager::replaceWhitespaceInToken(), and clang::format::BreakableToken::Tok.

void clang::format::BreakableLineComment::replaceWhitespaceBefore ( unsigned  LineIndex,
WhitespaceManager Whitespaces 
)
overridevirtual

Replaces the whitespace between LineIndex-1 and LineIndex.

Reimplemented from clang::format::BreakableToken.

Definition at line 242 of file BreakableToken.cpp.

References clang::format::BreakableSingleLineToken::Prefix, clang::format::WhitespaceManager::replaceWhitespaceInToken(), and clang::format::BreakableToken::Tok.


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