KItinerary::JsonLd

KItinerary::JsonLd Namespace Reference

Functions

template<typename T >
bool canConvert (const QVariant &value)
 
template<typename T >
convert (const QVariant &value)
 
template<typename T >
bool isA (const QVariant &value)
 
bool isSchemaOrgNamespace (QStringView uri)
 
QString normalizeTypeName (QString &&typeName)
 
void renameProperty (QJsonObject &obj, const char *oldName, const char *newName)
 
QString typeName (const QJsonObject &obj)
 
bool valueIsNull (const QVariant &v)
 

Detailed Description

JSON-LD data type helper functions.

Utility methods for working with schema.org data in JSON-LD format.

Function Documentation

◆ canConvert()

template<typename T >
bool KItinerary::JsonLd::canConvert ( const QVariant & value)
inline

Checks if the given value can be up-cast to T.

Definition at line 31 of file datatypes.h.

◆ convert()

template<typename T >
T KItinerary::JsonLd::convert ( const QVariant & value)
inline

Up-cast value to T.

Note
This does not perform any safety checks!
See also
canConvert

Definition at line 47 of file datatypes.h.

◆ isA()

template<typename T >
bool KItinerary::JsonLd::isA ( const QVariant & value)
inline

Returns true if value is of type T.

Definition at line 24 of file datatypes.h.

◆ isSchemaOrgNamespace()

bool KItinerary::JsonLd::isSchemaOrgNamespace ( QStringView uri)
nodiscard

Checks whether uri is in the http://schema.org namespace.

That is more complex than just startsWith since schema.org started to use "https" in their URIs...

Definition at line 31 of file json/jsonld.cpp.

◆ normalizeTypeName()

QString KItinerary::JsonLd::normalizeTypeName ( QString && typeName)
nodiscard

Definition at line 20 of file json/jsonld.cpp.

◆ renameProperty()

void KItinerary::JsonLd::renameProperty ( QJsonObject & obj,
const char * oldName,
const char * newName )

Rename a property, if present and the new name isn't in use already.

Definition at line 17 of file jsonldfilterengine.cpp.

◆ typeName()

QString KItinerary::JsonLd::typeName ( const QJsonObject & obj)
nodiscard

Normalized type name from object.

Definition at line 15 of file json/jsonld.cpp.

◆ valueIsNull()

bool KItinerary::JsonLd::valueIsNull ( const QVariant & v)

Checks whether v holds a null-like value.

This is similar to QVariant::isNull in Qt5, but differs from the "shallow" QVariant::isNull in Qt6 which doesn't check the content at all.

Definition at line 370 of file jsonlddocument.cpp.

This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:00:34 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.