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 QVector< QVariantfromJson (const QJsonArray &array)
 
static QVector< QVariantfromJson (const QJsonObject &obj)
 
static QVariant fromJsonSingular (const QJsonObject &obj)
 
static QVariant readProperty (const QVariant &obj, const char *1)
 
template<typename T >
static void registerType ()
 
static void removeProperty (QVariant &obj, const char *1)
 
static QJsonObject toJson (const QVariant &data)
 
static QJsonArray toJson (const QVector< QVariant > &data)
 
static QJsonValue toJsonValue (const QVariant &data)
 
static void writeProperty (QVariant &obj, const char *1, const QVariant &value)
 
template<typename T >
static void writeProperty (T &obj, const char *1, 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 552 of file jsonlddocument.cpp.

◆ fromJson() [1/2]

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

Convert JSON-LD array into instantiated data types.

Definition at line 321 of file jsonlddocument.cpp.

◆ fromJson() [2/2]

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

Convert JSON-LD object into an instantiated data type.

Definition at line 331 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 345 of file jsonlddocument.cpp.

◆ readProperty()

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

Read property name on object obj.

Definition at line 510 of file jsonlddocument.cpp.

◆ registerType()

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

Register a custom type for deserialization.

Definition at line 80 of file jsonlddocument.h.

◆ removeProperty()

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

Removes property name on object obj.

Definition at line 547 of file jsonlddocument.cpp.

◆ toJson() [1/2]

QJsonObject JsonLdDocument::toJson ( const QVariant data)
static

Serialize instantiated data type to JSON-LD.

Definition at line 499 of file jsonlddocument.cpp.

◆ toJson() [2/2]

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

Serialize instantiated data types to JSON-LD.

Definition at line 484 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 391 of file jsonlddocument.cpp.

◆ writeProperty() [1/2]

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

Set property name on object obj to value value.

Definition at line 526 of file jsonlddocument.cpp.

◆ writeProperty() [2/2]

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

Set property name on object obj to value value.

Definition at line 91 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-2022 The KDE developers.
Generated on Wed Jun 29 2022 03:59:50 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.