clang 10.0.0git

Classes | Public Member Functions | List of all members
clang::format::CommaSeparatedList Class Reference

`#include "/work/www-prereleases/10.0.0/rc1/docsbuild/clang/lib/Format/FormatToken.h"`

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

## Public Member Functions
| CommaSeparatedList (const FormatStyle &Style)
void | precomputeFormattingInfos (const FormatToken *Token) override
| After the `TokenAnnotator` has finished annotating all the tokens, this function precomputes required information for formatting. More...
unsigned | formatAfterToken (LineState &State, ContinuationIndenter *Indenter, bool DryRun) override
| Same as `formatFromToken`, but assumes that the first token has already been set thereby deciding on the first line break. More...
unsigned | formatFromToken (LineState &State, ContinuationIndenter *Indenter, bool DryRun) override
| Apply the special formatting that the given role demands. More...
void | CommaFound (const FormatToken *Token) override
| Adds `Token` as the next comma to the `CommaSeparated` list. More...
const FormatToken * | lastComma () override
Public Member Functions inherited from clang::format::TokenRole
| TokenRole (const FormatStyle &Style)
virtual | ~TokenRole ()

## Additional Inherited Members
Protected Attributes inherited from clang::format::TokenRole
const FormatStyle & | Style

## Detailed Description

Definition at line 625 of file FormatToken.h.

## Constructor & Destructor Documentation

## ◆ CommaSeparatedList()

clang::format::CommaSeparatedList::CommaSeparatedList | ( | const FormatStyle & | Style | ) |
| inline

Definition at line 627 of file FormatToken.h.

References Indenter, and State.

## Member Function Documentation

## ◆ CommaFound()

void clang::format::CommaSeparatedList::CommaFound | ( | const FormatToken * | Token | ) |
| inline override virtual

Adds `Token` as the next comma to the `CommaSeparated` list.

Reimplemented from clang::format::TokenRole.

Definition at line 639 of file FormatToken.h.

## ◆ formatAfterToken()

unsigned clang::format::CommaSeparatedList::formatAfterToken | ( | LineState & | State,
|  | ContinuationIndenter * | Indenter,
|  | bool | DryRun
| ) |  |
| override virtual

Same as `formatFromToken`, but assumes that the first token has already been set thereby deciding on the first line break.

Reimplemented from clang::format::TokenRole.

Definition at line 74 of file FormatToken.cpp.

References clang::format::ContinuationIndenter::addTokenToState(), clang::format::BK_Block, clang::format::FormatToken::BlockKind, clang::format::LineState::Column, clang::format::FormatToken::ColumnWidth, clang::format::FormatToken::getPreviousNonComment(), clang::format::FormatToken::isOneOf(), clang::format::FormatToken::isTrailingComment(), clang::format::FormatToken::MatchingParen, clang::format::FormatToken::MustBreakBefore, NewLine, clang::format::FormatToken::Next, clang::format::LineState::NextToken, clang::format::FormatToken::Previous, clang::format::Style, and clang::format::FormatToken::Type.

## ◆ formatFromToken()

unsigned clang::format::CommaSeparatedList::formatFromToken | ( | LineState & | State,
|  | ContinuationIndenter * | Indenter,
|  | bool | DryRun
| ) |  |
| override virtual

Apply the special formatting that the given role demands.

Assumes that the token having this role is already formatted.

Continues formatting from `State` leaving indentation to `Indenter` and returns the total penalty that this formatting incurs.

Reimplemented from clang::format::TokenRole.

Definition at line 133 of file FormatToken.cpp.

References clang::format::LineState::Stack.

## ◆ lastComma()

const FormatToken* clang::format::CommaSeparatedList::lastComma | ( |  | ) |
| inline override virtual

Reimplemented from clang::format::TokenRole.

Definition at line 643 of file FormatToken.h.

## ◆ precomputeFormattingInfos()

void clang::format::CommaSeparatedList::precomputeFormattingInfos | ( | const FormatToken * | Token | ) |
| override virtual

After the `TokenAnnotator` has finished annotating all the tokens, this function precomputes required information for formatting.

Reimplemented from clang::format::TokenRole.

Definition at line 151 of file FormatToken.cpp.

References clang::format::FormatStyle::AlignAfterOpenBracket, clang::format::FormatStyle::BAS_DontAlign, clang::format::FormatToken::CanBreakBefore, clang::format::CodePointsBetween(), clang::for(), clang::format::FormatToken::getNextNonComment(), clang::format::FormatToken::getPreviousNonComment(), clang::format::FormatToken::HasUnescapedNewline, clang::if(), clang::format::FormatToken::is(), clang::format::FormatToken::isOneOf(), clang::format::FormatToken::isTrailingComment(), clang::format::FormatToken::MatchingParen, max(), min(), clang::format::FormatToken::MustBreakBefore, clang::format::FormatToken::NestingLevel, clang::format::FormatToken::Next, clang::format::FormatToken::Previous, clang::format::Style, and UINT_MAX.

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

- lib/Format/FormatToken.h
- lib/Format/FormatToken.cpp