7#include <QtCore/QCborMap>
8#include <QtCore/QMutex>
9#include <QtCore/QMutexLocker>
154 && (
res.location.startLine != 0 ||
res.location.startColumn != 0)) {
155 res.location.offset = -1;
156 res.location.length = 1;
172 if (
c == QChar::fromLatin1(
'\n') ||
c == QChar::fromLatin1(
'\r') || (
c >= QChar::fromLatin1(
' ') &&
c <= QChar::fromLatin1(
'~')))
173 buf[ibuf++] =
c.toLatin1();
179 if (!canonicalFilePath.
isEmpty()) {
180 sink(canonicalFilePath);
241 auto &g1 = o1.groups;
242 auto &g2 = o2.groups;
243 if (g1.size() < g2.size())
245 if (g1.size() < g2.size())
247 for (
int i = 0;
i < g1.size(); ++
i) {
248 int c = std::strcmp(g1.at(
i).groupId().data(), g2.at(
i).groupId().data());
260 , errorGroups(errorGroups)
263 ,
file(canonicalFilePath)
266 if (
level == Level::Fatal)
275 , errorGroups(errorGroups)
278 ,
file(canonicalFilePath)
281 if (
level == Level::Fatal)
315static QHash<QLatin1String, StorableMsg> &
registry()
317 static QHash<QLatin1String, StorableMsg>
r;
328 bool doubleRegister =
false;
333 if (
r.contains(err.errorId)) {
334 old =
r[err.errorId].
msg;
335 doubleRegister =
true;
346 QHash<QLatin1String, StorableMsg>
r;
362 s(u
"Unregistered error ");
408 if (
path.length() == 0)
409 path =
el.canonicalPath();
411 file =
el.canonicalFilePath();
450 if (
path.length()>0) {
550#include "moc_qqmldomerrormessage_p.cpp"
\inmodule QtCore\reentrant
void append(const QCborValue &value)
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
constexpr bool isEmpty() const noexcept
A Sink is a function that accepts a QStringView as input.
QLatin1String groupId() const
void dumpId(const Sink &sink) const
QString groupName() const
void dump(const Sink &sink) const
Represents a set of tags grouping a set of related error messages.
ErrorMessage error(const QString &message) const
void dump(const Sink &sink) const
static int cmp(const ErrorGroups &g1, const ErrorGroups &g2)
ErrorMessage debug(const QString &message) const
void dumpId(const Sink &sink) const
ErrorMessage info(const QString &message) const
ErrorMessage warning(const QString &message) const
ErrorMessage errorMessage(const Dumper &msg, ErrorLevel level, const Path &element=Path(), const QString &canonicalFilePath=QString(), SourceLocation location=SourceLocation()) const
void fatal(const Dumper &msg, const Path &element=Path(), QStringView canonicalFilePath=u"", SourceLocation location=SourceLocation()) const
QCborArray toCbor() const
Represents an error message connected to the dom.
ErrorMessage & withPath(const Path &)
ErrorMessage & withErrorId(QLatin1String errorId)
ErrorMessage & withLocation(SourceLocation)
ErrorMessage handle(const ErrorHandler &errorHandler=nullptr)
static QLatin1String msg(const char *errorId, ErrorMessage &&err)
ErrorMessage & withFile(const QString &)
ErrorMessage & withItem(const DomItem &)
ErrorMessage(const QString &message, const ErrorGroups &errorGroups, Level level=Level::Warning, const Path &path=Path(), const QString &file=QString(), SourceLocation location=SourceLocation(), QLatin1String errorId=QLatin1String(""))
void dump(const Sink &s) const
static ErrorMessage load(QLatin1String errorId)
static void visitRegisteredMessages(function_ref< bool(const ErrorMessage &)> visitor)
static QQmlJS::SourceLocation region(const Tree &fLoc, FileLocationRegion region)
std::shared_ptr< AttachedInfoT< FileLocations > > Tree
static FileLocations::Tree treeOf(const DomItem &)
void dump(const Sink &sink) const
const_iterator cbegin() const noexcept
constexpr bool isEmpty() const noexcept
Returns whether this string view is empty - that is, whether {size() == 0}.
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
QSet< QString >::iterator it
void dumpErrorLevel(const Sink &s, ErrorLevel level)
Dumps a string describing the given error level (ErrorLevel::Error -> Error,...)
static QHash< QLatin1String, StorableMsg > & registry()
void sinkInt(const Sink &s, T i)
void silentError(const ErrorMessage &)
Error handler that ignores all errors (excluding fatal ones)
void errorToQDebug(const ErrorMessage &error)
writes an ErrorMessage to QDebug
ErrorLevel errorLevelFromQtMsgType(QtMsgType msgType)
static ErrorGroups myErrors()
void defaultErrorHandler(const ErrorMessage &error)
Calls the default error handler (by default errorToQDebug)
void setDefaultErrorHandler(const ErrorHandler &h)
Sets the default error handler.
void errorHandlerHandler(const ErrorMessage &msg, const ErrorHandler *h=nullptr)
QString dumperToString(const Dumper &writer)
Converts a dumper to a string.
void dumperToQDebug(const Dumper &dumper, QDebug debug)
std::function< void(const ErrorMessage &)> ErrorHandler
static QBasicMutex * registryMutex()
Combined button and popup list for selecting options.
DBusConnection const char DBusError * error
#define Q_LOGGING_CATEGORY(name,...)
GLenum GLuint GLint level
GLenum GLuint GLenum GLsizei const GLchar * buf
GLuint GLsizei const GLchar * message
GLfloat GLfloat GLfloat GLfloat h
GLsizei const GLchar *const * path
GLsizei GLenum GLboolean sink
#define NewErrorGroup(name)
QDebug warning(QAnyStringView fileName, int lineNumber)
QLatin1StringView QLatin1String
#define QStringLiteral(str)
StorableMsg(ErrorMessage &&e)
StorableMsg(const ErrorMessage &e)