Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
JSONRPC::JSONSchemaTypeDefinition Class Reference

Class for a parameter of a json rpc method. More...

#include <JSONServiceDescription.h>

Inheritance diagram for JSONRPC::JSONSchemaTypeDefinition:
JSONRPC::CJSONUtils

Classes

class  CJsonSchemaPropertiesMap
 Maps a properties name to its json schema type definition. More...
 

Public Member Functions

 JSONSchemaTypeDefinition ()
 
bool Parse (const CVariant &value, bool isParameter=false)
 
JSONRPC_STATUS Check (const CVariant &value, CVariant &outputValue, CVariant &errorData) const
 
void Print (bool isParameter, bool isGlobal, bool printDefault, bool printDescriptions, CVariant &output) const
 
void ResolveReference ()
 

Public Attributes

std::string missingReference
 
std::string name
 Name of the parameter (for by-name calls)
 
std::string ID
 Id of the type (for referenced types) Renamed from "id" because of possible issues with Objective-C.
 
JSONSchemaTypeDefinitionPtr referencedType
 Referenced object.
 
bool referencedTypeSet = false
 Whether the type has been set based on the referenced type.
 
std::vector< JSONSchemaTypeDefinitionPtrextends
 Array of reference types which are extended by this type.
 
std::string description
 Description of the parameter.
 
JSONSchemaType type = AnyValue
 JSON schema type of the parameter's value.
 
std::vector< JSONSchemaTypeDefinitionPtrunionTypes
 JSON schema type definitions in case of a union type.
 
bool optional = true
 Whether or not the parameter is optional.
 
CVariant defaultValue
 Default value of the parameter (only needed when it is optional)
 
double minimum
 Minimum value for Integer or Number types.
 
double maximum
 Maximum value for Integer or Number types.
 
bool exclusiveMinimum = false
 Whether to exclude the defined Minimum value from the valid range or not.
 
bool exclusiveMaximum = false
 Whether to exclude the defined Maximum value from the valid range or not.
 
unsigned int divisibleBy = 0
 Integer by which the value (of type Integer) must be divisible without rest.
 
int minLength = -1
 Minimum length for String types.
 
int maxLength = -1
 Maximum length for String types.
 
std::vector< CVariantenums
 (Optional) List of allowed values for the type
 
std::vector< JSONSchemaTypeDefinitionPtritems
 List of possible values in an array.
 
unsigned int minItems = 0
 Minimum amount of items in the array.
 
unsigned int maxItems = 0
 Maximum amount of items in the array.
 
bool uniqueItems = false
 Whether every value in the array must be unique or not.
 
std::vector< JSONSchemaTypeDefinitionPtradditionalItems
 List of json schema definitions for additional items in an array with tuple typing (defined schemas in "items")
 
CJsonSchemaPropertiesMap properties
 List of properties of the parameter (only needed when the parameter is an object)
 
bool hasAdditionalProperties = false
 Whether the type can have additional properties or not.
 
JSONSchemaTypeDefinitionPtr additionalProperties
 Type definition for additional properties.
 

Additional Inherited Members

- Static Protected Member Functions inherited from JSONRPC::CJSONUtils
static void HandleLimits (const CVariant &parameterObject, CVariant &result, int size, int &start, int &end)
 
static bool ParseSorting (const CVariant &parameterObject, SortBy &sortBy, SortOrder &sortOrder, SortAttribute &sortAttributes)
 
static void ParseLimits (const CVariant &parameterObject, int &limitStart, int &limitEnd)
 
static bool ParameterExists (const CVariant &parameterObject, const std::string &key, unsigned int position)
 Checks if the given object contains a parameter.
 
static bool IsValueMember (const CVariant &value, const std::string &key)
 Checks if the given object contains a value with the given key.
 
static CVariant GetParameter (const CVariant &parameterObject, const std::string &key, unsigned int position)
 Returns the json value of a parameter.
 
static CVariant GetParameter (const CVariant &parameterObject, const std::string &key, unsigned int position, const CVariant &fallback)
 Returns the json value of a parameter or the given default value.
 
static std::string GetString (const CVariant &value, const char *defaultValue)
 Returns the given json value as a string.
 
static TransportLayerCapability StringToTransportLayer (const std::string &transport)
 Returns a TransportLayerCapability value of the given string representation.
 
static JSONSchemaType StringToSchemaValueType (const std::string &valueType)
 Returns a JSONSchemaType value for the given string representation.
 
static std::string SchemaValueTypeToString (JSONSchemaType valueType)
 Returns a string representation for the given JSONSchemaType.
 
static void SchemaValueTypeToJson (JSONSchemaType valueType, CVariant &jsonObject)
 Converts the given json schema type into a json object.
 
static const char * ValueTypeToString (CVariant::VariantType valueType)
 
static bool IsParameterType (const CVariant &parameterObject, const char *key, unsigned int position, JSONSchemaType valueType)
 Checks if the parameter with the given name or at the given position is of a certain type.
 
static bool IsType (const CVariant &value, JSONSchemaType valueType)
 Checks if the given json value is of the given type.
 
static void SetDefaultValue (CVariant &value, JSONSchemaType valueType)
 Sets the value of the given json value to the default value of the given type.
 
static bool HasType (JSONSchemaType typeObject, JSONSchemaType type)
 
static bool ParameterNotNull (const CVariant &parameterObject, const std::string &key)
 
static void CopyStringArray (const CVariant &jsonStringArray, std::vector< std::string > &stringArray)
 Copies the values from the jsonStringArray to the stringArray. stringArray is cleared.
 
