clang 22.0.0git
clang::format::IndentationAndAlignment Struct Reference

Represents the spaces at the start of a line, keeping track of what the spaces are for. More...

#include "/work/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/Format/ContinuationIndenter.h"

Public Member Functions

IndentationAndAlignment addPadding (unsigned Spaces) const
 Add spaces for right-justifying the token.
IndentationAndAlignment operator+ (unsigned Spaces) const
 Adding indentation is more common than padding. So the operator does that.
IndentationAndAlignment operator- (unsigned Spaces) const
IndentationAndAlignmentoperator+= (unsigned Spaces)
 IndentationAndAlignment (unsigned Total, unsigned IndentedFrom)
 IndentationAndAlignment (unsigned Spaces)
bool operator< (const IndentationAndAlignment &Other) const

Public Attributes

unsigned Total
unsigned IndentedFrom
 The column that the position of the start of the line is calculated from.

Detailed Description

Represents the spaces at the start of a line, keeping track of what the spaces are for.

Definition at line 48 of file ContinuationIndenter.h.

Constructor & Destructor Documentation

◆ IndentationAndAlignment() [1/2]

clang::format::IndentationAndAlignment::IndentationAndAlignment ( unsigned Total,
unsigned IndentedFrom )

Definition at line 263 of file ContinuationIndenter.cpp.

References IndentedFrom, and Total.

Referenced by addPadding(), operator+(), operator+=(), operator-(), and operator<().

◆ IndentationAndAlignment() [2/2]

clang::format::IndentationAndAlignment::IndentationAndAlignment ( unsigned Spaces)

Definition at line 267 of file ContinuationIndenter.cpp.

References IndentedFrom, and Total.

Member Function Documentation

◆ addPadding()

IndentationAndAlignment clang::format::IndentationAndAlignment::addPadding ( unsigned Spaces) const

Add spaces for right-justifying the token.

The IndentedFrom field does not change.

This example in Objective-C shows why the field should not change. The token xx is right-justified with this method to align the : symbols. The : symbols should remain aligned through the step that aligns assignments. That step uses the IndentedFrom field to tell what lines to move. Not changing the field in this method ensures that the 2 lines move together.

[x // xxxx:0 xx:0];

Definition at line 244 of file ContinuationIndenter.cpp.

References IndentationAndAlignment(), IndentedFrom, and Total.

◆ operator+()

IndentationAndAlignment clang::format::IndentationAndAlignment::operator+ ( unsigned Spaces) const

Adding indentation is more common than padding. So the operator does that.

Definition at line 249 of file ContinuationIndenter.cpp.

References IndentationAndAlignment(), and Total.

◆ operator+=()

IndentationAndAlignment & clang::format::IndentationAndAlignment::operator+= ( unsigned Spaces)

Definition at line 258 of file ContinuationIndenter.cpp.

References IndentationAndAlignment().

◆ operator-()

IndentationAndAlignment clang::format::IndentationAndAlignment::operator- ( unsigned Spaces) const

Definition at line 254 of file ContinuationIndenter.cpp.

References IndentationAndAlignment(), and Total.

◆ operator<()

bool clang::format::IndentationAndAlignment::operator< ( const IndentationAndAlignment & Other) const

Member Data Documentation

◆ IndentedFrom

unsigned clang::format::IndentationAndAlignment::IndentedFrom

The column that the position of the start of the line is calculated from.

It can be more than Total.

Definition at line 53 of file ContinuationIndenter.h.

Referenced by addPadding(), IndentationAndAlignment(), IndentationAndAlignment(), and operator<().

◆ Total

unsigned clang::format::IndentationAndAlignment::Total

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