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. | |
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 14 of file location.h.
Location::Location | ( | ) |
Constructs an empty location.
Definition at line 40 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 49 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 59 of file location.cpp.
References Location(), and operator=().
Referenced by Location().
|
inline |
Definition at line 20 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 111 of file location.cpp.
|
inline |
Definition at line 26 of file location.h.
|
inlinenodiscard |
Returns the current column number.
Must not be called on an empty Location object.
Definition at line 44 of file location.h.
Referenced by Doc::trimCStyleComment().
|
inlinenodiscard |
Definition at line 39 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 232 of file location.cpp.
|
inlinenodiscard |
Definition at line 45 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 244 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 263 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 185 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 40 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 195 of file location.cpp.
Prints message to stdout
followed by a {'
'}.
Definition at line 333 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 297 of file location.cpp.
References Config::singleExec().
Referenced by processQdocconfFile().
Report a program bug, including the hint.
Definition at line 342 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 38 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 43 of file location.h.
The assignment operator does a deep copy of the entire state of other into this Location.
Definition at line 69 of file location.cpp.
Referenced by Location().
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 149 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 129 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 282 of file location.cpp.
|
inline |
Definition at line 36 of file location.h.
Referenced by fromCXSourceLocation().
|
inline |
Definition at line 34 of file location.h.
Referenced by toString().
|
inline |
Definition at line 35 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 95 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 324 of file location.cpp.
Referenced by processQdocconfFile().
|
nodiscard |
Converts the location to a string to be prepended to error messages.
Definition at line 393 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 220 of file location.cpp.
|
friend |
Definition at line 57 of file location.h.