Public Member Functions | Friends | Related Functions

HActionArguments Class Reference
[Device Model]

A storage class for HActionArgument instances. More...

#include <HActionArguments>

List of all members.

Public Member Functions

 HActionArguments ()
 HActionArguments (const QVector< HActionArgument * > &args)
 HActionArguments (const HActionArguments &)
 ~HActionArguments ()
HActionArgumentsoperator= (const HActionArguments &)
bool contains (const QString &argumentName) const
HActionArgumentget (const QString &argumentName)
const HActionArgumentget (const QString &argumentName) const
HActionArgumentget (qint32 index)
const HActionArgumentget (qint32 index) const
HActionArguments::const_iterator constBegin () const
HActionArguments::const_iterator constEnd () const
HActionArguments::iterator begin ()
HActionArguments::const_iterator begin () const
HActionArguments::iterator end ()
HActionArguments::const_iterator end () const
qint32 size () const
HActionArgumentoperator[] (qint32 index)
const HActionArgumentoperator[] (qint32 index) const
HActionArgumentoperator[] (const QString &argName)
const HActionArgumentoperator[] (const QString &argName) const
QList< QString > names () const
bool isEmpty () const
void clear ()
bool remove (const QString &name)
bool append (HActionArgument *arg)
QVariant value (const QString &name, bool *ok=0) const
bool setValue (const QString &name, const QVariant &value)
QString toString () const

Friends

H_UPNP_CORE_EXPORT bool operator== (const HActionArguments &, const HActionArguments &)

Related Functions

(Note that these are not member functions.)


H_UPNP_CORE_EXPORT void swap (HActionArguments &, HActionArguments &)
H_UPNP_CORE_EXPORT bool operator!= (const HActionArguments &, const HActionArguments &)

Detailed Description

Instances of this class are used to contain the input and output arguments for an action invocation.

Note:
The class provides iterative and keyed access to the stored HActionArgument instances. The order of action arguments during iteration is the order in which the HActionArgument objects are provided to the instance. If the class is instantiated by HUPnP, the order of the contained arguments during iteration is the order in which they are defined in the service description document.
See also:
HActionArgument
Remarks:
This class is not thread-safe.

Constructor & Destructor Documentation

Creates a new, empty instance.

See also:
isEmpty()
HActionArguments ( const QVector< HActionArgument * > &  args )

Creates a new instance from the specified input arguments and takes the ownership of the provided arguments.

Parameters:
argsspecifies the action argument objects this instance will manage.
See also:
isEmpty()
HActionArguments ( const HActionArguments other )

Copy constructor.

Creates a copy of other.

Destroys the instance.


Member Function Documentation

HActionArguments & operator= ( const HActionArguments other )

Assignment operator.

Copies the contents of other to this.

Returns:
a reference to this object.
bool contains ( const QString &  argumentName ) const

Indicates if the object contains an argument with the specified name.

Parameters:
argumentNamespecifies the name of the action argument.
Returns:
true in case the object contains an argument with the specified name.
Remarks:
this is a constant-time operation.
HActionArgument * get ( const QString &  argumentName )

Retrieves an action argument.

Retrieves an action argument with the specified name.

Parameters:
argumentNamespecifies the name of the argument to be retrieved.
Returns:
a pointer to the action argument with the specified name or a null pointer in case no argument has the specified name.
Warning:
  • Do not delete the return value. The ownership of the object is not transferred.
  • The returned object is deleted when this container is being deleted.
Remarks:
this is a constant-time operation.
const HActionArgument * get ( const QString &  argumentName ) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
argumentNamespecifies the name of the argument to be retrieved.
Returns:
a pointer to the action argument with the specified name or a null pointer in case no argument has the specified name.
HActionArgument * get ( qint32  index )

Retrieves an action argument from the specified index.

Parameters:
indexspecifies the index of the action argument to return. The index has to be valid position in the container, i.e. it must be 0 <= i < size().
Returns:
a pointer to the action argument that can be found at the specified index.
Warning:
  • Do not delete the return value. The ownership of the object is not transferred.
  • The returned object is deleted when this container is being deleted.
Remarks:
this is a constant-time operation.
const HActionArgument * get ( qint32  index ) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
indexspecifies the index of the action argument to return. The index has to be valid position in the container, i.e. it must be 0 <= i < size().
Returns:
a pointer to the action argument that can be found at the specified index.
HActionArguments::const_iterator constBegin (  ) const

Returns a const STL-style iterator pointing to the first item.

Returns:
a const STL-style iterator pointing to the first item.
HActionArguments::const_iterator constEnd (  ) const

