clang API Documentation

Public Member Functions | Protected Member Functions | Protected Attributes
clang::format::BreakableSingleLineToken Class Reference

Base class for single line tokens that can be broken. More...

#include <BreakableToken.h>

Inheritance diagram for clang::format::BreakableSingleLineToken:
Inheritance graph
[legend]
Collaboration diagram for clang::format::BreakableSingleLineToken:
Collaboration graph
[legend]

List of all members.

Public Member Functions

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.

Protected Member Functions

 BreakableSingleLineToken (const FormatToken &Tok, unsigned IndentLevel, unsigned StartColumn, StringRef Prefix, StringRef Postfix, bool InPPDirective, encoding::Encoding Encoding, const FormatStyle &Style)

Protected Attributes

unsigned StartColumn
StringRef Prefix
StringRef Postfix
StringRef Line

Detailed Description

Base class for single line tokens that can be broken.

getSplit() needs to be implemented by child classes.

Definition at line 91 of file BreakableToken.h.


Constructor & Destructor Documentation

clang::format::BreakableSingleLineToken::BreakableSingleLineToken ( const FormatToken Tok,
unsigned  IndentLevel,
unsigned  StartColumn,
StringRef  Prefix,
StringRef  Postfix,
bool  InPPDirective,
encoding::Encoding  Encoding,
const FormatStyle Style 
) [protected]

Definition at line 144 of file BreakableToken.cpp.

References Line, and clang::format::FormatToken::TokenText.


Member Function Documentation

Returns the number of lines in this token in the original code.

Implements clang::format::BreakableToken.

Definition at line 134 of file BreakableToken.cpp.

unsigned clang::format::BreakableSingleLineToken::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 136 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.


Member Data Documentation


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