KItinerary::JsonLdDocument

Search for usage in LXR

KItinerary::JsonLdDocument Class Reference

#include <jsonlddocument.h>

Static Public Member Functions

static QVariant apply (const QVariant &lhs, const QVariant &rhs)
 
static QList< QVariantfromJson (const QJsonArray &array)
 
static QList< QVariantfromJson (const QJsonObject &obj)
 
static QVariant fromJsonSingular (const QJsonObject &obj)
 
static QVariant readProperty (const QVariant &obj, const char *name)
 
template<typename T >
static void registerType ()
 
static void removeProperty (QVariant &obj, const char *name)
 
static QJsonArray toJson (const QList< QVariant > &data)
 
static QJsonObject toJson (const QVariant &data)
 
static QJsonValue toJsonValue (const QVariant &data)
 
static void writeProperty (QVariant &obj, const char *name, const QVariant &value)
 
template<typename T >
static void writeProperty (T &obj, const char *name, const QVariant &value)
 

Detailed Description

Serialization/deserialization code for JSON-LD data.

See also
https://www.w3.org/TR/json-ld/

Definition at line 34 of file jsonlddocument.h.

Member Function Documentation

◆ apply()

QVariant JsonLdDocument::apply ( const QVariant & lhs,
const QVariant & rhs )
static

Apply all properties of rhs on to lhs.

Use this to merge two top-level objects of the same type, with rhs containing newer information.

Definition at line 564 of file jsonlddocument.cpp.

◆ fromJson() [1/2]

QList< QVariant > JsonLdDocument::fromJson ( const QJsonArray & array)
static

Convert JSON-LD array into instantiated data types.

Definition at line 339 of file jsonlddocument.cpp.

◆ fromJson() [2/2]

QList< QVariant > JsonLdDocument::fromJson ( const QJsonObject & obj)
static

Convert JSON-LD object into an instantiated data type.

Definition at line 348 of file jsonlddocument.cpp.

◆ fromJsonSingular()

QVariant JsonLdDocument::fromJsonSingular ( const QJsonObject & obj)
static

Convert a single JSON-LD object into an instantiated data type.

Note
Use this only if you are sure the JSON-LD object does not expand to multiple objects! That is usually only the case for objects you have written yourself and that semantically are guaranteed to be a single object. Anything received from external sources can expand and should not use this method.
Since
20.04

Definition at line 361 of file jsonlddocument.cpp.

◆ readProperty()

QVariant JsonLdDocument::readProperty ( const QVariant & obj,
const char * name )
static

Read property name on object obj.

Definition at line 522 of file jsonlddocument.cpp.

◆ registerType()

template<typename T >
static void KItinerary::JsonLdDocument::registerType ( )
inlinestatic

Register a custom type for deserialization.

Definition at line 84 of file jsonlddocument.h.

◆ removeProperty()

void JsonLdDocument::removeProperty ( QVariant & obj,
const char * name )
static

Removes property name on object obj.

Definition at line 559 of file jsonlddocument.cpp.

◆ toJson() [1/2]

QJsonArray JsonLdDocument::toJson ( const QList< QVariant > & data)
static

Serialize instantiated data types to JSON-LD.

Definition at line 497 of file jsonlddocument.cpp.

◆ toJson() [2/2]

QJsonObject JsonLdDocument::toJson ( const QVariant & data)
static

Serialize instantiated data type to JSON-LD.

Definition at line 511 of file jsonlddocument.cpp.

◆ toJsonValue()

QJsonValue JsonLdDocument::toJsonValue ( const QVariant & data)
static

JSON-LD serrialization of an invidividual data value.

Unlike the above this also works with primitive types.

Definition at line 405 of file jsonlddocument.cpp.

◆ writeProperty() [1/2]

void JsonLdDocument::writeProperty ( QVariant & obj,
const char * name,
const QVariant & value )
static

Set property name on object obj to value value.

Definition at line 538 of file jsonlddocument.cpp.

◆ writeProperty() [2/2]

template<typename T >
void KItinerary::JsonLdDocument::writeProperty ( T & obj,
const char * name,
const QVariant & value )
inlinestatic

Set property name on object obj to value value.

Definition at line 94 of file jsonlddocument.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 12 2024 11:52:20 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.