KItinerary::JsonLdDocument

Search for usage in LXR

KItinerary::JsonLdDocument Class Reference

#include <jsonlddocument.h>

Public Member Functions

template<typename T >
void registerType ()
 

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 *name)
 
static void removeProperty (QVariant &obj, const char *name)
 
static QJsonArray toJson (const QVector< QVariant > &data)
 
static QJsonObject toJson (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 23 of file jsonlddocument.h.

Member Function Documentation

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 527 of file jsonlddocument.cpp.

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

Convert JSON-LD array into instantiated data types.

Definition at line 309 of file jsonlddocument.cpp.

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

Convert JSON-LD object into an instantiated data type.

Definition at line 319 of file jsonlddocument.cpp.

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 333 of file jsonlddocument.cpp.

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

Read property name on object obj.

Definition at line 485 of file jsonlddocument.cpp.

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

Register a custom type for deserialization.

Definition at line 64 of file jsonlddocument.h.

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

Removes property name on object obj.

Definition at line 522 of file jsonlddocument.cpp.

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

Serialize instantiated data types to JSON-LD.

Definition at line 459 of file jsonlddocument.cpp.

QJsonObject JsonLdDocument::toJson ( const QVariant data)
static

Serialize instantiated data type to JSON-LD.

Definition at line 474 of file jsonlddocument.cpp.

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

Set property name on object obj to value value.

Definition at line 501 of file jsonlddocument.cpp.

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 75 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-2021 The KDE developers.
Generated on Tue Nov 30 2021 23:06:14 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.