![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
The Location class provides a way to mark a location in a file. More...
#include <location.h>
Public Member Functions | |
| Location () | |
| Constructs an empty location. | |
| Location (const QString &filePath) | |
| Constructs a location with (fileName, 1, 1) on its file position stack. | |
| Location (const Location &other) | |
| The copy constructor copies the contents of other into this Location using the assignment operator. | |
| ~Location () | |
| Location & | operator= (const Location &other) |
| The assignment operator does a deep copy of the entire state of other into this Location. | |
| bool | operator== (const Location &other) const |
Returns true if this instance points to the same location as other. | |
| bool | operator!= (const Location &other) const |
Returns true if this instance does not point to the same location as other. | |
| void | start () |
| If the file position on top of the stack has a line number less than 1, set its line number to 1 and its column number to 1. | |
| void | advance (QChar ch) |
| Advance the current file position, using ch to decide how to do that. | |
| void | advanceLines (int n) |
| void | push (const QString &filePath) |
| Pushes filePath onto the file position stack. | |
| void | pop () |
| Pops the top of the internal stack. | |
| void | setEtc (bool etc) |
| void | setLineNo (int no) |
| void | setColumnNo (int no) |
| bool | isEmpty () const |
Returns true if there is no file name set yet; returns false otherwise. | |
| int | depth () const |
| const QString & | filePath () const |
| Returns the current path and file name. | |
| QString | fileName () const |
| Returns the file name part of the file path, ie the current file. | |
| QString | fileSuffix () const |
| Returns the suffix of the file name. | |
| int | lineNo () const |
| Returns the current line number. | |
| int | columnNo () const |
| Returns the current column number. | |
| bool | etc () const |
| QString | toString () const |
| Converts the location to a string to be prepended to error messages. | |
| void | warning (const QString &message, const QString &details=QString()) const |
| Writes message and details to stderr as a formatted warning message. | |
| void | error (const QString &message, const QString &details=QString()) const |
| Writes message and details to stderr as a formatted error message. | |
| void | fatal (const QString &message, const QString &details=QString()) const |
| Writes message and details to stderr as a formatted error message and then exits the program. | |
| void | report (const QString &message, const QString &details=QString()) const |
Writes message and details to {stderr} as an informational report. | |
Static Public Member Functions | |
| static void | initialize () |
| Gets several parameters from the config, including tab size, program name, and a regular expression that appears to be used for matching certain error messages so that emitMessage() can avoid printing them. | |
| static void | terminate () |
| Apparently, all this does is delete the regular expression used for intercepting certain error messages that should not be emitted by emitMessage(). | |
| static void | information (const QString &message) |
Prints message to stdout followed by a {''}. | |
| static void | internalError (const QString &hint) |
| Report a program bug, including the hint. | |
| static void | increaseErrorCount () |
| Records a failure that must make the process exit non-zero, independently of the warning limit. | |
| static int | exitCode () |
| Returns the error code QDoc should exit with. | |
Friends | |
| class | QTypeInfo< StackEntry > |
The Location class provides a way to mark a location in a file.
It maintains a stack of file positions. A file position consists of the file path, line number, and column number. The location is used for printing error messages that are tied to a location in a file.
Definition at line 19 of file location.h.
| Location::Location | ( | ) |
Constructs an empty location.
Definition at line 50 of file location.cpp.
Referenced by FileDocumentWriter::beginDocument(), FileDocumentWriter::discardDocument(), exitCode(), OutputContext::fromConfig(), ManifestWriter::generateExampleManifestFile(), generateIndexFile(), TagFileWriter::generateTagFile(), TOCWriter::generateTOC(), Tokenizer::initialize(), Generator::initializeFormat(), internalError(), and loadIndexFiles().
|
explicit |
Constructs a location with (fileName, 1, 1) on its file position stack.
Definition at line 59 of file location.cpp.
References Location().
Referenced by Location().
| Location::Location | ( | const Location & | other | ) |
The copy constructor copies the contents of other into this Location using the assignment operator.
Definition at line 69 of file location.cpp.
References Location(), and operator=().
Referenced by Location().
|
inline |
Definition at line 25 of file location.h.
Advance the current file position, using ch to decide how to do that.
If ch is a {'\n'}, increment the current line number and set the column number to 1. If \ch is a {'\t'}, increment to the next tab column. Otherwise, increment the column number by 1.
The current file position is the one on top of the position stack.
Definition at line 152 of file location.cpp.
|
inline |
Definition at line 33 of file location.h.
|
inlinenodiscard |
Returns the current column number.
Must not be called on an empty Location object.
Definition at line 51 of file location.h.
Referenced by Doc::trimCStyleComment().
|
inlinenodiscard |
Definition at line 46 of file location.h.
Writes message and details to stderr as a formatted error message.
Does not write the message if qdoc is in the Prepare phase.
Definition at line 278 of file location.cpp.
|
inlinenodiscard |
Definition at line 52 of file location.h.
|
static |
Returns the error code QDoc should exit with.
A recorded failure takes precedence over the warning limit.
Definition at line 298 of file location.cpp.
References Location().
Referenced by main().
Writes message and details to stderr as a formatted error message and then exits the program.
qdoc prints fatal errors in either phase (Prepare or Generate).
Definition at line 319 of file location.cpp.
|
nodiscard |
Returns the file name part of the file path, ie the current file.
Returns an empty string if the file path is empty.
Definition at line 226 of file location.cpp.
|
inlinenodiscard |
Returns the current path and file name.
If the Location is empty, the returned string is null.
Definition at line 47 of file location.h.
|
nodiscard |
Returns the suffix of the file name.
Returns an empty string if the file path is empty.
Definition at line 236 of file location.cpp.
|
static |
Records a failure that must make the process exit non-zero, independently of the warning limit.
The count persists across qdocconf files in one run.
Definition at line 289 of file location.cpp.
Prints message to stdout followed by a {'
'}.
Definition at line 524 of file location.cpp.
|
static |
Gets several parameters from the config, including tab size, program name, and a regular expression that appears to be used for matching certain error messages so that emitMessage() can avoid printing them.
Definition at line 363 of file location.cpp.
References Config::singleExec().
Referenced by processQdocconfFile().
Report a program bug, including the hint.
Definition at line 533 of file location.cpp.
References Location().
|
inlinenodiscard |
Returns true if there is no file name set yet; returns false otherwise.
The functions filePath(), lineNo() and columnNo() must not be called on an empty Location object.
Definition at line 45 of file location.h.
Referenced by toString(), and warnAboutDocumentedChildInUndocumentedParent().
|
inlinenodiscard |
Returns the current line number.
Must not be called on an empty Location object.
Definition at line 50 of file location.h.
Referenced by Node< _Tp >::nodeLessThan(), and operator==().
| bool Location::operator!= | ( | const Location & | other | ) | const |
Returns true if this instance does not point to the same location as other.
Definition at line 126 of file location.cpp.
References operator==().
The assignment operator does a deep copy of the entire state of other into this Location.
Definition at line 79 of file location.cpp.
Referenced by Location().
| bool Location::operator== | ( | const Location & | other | ) | const |
Returns true if this instance points to the same location as other.
Two locations are considered equal if both the filePath() and lineNo() are equal, regardless of stack depth.
Definition at line 108 of file location.cpp.
References lineNo().
Referenced by operator!=().
| void Location::pop | ( | ) |
Pops the top of the internal stack.
The current file position becomes the next one in the new top of stack.
Definition at line 190 of file location.cpp.
Referenced by toString().
Pushes filePath onto the file position stack.
The current file position becomes (filePath, 1, 1).
Definition at line 170 of file location.cpp.
Writes message and details to {stderr} as an informational report.
Includes the project name and, when available, the file name and line number.
Suppresses repeated messages at the same file and line during a QDoc run. Reports without a source location are deduplicated separately by message.
Emits reports only in the generate or {single-exec} phase. Reports do not count toward the warning limit or affect the exit code.
Definition at line 341 of file location.cpp.
|
inline |
Definition at line 43 of file location.h.
Referenced by fromCXSourceLocation().
|
inline |
Definition at line 41 of file location.h.
Referenced by toString().
|
inline |
Definition at line 42 of file location.h.
Referenced by fromCXSourceLocation().
| void Location::start | ( | ) |
If the file position on top of the stack has a line number less than 1, set its line number to 1 and its column number to 1.
Otherwise, do nothing.
Definition at line 136 of file location.cpp.
|
static |
Apparently, all this does is delete the regular expression used for intercepting certain error messages that should not be emitted by emitMessage().
Definition at line 510 of file location.cpp.
Referenced by processQdocconfFile().
|
nodiscard |
Converts the location to a string to be prepended to error messages.
Definition at line 612 of file location.cpp.
References isEmpty(), pop(), and setEtc().
Writes message and details to stderr as a formatted warning message.
Does not write the message if qdoc is in the Prepare phase.
A warning whose source location (including the include stack), project, message, and details are all identical to one already reported in this project run is not emitted again. The warning is thereby logged and counted only once.
Definition at line 266 of file location.cpp.
|
friend |
Definition at line 65 of file location.h.