Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
|
Represents a comment. More...
#include <qqmldomcomments_p.h>
Public Types | |
enum | CommentType { Pre , Post } |
Public Member Functions | |
DomType | kind () const |
Comment (const QString &c, const QQmlJS::SourceLocation &loc, int newlinesBefore=1, CommentType type=Pre) | |
Comment (QStringView c, const QQmlJS::SourceLocation &loc, int newlinesBefore=1, CommentType type=Pre) | |
bool | iterateDirectSubpaths (const DomItem &self, DirectVisitor visitor) const |
Expose attributes to the Dom. | |
int | newlinesBefore () const |
void | setNewlinesBefore (int n) |
QStringView | rawComment () const |
CommentInfo | info () const |
void | write (OutWriter &lw, SourceLocation *commentLocation=nullptr) const |
CommentType | type () const |
Static Public Attributes | |
static constexpr DomType | kindValue = DomType::Comment |
Friends | |
bool | operator== (const Comment &c1, const Comment &c2) |
bool | operator!= (const Comment &c1, const Comment &c2) |
Represents a comment.
Comments are not needed for execute the program, so they are aimed to the programmer, and have few functions: explaining code, adding extra info/context (who did write, when licensing,...) or disabling code. Being for the programmer and being non functional it is difficult to treat them properly. So preserving them as much as possible is the best course of action.
To acheive this comment is represented by \list
the comments are stored with the whitespace surrounding them, from the preceding newline (and recording if a newline is required before it) until the newline after.
A comment has methods to write it out again (write) and expose it to the Dom (iterateDirectSubpaths).
Definition at line 75 of file qqmldomcomments_p.h.
Enumerator | |
---|---|
Pre | |
Post |
Definition at line 81 of file qqmldomcomments_p.h.
|
inline |
Definition at line 83 of file qqmldomcomments_p.h.
|
inline |
Definition at line 88 of file qqmldomcomments_p.h.
|
inline |
Definition at line 98 of file qqmldomcomments_p.h.
Referenced by write().
bool QQmlJS::Dom::Comment::iterateDirectSubpaths | ( | const DomItem & | self, |
DirectVisitor | visitor ) const |
Expose attributes to the Dom.
Definition at line 200 of file qqmldomcomments.cpp.
References newlinesBefore(), and rawComment().
|
inline |
Definition at line 79 of file qqmldomcomments_p.h.
|
inline |
Definition at line 95 of file qqmldomcomments_p.h.
Referenced by iterateDirectSubpaths(), and write().
|
inline |
Definition at line 97 of file qqmldomcomments_p.h.
Referenced by iterateDirectSubpaths().
|
inline |
Definition at line 96 of file qqmldomcomments_p.h.
|
inline |
Definition at line 101 of file qqmldomcomments_p.h.
Referenced by QQmlJS::Dom::CommentedElement::addComment(), and QQmlJS::Dom::RegionComments::addComment().
void QQmlJS::Dom::Comment::write | ( | OutWriter & | lw, |
SourceLocation * | commentLocation = nullptr ) const |
Definition at line 208 of file qqmldomcomments.cpp.
References QQmlJS::Dom::LineWriter::endSourceLocation(), QQmlJS::Dom::OutWriter::ensureNewline(), QQmlJS::Dom::OutWriter::ensureSpace(), QQmlJS::Dom::OutWriter::indentNextlines, info(), QQmlJS::Dom::OutWriter::lineWriter, newlinesBefore(), QQmlJS::Dom::LineWriter::startSourceLocation(), and QQmlJS::Dom::OutWriter::write().
Definition at line 107 of file qqmldomcomments_p.h.
Definition at line 103 of file qqmldomcomments_p.h.
|
staticconstexpr |
Definition at line 78 of file qqmldomcomments_p.h.