|
void | byteArrayFormatChanged (ByteArrayFormat byteArrayFormat, QPrivateSignal) |
| NOTIFY accessor for QJsonSerializer::byteArrayFormat.
|
|
void | validateBase64Changed (bool validateBase64, QPrivateSignal) |
| NOTIFY accessor for QJsonSerializer::validateBase64.
|
|
void | allowDefaultNullChanged (bool allowDefaultNull, QPrivateSignal) |
| NOTIFY accessor for QJsonSerializer::allowDefaultNull.
|
|
void | keepObjectNameChanged (bool keepObjectName, QPrivateSignal) |
| NOTIFY accessor for QJsonSerializer::keepObjectName.
|
|
void | enumAsStringChanged (bool enumAsString, QPrivateSignal) |
| NOTIFY accessor for QJsonSerializer::enumAsString.
|
|
void | versionAsStringChanged (bool versionAsString, QPrivateSignal) |
| NOTIFY accessor for QJsonSerializer::versionAsString.
|
|
void | dateAsTimeStampChanged (bool dateAsTimeStamp, QPrivateSignal) |
| NOTIFY accessor for QJsonSerializer::dateAsTimeStamp.
|
|
void | useBcp47LocaleChanged (bool useBcp47Locale, QPrivateSignal) |
| NOTIFY accessor for QJsonSerializer::useBcp47Locale.
|
|
void | validationFlagsChanged (ValidationFlags validationFlags, QPrivateSignal) |
| NOTIFY accessor for QJsonSerializer::validationFlags.
|
|
void | polymorphingChanged (Polymorphing polymorphing, QPrivateSignal) |
| NOTIFY accessor for QJsonSerializer::polymorphing.
|
|
void | multiMapModeChanged (MultiMapMode multiMapMode, QPrivateSignal) |
| NOTIFY accessor for QJsonSerializer::multiMapMode.
|
|
void | ignoreStoredAttributeChanged (bool ignoreStoredAttribute, QPrivateSignal) |
| NOTIFY accessor for QJsonSerializer::ignoreStoredAttribute.
|
|
|
| JsonSerializer (QObject *parent=nullptr) |
| Default constructor.
|
|
QJsonValue | serialize (const QVariant &data) const |
| Serializers a QVariant value to a QJsonValue. More...
|
|
void | serializeTo (QIODevice *device, const QVariant &data, QJsonDocument::JsonFormat format=QJsonDocument::Compact) const |
| Serializers a QVariant value to a device. More...
|
|
QByteArray | serializeTo (const QVariant &data, QJsonDocument::JsonFormat format=QJsonDocument::Compact) const |
| Serializers a QVariant value to a byte array. More...
|
|
template<typename T > |
QtJsonSerializer::__private::json_type< T >::type | serialize (const T &data) const |
| Serializers a generic c++ type to json. More...
|
|
template<typename T > |
void | serializeTo (QIODevice *device, const T &data, QJsonDocument::JsonFormat format=QJsonDocument::Compact) const |
| Serializers a generic c++ type to a device. More...
|
|
template<typename T > |
QByteArray | serializeTo (const T &data, QJsonDocument::JsonFormat format=QJsonDocument::Compact) const |
| Serializers a generic c++ type to a byte array. More...
|
|
QVariant | deserialize (const QJsonValue &json, int metaTypeId, QObject *parent=nullptr) const |
| Deserializes a QJsonValue to a QVariant value, based on the given type id. More...
|
|
QVariant | deserializeFrom (QIODevice *device, int metaTypeId, QObject *parent=nullptr) const |
| Deserializes data from a device to a QVariant value, based on the given type id. More...
|
|
QVariant | deserializeFrom (const QByteArray &data, int metaTypeId, QObject *parent=nullptr) const |
| Deserializes data from a device to a QVariant value, based on the given type id. More...
|
|
template<typename T > |
T | deserialize (const typename QtJsonSerializer::__private::json_type< T >::type &json, QObject *parent=nullptr) const |
| Deserializes a json to the given c++ type. More...
|
|
template<typename T > |
T | deserializeFrom (QIODevice *device, QObject *parent=nullptr) const |
| Deserializes data from a device to the given c++ type. More...
|
|
template<typename T > |
T | deserializeFrom (const QByteArray &data, QObject *parent=nullptr) const |
| Deserializes data from a byte array to the given c++ type. More...
|
|
ByteArrayFormat | byteArrayFormat () const |
| READ accessor for QJsonSerializer::byteArrayFormat.
|
|
bool | validateBase64 () const |
| READ accessor for QJsonSerializer::validateBase64.
|
|
std::variant< QCborValue, QJsonValue > | serializeGeneric (const QVariant &value) const override |
| Serializes a given variant to either CBOR or JSON, depending on the actual instance. More...
|
|
QVariant | deserializeGeneric (const std::variant< QCborValue, QJsonValue > &value, int metaTypeId, QObject *parent) const override |
| Deserializes CBOR or JSON, depending on the actual instance, to variant. More...
|
|
bool | allowDefaultNull () const |
| READ accessor for QJsonSerializer::allowDefaultNull.
|
|
bool | keepObjectName () const |
| READ accessor for QJsonSerializer::keepObjectName.
|
|
bool | enumAsString () const |
| READ accessor for QJsonSerializer::enumAsString.
|
|
bool | versionAsString () const |
| READ accessor for QJsonSerializer::versionAsString.
|
|
bool | dateAsTimeStamp () const |
| READ accessor for QJsonSerializer::dateAsTimeStamp.
|
|
bool | useBcp47Locale () const |
| READ accessor for QJsonSerializer::useBcp47Locale.
|
|
ValidationFlags | validationFlags () const |
| READ accessor for QJsonSerializer::validationFlags.
|
|
Polymorphing | polymorphing () const |
| READ accessor for QJsonSerializer::polymorphing.
|
|
MultiMapMode | multiMapMode () const |
| READ accessor for QJsonSerializer::multiMapMode.
|
|
bool | ignoresStoredAttribute () const |
| READ accessor for QJsonSerializer::ignoreStoredAttribute.
|
|
template<typename TConverter > |
void | addJsonTypeConverter () |
| Adds a custom type converter to this serializer. More...
|
|
void | addJsonTypeConverter (const QSharedPointer< TypeConverter > &converter) |
| Adds a custom type converter to this serializer. More...
|
|
virtual const QMetaObject * | metaObject () const const |
|
| QObject (QObject *parent) |
|
virtual bool | event (QEvent *e) |
|
virtual bool | eventFilter (QObject *watched, QEvent *event) |
|
QString | objectName () const const |
|
void | setObjectName (const QString &name) |
|
bool | isWidgetType () const const |
|
bool | isWindowType () const const |
|
bool | signalsBlocked () const const |
|
bool | blockSignals (bool block) |
|
QThread * | thread () const const |
|
void | moveToThread (QThread *targetThread) |
|
int | startTimer (int interval, Qt::TimerType timerType) |
|
int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType) |
|
void | killTimer (int id) |
|
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
|
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
|
QList< T > | findChildren (const QRegExp ®Exp, Qt::FindChildOptions options) const const |
|
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
|
const QObjectList & | children () const const |
|
void | setParent (QObject *parent) |
|
void | installEventFilter (QObject *filterObj) |
|
void | removeEventFilter (QObject *obj) |
|
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
|
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
|
bool | disconnect (const QObject *receiver, const char *method) const const |
|
void | dumpObjectTree () |
|
void | dumpObjectInfo () |
|
void | dumpObjectTree () const const |
|
void | dumpObjectInfo () const const |
|
bool | setProperty (const char *name, const QVariant &value) |
|
QVariant | property (const char *name) const const |
|
QList< QByteArray > | dynamicPropertyNames () const const |
|
void | destroyed (QObject *obj) |
|
void | objectNameChanged (const QString &objectName) |
|
QObject * | parent () const const |
|
bool | inherits (const char *className) const const |
|
void | deleteLater () |
|
| Q_DISABLE_COPY (Class) |
|
| Q_DISABLE_MOVE (Class) |
|
| Q_DISABLE_COPY_MOVE (Class) |
|
T | qobject_cast (QObject *object) |
|
T | qobject_cast (const QObject *object) |
|
T | qFindChild (const QObject *obj, const QString &name) |
|
QList< T > | qFindChildren (const QObject *obj, const QString &name) |
|
QList< T > | qFindChildren (const QObject *obj, const QRegExp ®Exp) |
|
| Q_CLASSINFO (Name, Value) |
|
| Q_INTERFACES (...) |
|
| Q_PROPERTY (...) |
|
| Q_ENUMS (...) |
|
| Q_FLAGS (...) |
|
| Q_ENUM (...) |
|
| Q_FLAG (...) |
|
| Q_ENUM_NS (...) |
|
| Q_FLAG_NS (...) |
|
| Q_OBJECT Q_OBJECT |
|
| Q_GADGET Q_GADGET |
|
| Q_NAMESPACE Q_NAMESPACE |
|
| Q_SIGNALS Q_SIGNALS |
|
| Q_SIGNAL Q_SIGNAL |
|
| Q_SLOTS Q_SLOTS |
|
| Q_SLOT Q_SLOT |
|
| Q_EMIT Q_EMIT |
|
| Q_INVOKABLE Q_INVOKABLE |
|
| Q_REVISION Q_REVISION |
|
| Q_SET_OBJECT_NAME (Object) |
|
| QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT |
|
|
bool | jsonMode () const override |
| Returns true, if de/serializing to JSON, and false for CBOR.
|
|
QCborTag | typeTag (int metaTypeId) const override |
| Returns a tag registered for the given metaTypeId.
|
|
QList< int > | typesForTag (QCborTag tag) const override |
|
| SerializerBase (QObject *parent=nullptr) |
| Default constructor.
|
|
QVariant | getProperty (const char *name) const override |
| Returns a property from the serializer.
|
|
QSharedPointer< const TypeExtractor > | extractor (int metaTypeId) const override |
| Returns a reference to an extractor for the given type, or nullptr.
|
|
QCborValue | serializeSubtype (const QMetaProperty &property, const QVariant &value) const override |
| Serialize a subvalue, represented by a meta property.
|
|
QCborValue | serializeSubtype (int propertyType, const QVariant &value, const QByteArray &traceHint) const override |
| Serialize a subvalue, represented by a type id.
|
|
QVariant | deserializeSubtype (const QMetaProperty &property, const QCborValue &value, QObject *parent) const override |
| Deserialize a subvalue, represented by a meta property.
|
|
QVariant | deserializeSubtype (int propertyType, const QCborValue &value, QObject *parent, const QByteArray &traceHint) const override |
| Deserialize a subvalue, represented by a type id.
|
|
QObject * | sender () const const |
|
int | senderSignalIndex () const const |
|
int | receivers (const char *signal) const const |
|
bool | isSignalConnected (const QMetaMethod &signal) const const |
|
virtual void | timerEvent (QTimerEvent *event) |
|
virtual void | childEvent (QChildEvent *event) |
|
virtual void | customEvent (QEvent *event) |
|
virtual void | connectNotify (const QMetaMethod &signal) |
|
virtual void | disconnectNotify (const QMetaMethod &signal) |
|
|
template<typename TType , typename TExtractor > |
static void | registerExtractor () |
| Registers a custom extractor for the given type. More...
|
|
static void | registerExtractor (int metaTypeId, const QSharedPointer< TypeExtractor > &extractor) |
| Registers a custom extractor for the given type. More...
|
|
template<typename T > |
static void | registerListConverters () |
| Registers a custom type for list converisons. More...
|
|
template<typename T > |
static void | registerSetConverters () |
| Registers a custom type for set converisons. More...
|
|
template<typename TKey , typename TValue , bool mapTypes = true, bool hashTypes = true> |
static void | registerMapConverters () |
| Registers a custom type for map converisons. More...
|
|
template<typename T > |
static void | registerPointerConverters () |
| Registers a custom type for QSharedPointer and QPointer converisons. More...
|
|
template<typename T > |
static void | registerBasicConverters () |
| Registers a custom type for list, set map and optional converisons. Also include pointer converters, if applicable. More...
|
|
template<typename T , typename U > |
static void | registerPairConverters () |
| Registers two types for pair conversion. More...
|
|
template<typename... TArgs> |
static void | registerTupleConverters () |
| Registers a number of types for std::tuple conversion. More...
|
|
template<typename T > |
static void | registerOptionalConverters () |
| Registers a custom type for std::optional converisons. More...
|
|
template<typename... TArgs> |
static void | registerVariantConverters () |
| Registers a custom type for std::variant converisons. More...
|
|
template<typename TConverter , int Priority = TypeConverter::Priority::Standard> |
static void | addJsonTypeConverterFactory () |
| Globally registers a converter factory to provide converters for all QJsonSerializer instances. More...
|
|
static void | addJsonTypeConverterFactory (TypeConverterFactory *factory) |
| Globally registers a converter factory to provide converters for all QJsonSerializer instances. More...
|
|
QString | tr (const char *sourceText, const char *disambiguation, int n) |
|
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
|
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
|
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
|
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
|
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
|
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
|
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
|
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
|
bool | disconnect (const QMetaObject::Connection &connection) |
|
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
|
typedef | QObjectList |
|
A class to serialize and deserialize c++ classes to and from JSON.
This class is one of the modules core component. It performs the de/serialization of C++ classes from and to JSON.
Supported types
The serializer supports a bunch of types by default, but there are limitations. Check the main page Usage Hints for details about what is possible and what is not.
Extending the serializer
To extend the serializers functionality, create a custom implementation of the TypeConverter class. Check it's documentation for more details and an example on how to. Once you've created a custom converter class, you can add it to a serializer instance by using SerializerBase::addJsonTypeConverter.
- See also
- SerializerBase, CborSerializer
Definition at line 15 of file jsonserializer.h.