class CommaSeparatedList

Declaration

class CommaSeparatedList : public TokenRole { /* full declaration omitted */ };

Declared at: clang/lib/Format/FormatToken.h:834

Inherits from: TokenRole

Member Variables

private SmallVector<const clang::format::FormatToken*, 8> Commas
The ordered \c FormatTokens making up the commas of this list.
private SmallVector<unsigned int, 8> ItemLengths
The length of each of the list's items in characters including the trailing comma.
private SmallVector<clang::format::CommaSeparatedList:: ColumnFormat, 4> Formats
Precomputed formats that can be used for this list.
private bool HasNestedBracedList

Inherited from TokenRole:

protected Style

Method Overview

  • public void CommaFound(const clang::format::FormatToken * Token)
  • public CommaSeparatedList(const clang::format::FormatStyle & Style)
  • public unsigned int formatAfterToken(clang::format::LineState & State, clang::format::ContinuationIndenter * Indenter, bool DryRun)
  • public unsigned int formatFromToken(clang::format::LineState & State, clang::format::ContinuationIndenter * Indenter, bool DryRun)
  • private const clang::format::CommaSeparatedList::ColumnFormat * getColumnFormat(unsigned int RemainingCharacters) const
  • public const clang::format::FormatToken * lastComma()
  • public void precomputeFormattingInfos(const clang::format::FormatToken * Token)

Inherited from TokenRole:

Methods

void CommaFound(
    const clang::format::FormatToken* Token)

Description

Adds \p Token as the next comma to the \c CommaSeparated list.

Declared at: clang/lib/Format/FormatToken.h:848

Parameters

const clang::format::FormatToken* Token

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

Declared at: clang/lib/Format/FormatToken.h:836

Parameters

const clang::format::FormatStyle& Style

unsigned int formatAfterToken(
    clang::format::LineState& State,
    clang::format::ContinuationIndenter* Indenter,
    bool DryRun)

Description

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

Declared at: clang/lib/Format/FormatToken.h:841

Parameters

clang::format::LineState& State
clang::format::ContinuationIndenter* Indenter
bool DryRun

unsigned int formatFromToken(
    clang::format::LineState& State,
    clang::format::ContinuationIndenter* Indenter,
    bool DryRun)

Description

Apply the special formatting that the given role demands. Assumes that the token having this role is already formatted. Continues formatting from \p State leaving indentation to \p Indenter and returns the total penalty that this formatting incurs.

Declared at: clang/lib/Format/FormatToken.h:844

Parameters

clang::format::LineState& State
clang::format::ContinuationIndenter* Indenter
bool DryRun

const clang::format::CommaSeparatedList::
    ColumnFormat*
    getColumnFormat(
        unsigned int RemainingCharacters) const

Description

Calculate which \c ColumnFormat fits best into\p RemainingCharacters.

Declared at: clang/lib/Format/FormatToken.h:877

Parameters

unsigned int RemainingCharacters

const clang::format::FormatToken* lastComma()

Declared at: clang/lib/Format/FormatToken.h:852

void precomputeFormattingInfos(
    const clang::format::FormatToken* Token)

Description

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

Declared at: clang/lib/Format/FormatToken.h:839

Parameters

const clang::format::FormatToken* Token