Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QQmlJS::Dom::CommentedElement Class Reference

Keeps the comment associated with an element. More...

#include <qqmldomcomments_p.h>

+ Collaboration diagram for QQmlJS::Dom::CommentedElement:

Public Member Functions

DomType kind () const
 
bool iterateDirectSubpaths (DomItem &self, DirectVisitor visitor)
 
void writePre (OutWriter &lw, QList< SourceLocation > *locations=nullptr) const
 
void writePost (OutWriter &lw, QList< SourceLocation > *locations=nullptr) const
 
QMultiMap< quint32, const QList< Comment > * > commentGroups (SourceLocation elLocation) const
 Given the SourceLocation of the current element returns the comments associated with the start and end of item.
 

Public Attributes

QList< CommentpreComments
 
QList< CommentpostComments
 

Static Public Attributes

static constexpr DomType kindValue = DomType::CommentedElement
 

Friends

bool operator== (const CommentedElement &c1, const CommentedElement &c2)
 
bool operator!= (const CommentedElement &c1, const CommentedElement &c2)
 

Detailed Description

Keeps the comment associated with an element.

A comment can be attached to an element (that is always a range of the file with a start and end) only in two ways: it can precede the region (preComments), or follow it (postComments).

Definition at line 104 of file qqmldomcomments_p.h.

Member Function Documentation

◆ commentGroups()

QMultiMap< quint32, const QList< Comment > * > QQmlJS::Dom::CommentedElement::commentGroups ( SourceLocation  elLocation) const

Given the SourceLocation of the current element returns the comments associated with the start and end of item.

The map uses an index that is based on 2*the location. Thus for every location l it is possible to have two indexes: 2*l (just before) and 2*l+1 (just after). This allows to attach comments to indexes representing either just before or after any location

Definition at line 273 of file qqmldomcomments.cpp.

References QQmlJS::SourceLocation::begin(), QQmlJS::SourceLocation::end(), postComments, and preComments.

+ Here is the call graph for this function:

◆ iterateDirectSubpaths()

bool QQmlJS::Dom::CommentedElement::iterateDirectSubpaths ( DomItem self,
DirectVisitor  visitor 
)

Definition at line 238 of file qqmldomcomments.cpp.

References postComments, and preComments.

◆ kind()

DomType QQmlJS::Dom::CommentedElement::kind ( ) const
inline

Definition at line 108 of file qqmldomcomments_p.h.

◆ writePost()

void QQmlJS::Dom::CommentedElement::writePost ( OutWriter lw,
QList< SourceLocation > *  locations = nullptr 
) const

Definition at line 255 of file qqmldomcomments.cpp.

References i, postComments, and QList< T >::resize().

+ Here is the call graph for this function:

◆ writePre()

void QQmlJS::Dom::CommentedElement::writePre ( OutWriter lw,
QList< SourceLocation > *  locations = nullptr 
) const

Definition at line 246 of file qqmldomcomments.cpp.

References i, preComments, and QList< T >::resize().

+ Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ operator!=

bool operator!= ( const CommentedElement c1,
const CommentedElement c2 
)
friend

Definition at line 119 of file qqmldomcomments_p.h.

◆ operator==

bool operator== ( const CommentedElement c1,
const CommentedElement c2 
)
friend

Definition at line 115 of file qqmldomcomments_p.h.

Member Data Documentation

◆ kindValue

constexpr DomType QQmlJS::Dom::CommentedElement::kindValue = DomType::CommentedElement
staticconstexpr

Definition at line 107 of file qqmldomcomments_p.h.

◆ postComments

QList<Comment> QQmlJS::Dom::CommentedElement::postComments

◆ preComments

QList<Comment> QQmlJS::Dom::CommentedElement::preComments

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