#include "exceptioncontext_p.h" using namespace QtJsonSerializer; Q_LOGGING_CATEGORY(QtJsonSerializer::logExceptCtx, "qt.jsonserializer.private.exceptioncontext") QThreadStorage ExceptionContext::contextStore; ExceptionContext::ExceptionContext(const QMetaProperty &property) { contextStore.localData().push({ property.name(), property.isEnumType() ? property.enumerator().name() : property.typeName() }); } ExceptionContext::ExceptionContext(int propertyType, const QByteArray &hint) { contextStore.localData().push({ hint.isNull() ? QByteArray("") : hint, QMetaTypeName(propertyType) }); } ExceptionContext::~ExceptionContext() { auto &context = contextStore.localData(); if (context.isEmpty()) qCWarning(logExceptCtx) << "Corrupted context store"; else context.pop(); } SerializationException::PropertyTrace ExceptionContext::currentContext() { return contextStore.localData(); } int ExceptionContext::currentDepth() { return contextStore.localData().size(); }