summaryrefslogtreecommitdiffstats
path: root/src/corelib/serialization
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/serialization')
-rw-r--r--src/corelib/serialization/qcborvalue.cpp12
-rw-r--r--src/corelib/serialization/qcborvalue.h10
-rw-r--r--src/corelib/serialization/qjsoncbor.cpp7
3 files changed, 28 insertions, 1 deletions
diff --git a/src/corelib/serialization/qcborvalue.cpp b/src/corelib/serialization/qcborvalue.cpp
index e53b6a0326..80ef515fd2 100644
--- a/src/corelib/serialization/qcborvalue.cpp
+++ b/src/corelib/serialization/qcborvalue.cpp
@@ -1771,6 +1771,7 @@ QCborValue::QCborValue(const QUrl &url)
container->elements[1].type = String;
}
+#if QT_CONFIG(regularexpression)
/*!
Creates a QCborValue object of the regular expression pattern extended type
and containing the value represented by \a rx. The value can later be retrieved
@@ -1789,6 +1790,7 @@ QCborValue::QCborValue(const QRegularExpression &rx)
// change type
t = RegularExpression;
}
+#endif // QT_CONFIG(regularexpression)
/*!
Creates a QCborValue object of the UUID extended type and containing the
@@ -1942,6 +1944,7 @@ QUrl QCborValue::toUrl(const QUrl &defaultValue) const
return QUrl::fromEncoded(byteData->asByteArrayView());
}
+#if QT_CONFIG(regularexpression)
/*!
Returns the regular expression value stored in this QCborValue, if it is of
the regular expression pattern extended type. Otherwise, it returns \a
@@ -1960,6 +1963,7 @@ QRegularExpression QCborValue::toRegularExpression(const QRegularExpression &def
Q_ASSERT(n == -1);
return QRegularExpression(container->stringAt(1));
}
+#endif // QT_CONFIG(regularexpression)
/*!
Returns the UUID value stored in this QCborValue, if it is of the UUID
@@ -2400,12 +2404,16 @@ uint qHash(const QCborValue &value, uint seed)
return qHash(value.toDateTime(), seed);
case QCborValue::Url:
return qHash(value.toUrl(), seed);
+#if QT_CONFIG(regularexpression)
case QCborValue::RegularExpression:
return qHash(value.toRegularExpression(), seed);
+#endif
case QCborValue::Uuid:
return qHash(value.toUuid(), seed);
case QCborValue::Invalid:
return seed;
+ default:
+ break;
}
Q_ASSERT(value.isSimpleType());
@@ -2450,12 +2458,16 @@ static QDebug debugContents(QDebug &dbg, const QCborValue &v)
return dbg << v.toDateTime();
case QCborValue::Url:
return dbg << v.toUrl();
+#if QT_CONFIG(regularexpression)
case QCborValue::RegularExpression:
return dbg << v.toRegularExpression();
+#endif
case QCborValue::Uuid:
return dbg << v.toUuid();
case QCborValue::Invalid:
return dbg << "<invalid>";
+ default:
+ break;
}
if (v.isSimpleType())
return dbg << v.toSimpleType();
diff --git a/src/corelib/serialization/qcborvalue.h b/src/corelib/serialization/qcborvalue.h
index 105af1ba73..d6ba4e88d8 100644
--- a/src/corelib/serialization/qcborvalue.h
+++ b/src/corelib/serialization/qcborvalue.h
@@ -43,7 +43,9 @@
#include <QtCore/qbytearray.h>
#include <QtCore/qdatetime.h>
#include <QtCore/qcborcommon.h>
-#include <QtCore/qregularexpression.h>
+#if QT_CONFIG(regularexpression)
+# include <QtCore/qregularexpression.h>
+#endif
#include <QtCore/qstring.h>
#include <QtCore/qstringview.h>
#include <QtCore/qurl.h>
@@ -155,7 +157,9 @@ public:
explicit QCborValue(const QDateTime &dt);
explicit QCborValue(const QUrl &url);
+#if QT_CONFIG(regularexpression)
explicit QCborValue(const QRegularExpression &rx);
+#endif
explicit QCborValue(const QUuid &uuid);
~QCborValue() { if (container) dispose(); }
@@ -233,7 +237,9 @@ public:
QString toString(const QString &defaultValue = {}) const;
QDateTime toDateTime(const QDateTime &defaultValue = {}) const;
QUrl toUrl(const QUrl &defaultValue = {}) const;
+#if QT_CONFIG(regularexpression)
QRegularExpression toRegularExpression(const QRegularExpression &defaultValue = {}) const;
+#endif
QUuid toUuid(const QUuid &defaultValue = {}) const;
#ifdef Q_QDOC
@@ -380,8 +386,10 @@ public:
{ return concrete().toDateTime(defaultValue); }
QUrl toUrl(const QUrl &defaultValue = {}) const
{ return concrete().toUrl(defaultValue); }
+#if QT_CONFIG(regularexpression)
QRegularExpression toRegularExpression(const QRegularExpression &defaultValue = {}) const
{ return concrete().toRegularExpression(defaultValue); }
+#endif
QUuid toUuid(const QUuid &defaultValue = {}) const
{ return concrete().toUuid(defaultValue); }
diff --git a/src/corelib/serialization/qjsoncbor.cpp b/src/corelib/serialization/qjsoncbor.cpp
index 158f1950d0..4f756df97c 100644
--- a/src/corelib/serialization/qjsoncbor.cpp
+++ b/src/corelib/serialization/qjsoncbor.cpp
@@ -543,14 +543,19 @@ QVariant QCborValue::toVariant() const
case Url:
return toUrl();
+#if QT_CONFIG(regularexpression)
case RegularExpression:
return toRegularExpression();
+#endif
case Uuid:
return toUuid();
case Invalid:
return QVariant();
+
+ default:
+ break;
}
if (isSimpleType())
@@ -714,8 +719,10 @@ QCborValue QCborValue::fromVariant(const QVariant &variant)
case QVariant::Hash:
return QCborMap::fromVariantHash(variant.toHash());
#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(regularexpression)
case QVariant::RegularExpression:
return QCborValue(variant.toRegularExpression());
+#endif
case QMetaType::QJsonValue:
return fromJsonValue(variant.toJsonValue());
case QMetaType::QJsonObject: