![]() |
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 a formatted report message. | |
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 int | exitCode () |
| Returns the error code QDoc should exit with; EXIT_SUCCESS or the number of documentation warnings if they exceeded the limit set by warninglimit configuration variable. | |
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 46 of file location.cpp.
Referenced by TagFileWriter::generateTagFile(), Tokenizer::initialize(), Generator::initializeFormat(), internalError(), and loadIndexFiles().
|
explicit |
Constructs a location with (fileName, 1, 1) on its file position stack.
Definition at line 55 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 65 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 148 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 269 of file location.cpp.
|
inlinenodiscard |
Definition at line 52 of file location.h.
|
static |
Returns the error code QDoc should exit with; EXIT_SUCCESS or the number of documentation warnings if they exceeded the limit set by warninglimit configuration variable.
Definition at line 281 of file location.cpp.
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 300 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 222 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 232 of file location.cpp.
Prints message to stdout followed by a {'
'}.
Definition at line 494 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 334 of file location.cpp.
References Config::singleExec().
Referenced by processQdocconfFile().
Report a program bug, including the hint.
Definition at line 503 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().
|
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 122 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 75 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 104 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 186 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 166 of file location.cpp.
Writes message and details to stderr as a formatted report message.
A report does not include any filename/line number information. Recurring reports with an identical message are ignored.
A report is generated only in generate or {single-exec} phase. In {prepare} phase, this function does nothing.
Definition at line 319 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 132 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 482 of file location.cpp.
Referenced by processQdocconfFile().
|
nodiscard |
Converts the location to a string to be prepended to error messages.
Definition at line 566 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.
Definition at line 257 of file location.cpp.
|
friend |
Definition at line 64 of file location.h.