|
RestLink 2.2.0
Powerfull Rest Client for Qt
|
Represents a generic parameter, which could be a path, query, or header parameter, with support for special values and flags. More...
#include <parameter.h>
Inherited by RestLink::Header, RestLink::PathParameter, and RestLink::QueryParameter.
Public Types | |
| enum | Flag { NoFlag = 0x0 , Authentication = 0x1 , Secret = 0x2 , Locale = 0x64 } |
| Defines flags used to specify special attributes for a parameter. More... | |
| enum | Type { BaseType , PathParameterType , QueryParameterType , HeaderType } |
| Defines the possible types of parameters. More... | |
Public Member Functions | |
| Parameter () | |
| Default constructor for Parameter class. | |
| Parameter (const Parameter &other) | |
| Copy constructor for Parameter class. | |
| Parameter (Parameter &&other) | |
| Move constructor for Parameter class. | |
| ~Parameter () | |
| Destructor for Parameter class. | |
| Parameter & | operator= (const Parameter &other) |
| Copy assignment operator for Parameter class. | |
| Parameter & | operator= (Parameter &&other) |
| Move assignment operator for Parameter class. | |
| QString | name () const |
| Retrieves the name of the parameter. | |
| void | setName (const QString &name) |
| Sets the name of the parameter. | |
| QVariant | value () const |
| Retrieves the value of the parameter. | |
| void | setValue (const QVariant &value) |
| Sets the value of the parameter. | |
| QVariant | specialValue (Api *api) const |
| Returns a special value for the parameter, based on the provided API. | |
| QVariantList | specialValues (Api *api) const |
| Returns a list of special values for the parameter, based on the provided API. | |
| bool | hasValue (const QVariant &value) const |
| Checks if the parameter contains a specific value. | |
| void | addValue (const QVariant &value) |
| Adds a value to the parameter. | |
| void | removeValue (const QVariant &value) |
| Removes a value from the parameter. | |
| QList< QVariant > | values () const |
| Returns a list of all values associated with the parameter. | |
| void | setValues (const QList< QVariant > &values) |
| Sets a list of values for the parameter. | |
| bool | hasFlag (Flag flag) const |
| Checks if a specific flag is set for the parameter. | |
| Flags | flags () const |
| Retrieves all flags set for the parameter. | |
| void | setFlag (Flag flag, bool on=true) |
| Sets or clears a specific flag for the parameter. | |
| void | setFlags (const Flags &flags) |
| Sets multiple flags for the parameter. | |
| Type | type () const |
| Returns the type of the parameter. | |
| bool | isValid () const |
| Checks if the parameter is valid. | |
| PathParameter | toPathParameter () const |
| QueryParameter | toQueryParameter () const |
| Header | toHeader () const |
| QJsonObject | toJsonObject () const |
| Converts the parameter to a QJsonObject. | |
| bool | operator== (const Parameter &other) const |
| Equality operator for Parameter class. | |
| bool | operator!= (const Parameter &other) const |
| Inequality operator for Parameter class. | |
Static Public Member Functions | |
| static Parameter | fromJsonObject (const QJsonObject &object, Type type) |
| Loads parameter information from a JSON object. | |
| static Parameter | merge (const Parameter &p1, const Parameter &p2) |
| Merges two Parameter objects into a single parameter. | |
Protected Member Functions | |
| Parameter (ParameterData *d) | |
| Parameter (const QSharedDataPointer< ParameterData > &data) | |
Static Protected Member Functions | |
| static void | dataFromJsonObject (ParameterData *data, const QJsonObject &object) |
Protected Attributes | |
| QSharedDataPointer< ParameterData > | d_ptr |
Represents a generic parameter, which could be a path, query, or header parameter, with support for special values and flags.
This class provides a flexible structure to define parameters in various contexts, supporting operations such as adding/removing values, flagging special attributes, and converting to/from JSON format. Parameters can represent different types, including path parameters, query parameters, and headers.
Defines flags used to specify special attributes for a parameter.
Flags can be used to indicate attributes like authentication, secrecy, and locale.
Defines the possible types of parameters.
Parameters can be classified into different types, including base type, path parameter type, query parameter type, and header type.
| RestLink::Parameter::Parameter | ( | ) |
Default constructor for Parameter class.
Initializes a new parameter instance with default values.
| RestLink::Parameter::Parameter | ( | const Parameter & | other | ) |
| RestLink::Parameter::Parameter | ( | Parameter && | other | ) |
Move constructor for Parameter class.
Transfers ownership of the resources from the provided parameter to the new instance.
| other | The parameter to move. |
| RestLink::Parameter::~Parameter | ( | ) |
Destructor for Parameter class.
Cleans up the resources held by the parameter.
|
protected |
|
protected |
Move assignment operator for Parameter class.
Transfers ownership of the resources from the provided parameter to the current instance.
| other | The parameter to move from. |
| QString RestLink::Parameter::name | ( | ) | const |
Retrieves the name of the parameter.
| void RestLink::Parameter::setName | ( | const QString & | name | ) |
Sets the name of the parameter.
| name | The name to set for the parameter. |
| QVariant RestLink::Parameter::value | ( | ) | const |
Retrieves the value of the parameter.
| void RestLink::Parameter::setValue | ( | const QVariant & | value | ) |
Sets the value of the parameter.
| value | The value to set for the parameter. |
| QVariant RestLink::Parameter::specialValue | ( | Api * | api | ) | const |
Returns a special value for the parameter, based on the provided API.
This method may return a specific value depending on the context of the API.
| api | The API used to determine the special value. |
| QVariantList RestLink::Parameter::specialValues | ( | Api * | api | ) | const |
Returns a list of special values for the parameter, based on the provided API.
This method may return multiple special values depending on the context of the API.
| api | The API used to determine the special values. |
| bool RestLink::Parameter::hasValue | ( | const QVariant & | value | ) | const |
Checks if the parameter contains a specific value.
| value | The value to check. |
| void RestLink::Parameter::addValue | ( | const QVariant & | value | ) |
Adds a value to the parameter.
| value | The value to add. |
| void RestLink::Parameter::removeValue | ( | const QVariant & | value | ) |
Removes a value from the parameter.
| value | The value to remove. |
| QVariantList RestLink::Parameter::values | ( | ) | const |
Returns a list of all values associated with the parameter.
| void RestLink::Parameter::setValues | ( | const QList< QVariant > & | values | ) |
Sets a list of values for the parameter.
| values | The new list of values to assign. |
| bool RestLink::Parameter::hasFlag | ( | Flag | flag | ) | const |
Checks if a specific flag is set for the parameter.
| flag | The ParameterFlag to check. |
true if the flag is set, otherwise false. | Parameter::Flags RestLink::Parameter::flags | ( | ) | const |
Retrieves all flags set for the parameter.
| void RestLink::Parameter::setFlag | ( | Flag | flag, |
| bool | on = true |
||
| ) |
Sets or clears a specific flag for the parameter.
| flag | The ParameterFlag to modify. |
| on | true to set the flag, false to clear it. |
| void RestLink::Parameter::setFlags | ( | const Flags & | flags | ) |
Sets multiple flags for the parameter.
| flags | The ParameterFlags bitmask to set. |
| Parameter::Type RestLink::Parameter::type | ( | ) | const |
Returns the type of the parameter.
| bool RestLink::Parameter::isValid | ( | ) | const |
Checks if the parameter is valid.
true if the parameter is valid, otherwise false.A parameter is considered valid if it has a non-empty name and a not null value.
| PathParameter RestLink::Parameter::toPathParameter | ( | ) | const |
| QueryParameter RestLink::Parameter::toQueryParameter | ( | ) | const |
Converts the current Parameter instance to a QueryParameter. If the type of the parameter is QueryParameterType, it returns a valid QueryParameter. Otherwise, it returns an invalid QueryParameter instance.
| Header RestLink::Parameter::toHeader | ( | ) | const |
| QJsonObject RestLink::Parameter::toJsonObject | ( | ) | const |
Converts the parameter to a QJsonObject.
Loads parameter information from a JSON object.
| object | The QJsonObject containing the parameter data. |
| bool RestLink::Parameter::operator== | ( | const Parameter & | other | ) | const |
Equality operator for Parameter class.
Two parameters are considered equal if they have the same name, value, and flags.
| other | The parameter to compare with. |
| bool RestLink::Parameter::operator!= | ( | const Parameter & | other | ) | const |
Inequality operator for Parameter class.
Two parameters are considered unequal if they differ in name, value, or flags.
| other | The parameter to compare with. |
|
staticprotected |
|
protected |