static void SetFromDBDate (const CVariant &jsonDate, CDateTime &date)
 
static void SetFromDBDateTime (const CVariant &jsonDate, CDateTime &date)
 
static bool GetXspFiltering (const std::string &type, const CVariant &filter, std::string &xsp)
 
static void MillisecondsToTimeObject (int time, CVariant &result)
 

Detailed Description

Class for a parameter of a json rpc method.

Represents a parameter of a defined json rpc method and is used to verify and extract the value of the parameter in a method call.

Constructor & Destructor Documentation

◆ JSONSchemaTypeDefinition()

JSONSchemaTypeDefinition::JSONSchemaTypeDefinition ( )

Member Function Documentation

◆ Check()

JSONRPC_STATUS JSONSchemaTypeDefinition::Check ( const CVariant & value,
CVariant & outputValue,
CVariant & errorData ) const

◆ Parse()

bool JSONSchemaTypeDefinition::Parse ( const CVariant & value,
bool isParameter = false )

◆ Print()

void JSONSchemaTypeDefinition::Print ( bool isParameter,
bool isGlobal,
bool printDefault,
bool printDescriptions,
CVariant & output ) const

◆ ResolveReference()

void JSONSchemaTypeDefinition::ResolveReference ( )

Member Data Documentation

◆ additionalItems

std::vector<JSONSchemaTypeDefinitionPtr> JSONRPC::JSONSchemaTypeDefinition::additionalItems

List of json schema definitions for additional items in an array with tuple typing (defined schemas in "items")

◆ additionalProperties

JSONSchemaTypeDefinitionPtr JSONRPC::JSONSchemaTypeDefinition::additionalProperties

Type definition for additional properties.

◆ defaultValue

CVariant JSONRPC::JSONSchemaTypeDefinition::defaultValue

Default value of the parameter (only needed when it is optional)

◆ description

std::string JSONRPC::JSONSchemaTypeDefinition::description

Description of the parameter.

◆ divisibleBy

unsigned int JSONRPC::JSONSchemaTypeDefinition::divisibleBy = 0

Integer by which the value (of type Integer) must be divisible without rest.

◆ enums

std::vector<CVariant> JSONRPC::JSONSchemaTypeDefinition::enums

(Optional) List of allowed values for the type

◆ exclusiveMaximum

bool JSONRPC::JSONSchemaTypeDefinition::exclusiveMaximum = false

Whether to exclude the defined Maximum value from the valid range or not.

◆ exclusiveMinimum

bool JSONRPC::JSONSchemaTypeDefinition::exclusiveMinimum = false

Whether to exclude the defined Minimum value from the valid range or not.

◆ extends

std::vector<JSONSchemaTypeDefinitionPtr> JSONRPC::JSONSchemaTypeDefinition::extends

Array of reference types which are extended by this type.

◆ hasAdditionalProperties

bool JSONRPC::JSONSchemaTypeDefinition::hasAdditionalProperties = false

Whether the type can have additional properties or not.

◆ ID

std::string JSONRPC::JSONSchemaTypeDefinition::ID

Id of the type (for referenced types) Renamed from "id" because of possible issues with Objective-C.

◆ items

std::vector<JSONSchemaTypeDefinitionPtr> JSONRPC::JSONSchemaTypeDefinition::items

List of possible values in an array.

◆ maximum

double JSONRPC::JSONSchemaTypeDefinition::maximum

Maximum value for Integer or Number types.

◆ maxItems

unsigned int JSONRPC::JSONSchemaTypeDefinition::maxItems = 0

Maximum amount of items in the array.

◆ maxLength

int JSONRPC::JSONSchemaTypeDefinition::maxLength = -1

Maximum length for String types.

◆ minimum

double JSONRPC::JSONSchemaTypeDefinition::minimum

Minimum value for Integer or Number types.

◆ minItems

unsigned int JSONRPC::JSONSchemaTypeDefinition::minItems = 0

Minimum amount of items in the array.

◆ minLength

int JSONRPC::JSONSchemaTypeDefinition::minLength = -1

Minimum length for String types.

◆ missingReference

std::string JSONRPC::JSONSchemaTypeDefinition::missingReference

◆ name

std::string JSONRPC::JSONSchemaTypeDefinition::name

Name of the parameter (for by-name calls)

◆ optional

bool JSONRPC::JSONSchemaTypeDefinition::optional = true

Whether or not the parameter is optional.

◆ properties

CJsonSchemaPropertiesMap JSONRPC::JSONSchemaTypeDefinition::properties

List of properties of the parameter (only needed when the parameter is an object)

◆ referencedType

JSONSchemaTypeDefinitionPtr JSONRPC::JSONSchemaTypeDefinition::referencedType

Referenced object.

◆ referencedTypeSet

bool JSONRPC::JSONSchemaTypeDefinition::referencedTypeSet = false

Whether the type has been set based on the referenced type.

◆ type

JSONSchemaType JSONRPC::JSONSchemaTypeDefinition::type = AnyValue

JSON schema type of the parameter's value.

◆ unionTypes

std::vector<JSONSchemaTypeDefinitionPtr> JSONRPC::JSONSchemaTypeDefinition::unionTypes

JSON schema type definitions in case of a union type.

◆ uniqueItems

bool JSONRPC::JSONSchemaTypeDefinition::uniqueItems = false

Whether every value in the array must be unique or not.


The documentation for this class was generated from the following files: