class TokenRole

Declaration

class TokenRole { /* full declaration omitted */ };

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

Member Variables

protected const clang::format::FormatStyle& Style

Method Overview

  • public virtual void CommaFound(const clang::format::FormatToken * Token)
  • public TokenRole(const clang::format::FormatStyle & Style)
  • public virtual unsigned int formatAfterToken(clang::format::LineState & State, clang::format::ContinuationIndenter * Indenter, bool DryRun)
  • public virtual unsigned int formatFromToken(clang::format::LineState & State, clang::format::ContinuationIndenter * Indenter, bool DryRun)
  • public virtual const clang::format::FormatToken * lastComma()
  • public virtual void precomputeFormattingInfos(const clang::format::FormatToken * Token)
  • public virtual ~TokenRole()

Methods

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

Description

Notifies the \c Role that a comma was found.

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

Parameters

const clang::format::FormatToken* Token

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

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

Parameters

const clang::format::FormatStyle& Style

virtual 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:819

Parameters

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

virtual 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:811

Parameters

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

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

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

virtual 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:803

Parameters

const clang::format::FormatToken* Token

virtual ~TokenRole()

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