Returns a const STL-style iterator pointing to the imaginary item after the last item.

Returns:
a const STL-style iterator pointing to the imaginary item after the last item.

Returns an STL-style iterator pointing to the first item.

Returns:
an STL-style iterator pointing to the first item.
HActionArguments::const_iterator begin (  ) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns:
an STL-style iterator pointing to the first item.

Returns an STL-style iterator pointing to the imaginary item after the last item.

Returns:
an STL-style iterator pointing to the imaginary item after the last item.
HActionArguments::const_iterator end (  ) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns:
an STL-style iterator pointing to the imaginary item after the last item.
qint32 size (  ) const

Returns the number of arguments.

Returns:
the number of arguments.
HActionArgument * operator[] ( qint32  index )

Retrieves an action argument from the specified index.

This is the same as calling get() with the specified index. This method is provided for convenience.

Parameters:
indexspecifies the index of the action argument to return. The index has to be valid position in the container, i.e. it must be 0 <= i < size().
Returns:
a pointer to the action argument that can be found at the specified index.
const HActionArgument * operator[] ( qint32  index ) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
indexspecifies the index of the action argument to return. The index has to be valid position in the container, i.e. it must be 0 <= i < size().
Returns:
a pointer to the action argument that can be found at the specified index.
HActionArgument * operator[] ( const QString &  argName )

Returns the action argument matching the specified name, if any.

This is the same as calling get() with the specified argument name. This method is provided for convenience.

Parameters:
argNamespecifies the name of the argument to be retrieved.
Returns:
a pointer to the action argument with the specified name or a null pointer in case no argument has the specified name.
const HActionArgument * operator[] ( const QString &  argName ) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
argNamespecifies the name of the argument to be retrieved.
Returns:
a pointer to the action argument with the specified name or a null pointer in case no argument has the specified name.
QList< QString > names (  ) const

The names of all the arguments.

Returns:
names of all the arguments.
bool isEmpty (  ) const

Indicates if the object is empty, i.e.

it has no arguments.

Returns:
true when the object has no arguments.
void clear (  )

Removes and deletes every contained HActionArgument from this instance.

Warning:
Calling this function makes active iterators invalid.
bool remove ( const QString &  name )

Removes and deletes an HActionArgument with the specified name.

Parameters:
namespecifies the name of the HActionArgument to be removed.
Returns:
true if an HActionArgument was found and removed.
Warning:
Calling this function makes active iterators invalid.
bool append ( HActionArgument arg )

Inserts a new HActionArgument to this instance.

Parameters:
argspecifies the HActionArgument to be added.
Returns:
true if the specified argument was added. The action argument will not be added if the instance already contains an action argument instance with the same name or the provided pointer is null.
Remarks:
  • This instance takes the ownership of the provided HActionArgument object.
Warning:
Calling this function makes active iterators invalid.
QVariant value ( const QString &  name,
bool *  ok = 0 
) const

Returns the value of the specified state variable, if such exists.

This is a convenience method for retrieving the value of the specified state variable. Semantically this call is comparable to get("stateVariable_name")->value(), but it also ensures that the specified state variable exists before attempting to get its value.

Parameters:
namespecifies the name of the state variable.
okspecifies a pointer to bool, which will be true if the specified state variable was found. This parameter is optional.
Returns:
the value of the specified state variable, if such exists. Otherwise the returned QVariant is invalid.
bool setValue ( const QString &  name,
const QVariant &  value 
)

Attempts to set the value of the specified state variable.

This is a convenience method for setting the value of the specified state variable. Semantically this call is comparable to get("stateVariable_name")->setValue(value), but it also ensures that the specified state variable exists before attempting to set its value.

Parameters:
namespecifies the name of the state variable.
valuespecifies the value of the state variable.
Returns:
true in case the value of the specified state variable was changed.
QString toString (  ) const

Returns a string representation of the object.

Returns:
a string representation of the object. The returned string contains all the arguments represented as strings and separated from each other by a new-line. The string representation of an argument is retrieved using HActionArgument::toString().

Friends And Related Function Documentation

H_UPNP_CORE_EXPORT bool operator== ( const HActionArguments ,
const HActionArguments  
) [friend]

Compares the two objects for equality.

Returns:
true in case the object are logically equivalent.
H_UPNP_CORE_EXPORT void swap ( HActionArguments a,
HActionArguments b 
) [friend]

Swaps the contents of the two containers.

H_UPNP_CORE_EXPORT bool operator!= ( const HActionArguments ,
const HActionArguments  
) [related]

Compares the two objects for inequality.

Returns:
true in case the object are not logically equivalent.