clang 17.0.0git
Public Member Functions | Protected Attributes | List of all members
clang::format::TokenRole Class Reference

#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/Format/FormatToken.h"

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

Public Member Functions

 TokenRole (const FormatStyle &Style)
 
virtual ~TokenRole ()
 
virtual void precomputeFormattingInfos (const FormatToken *Token)
 After the TokenAnnotator has finished annotating all the tokens, this function precomputes required information for formatting.
 
virtual unsigned formatFromToken (LineState &State, ContinuationIndenter *Indenter, bool DryRun)
 Apply the special formatting that the given role demands.
 
virtual unsigned formatAfterToken (LineState &State, ContinuationIndenter *Indenter, bool DryRun)
 Same as formatFromToken, but assumes that the first token has already been set thereby deciding on the first line break.
 
virtual void CommaFound (const FormatToken *Token)
 Notifies the Role that a comma was found.
 
virtual const FormatTokenlastComma ()
 

Protected Attributes

const FormatStyleStyle
 

Detailed Description

Definition at line 837 of file FormatToken.h.

Constructor & Destructor Documentation

◆ TokenRole()

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

Definition at line 839 of file FormatToken.h.

References precomputeFormattingInfos(), Style, and ~TokenRole().

◆ ~TokenRole()

clang::format::TokenRole::~TokenRole ( )
virtual

Definition at line 92 of file FormatToken.cpp.

Referenced by TokenRole().

Member Function Documentation

◆ CommaFound()

virtual void clang::format::TokenRole::CommaFound ( const FormatToken Token)
inlinevirtual

Notifies the Role that a comma was found.

Reimplemented in clang::format::CommaSeparatedList.

Definition at line 867 of file FormatToken.h.

◆ formatAfterToken()

virtual unsigned clang::format::TokenRole::formatAfterToken ( LineState State,
ContinuationIndenter Indenter,
bool  DryRun 
)
inlinevirtual

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

Reimplemented in clang::format::CommaSeparatedList.

Definition at line 860 of file FormatToken.h.

◆ formatFromToken()

virtual unsigned clang::format::TokenRole::formatFromToken ( LineState State,
ContinuationIndenter Indenter,
bool  DryRun 
)
inlinevirtual

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 in clang::format::CommaSeparatedList.

Definition at line 852 of file FormatToken.h.

◆ lastComma()

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

Reimplemented in clang::format::CommaSeparatedList.

Definition at line 869 of file FormatToken.h.

◆ precomputeFormattingInfos()

void clang::format::TokenRole::precomputeFormattingInfos ( const FormatToken Token)
virtual

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

Reimplemented in clang::format::CommaSeparatedList.

Definition at line 94 of file FormatToken.cpp.

Referenced by TokenRole().

Member Data Documentation

◆ Style

const FormatStyle& clang::format::TokenRole::Style
protected

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