Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
|
Class for a parameter of a json rpc method. More...
#include <JSONServiceDescription.h>
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< JSONSchemaTypeDefinitionPtr > | extends |
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< JSONSchemaTypeDefinitionPtr > | unionTypes |
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< CVariant > | enums |
(Optional) List of allowed values for the type | |
std::vector< JSONSchemaTypeDefinitionPtr > | items |
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< JSONSchemaTypeDefinitionPtr > | additionalItems |
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 ¶meterObject, CVariant &result, int size, int &start, int &end) |
static bool | ParseSorting (const CVariant ¶meterObject, SortBy &sortBy, SortOrder &sortOrder, SortAttribute &sortAttributes) |
static void | ParseLimits (const CVariant ¶meterObject, int &limitStart, int &limitEnd) |
static bool | ParameterExists (const CVariant ¶meterObject, 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 ¶meterObject, const std::string &key, unsigned int position) |
Returns the json value of a parameter. | |
static CVariant | GetParameter (const CVariant ¶meterObject, 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 ¶meterObject, 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 ¶meterObject, 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) |
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.
JSONSchemaTypeDefinition::JSONSchemaTypeDefinition | ( | ) |
JSONRPC_STATUS JSONSchemaTypeDefinition::Check | ( | const CVariant & | value, |
CVariant & | outputValue, | ||
CVariant & | errorData ) const |
void JSONSchemaTypeDefinition::Print | ( | bool | isParameter, |
bool | isGlobal, | ||
bool | printDefault, | ||
bool | printDescriptions, | ||
CVariant & | output ) const |
void JSONSchemaTypeDefinition::ResolveReference | ( | ) |
std::vector<JSONSchemaTypeDefinitionPtr> JSONRPC::JSONSchemaTypeDefinition::additionalItems |
List of json schema definitions for additional items in an array with tuple typing (defined schemas in "items")
JSONSchemaTypeDefinitionPtr JSONRPC::JSONSchemaTypeDefinition::additionalProperties |
Type definition for additional properties.
CVariant JSONRPC::JSONSchemaTypeDefinition::defaultValue |
Default value of the parameter (only needed when it is optional)
std::string JSONRPC::JSONSchemaTypeDefinition::description |
Description of the parameter.
unsigned int JSONRPC::JSONSchemaTypeDefinition::divisibleBy = 0 |
Integer by which the value (of type Integer) must be divisible without rest.
std::vector<CVariant> JSONRPC::JSONSchemaTypeDefinition::enums |
(Optional) List of allowed values for the type
bool JSONRPC::JSONSchemaTypeDefinition::exclusiveMaximum = false |
Whether to exclude the defined Maximum value from the valid range or not.
bool JSONRPC::JSONSchemaTypeDefinition::exclusiveMinimum = false |
Whether to exclude the defined Minimum value from the valid range or not.
std::vector<JSONSchemaTypeDefinitionPtr> JSONRPC::JSONSchemaTypeDefinition::extends |
Array of reference types which are extended by this type.
bool JSONRPC::JSONSchemaTypeDefinition::hasAdditionalProperties = false |
Whether the type can have additional properties or not.
std::string JSONRPC::JSONSchemaTypeDefinition::ID |
Id of the type (for referenced types) Renamed from "id" because of possible issues with Objective-C.
std::vector<JSONSchemaTypeDefinitionPtr> JSONRPC::JSONSchemaTypeDefinition::items |
List of possible values in an array.
double JSONRPC::JSONSchemaTypeDefinition::maximum |
Maximum value for Integer or Number types.
unsigned int JSONRPC::JSONSchemaTypeDefinition::maxItems = 0 |
Maximum amount of items in the array.
int JSONRPC::JSONSchemaTypeDefinition::maxLength = -1 |
Maximum length for String types.
double JSONRPC::JSONSchemaTypeDefinition::minimum |
Minimum value for Integer or Number types.
unsigned int JSONRPC::JSONSchemaTypeDefinition::minItems = 0 |
Minimum amount of items in the array.
int JSONRPC::JSONSchemaTypeDefinition::minLength = -1 |
Minimum length for String types.
std::string JSONRPC::JSONSchemaTypeDefinition::missingReference |
std::string JSONRPC::JSONSchemaTypeDefinition::name |
Name of the parameter (for by-name calls)
bool JSONRPC::JSONSchemaTypeDefinition::optional = true |
Whether or not the parameter is optional.
CJsonSchemaPropertiesMap JSONRPC::JSONSchemaTypeDefinition::properties |
List of properties of the parameter (only needed when the parameter is an object)
JSONSchemaTypeDefinitionPtr JSONRPC::JSONSchemaTypeDefinition::referencedType |
Referenced object.
bool JSONRPC::JSONSchemaTypeDefinition::referencedTypeSet = false |
Whether the type has been set based on the referenced type.
JSONSchemaType JSONRPC::JSONSchemaTypeDefinition::type = AnyValue |
JSON schema type of the parameter's value.
std::vector<JSONSchemaTypeDefinitionPtr> JSONRPC::JSONSchemaTypeDefinition::unionTypes |
JSON schema type definitions in case of a union type.
bool JSONRPC::JSONSchemaTypeDefinition::uniqueItems = false |
Whether every value in the array must be unique or not.