upnp/upnpstack_plat/upnp_common_api/inc/upnpargument.h
changeset 0 f5a58ecadc66
equal deleted inserted replaced
-1:000000000000 0:f5a58ecadc66
       
     1 /** @file
       
     2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies  this distribution, and is available 
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Declares the CUpnpArgument class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CUPNPARGUMENT_H
       
    20 #define C_CUPNPARGUMENT_H
       
    21 
       
    22 // INCLUDES 
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <badesca.h>
       
    26 #include "upnpcons.h"
       
    27 
       
    28 // ENUMERATIONS
       
    29 
       
    30 enum { EIn, EOut };
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 
       
    34 class CUpnpSoapMessage;
       
    35 class CUpnpService;
       
    36 
       
    37 // CLASS DECLARATION
       
    38 
       
    39 /**
       
    40 *  Used to make a common body for actions.
       
    41 *  This class is only used when an action is sent or received.
       
    42 *  This class makes a common body for actions, which can then be modified by user.
       
    43 *
       
    44 *  @since Series60 2.6
       
    45 */
       
    46 class CUpnpArgument : public CBase
       
    47 {
       
    48 public: // Constructors and destructor
       
    49     static CUpnpArgument* NewL( CUpnpService& aParentService );
       
    50         
       
    51     /**
       
    52     * Two-phased constructor for building from a XML node.
       
    53     * Internally uses the function NewL(CSereneElement*)
       
    54     */
       
    55     static CUpnpArgument* NewL( CUpnpArgument& aArgument, 
       
    56                                          CUpnpService& aParentService );
       
    57     
       
    58     /** 
       
    59     * Destructor.
       
    60     */
       
    61     virtual ~CUpnpArgument();
       
    62     
       
    63 public: // New functions
       
    64 
       
    65     /**
       
    66     * Returns type of the argument.
       
    67     * @since Series60 2.6
       
    68     * @return TArgumentType.
       
    69     */
       
    70     IMPORT_C TArgumentType Type();
       
    71 
       
    72     /**
       
    73     * Returns direction of the argument.
       
    74     * @since Series60 2.6
       
    75     * @return EIn or EOut.
       
    76     */
       
    77     IMPORT_C TInt Direction() const;
       
    78 
       
    79     /**
       
    80     * Returns related state variable.
       
    81     * @since Series60 2.6
       
    82     * @return the related state variable
       
    83     */
       
    84     IMPORT_C TDesC8& RelatedStateVariable();
       
    85 
       
    86     /**
       
    87     * Returns the name of the argument.
       
    88     * @since Series60 2.6
       
    89     * @return argument name
       
    90     */
       
    91     IMPORT_C TDesC8& Name();
       
    92 
       
    93     /**
       
    94     * Returns the value of the argument.
       
    95     * @since Series60 2.6
       
    96     * @return Value of argument.
       
    97     */
       
    98     IMPORT_C TDesC8& Value();
       
    99 
       
   100     /**
       
   101     * Sets the value of argument.
       
   102     * @since Series60 2.6
       
   103     * (If the value is inproper, the method leaves with EInvalidArgs,
       
   104 	* which is the internal upnp error code used by UPnP Stack)
       
   105     * @param aValue Value that is to be set for this argument.
       
   106     */
       
   107     IMPORT_C void SetValueL( const TDesC8& aValue );
       
   108     
       
   109     void SetDirectionL( TInt aDirection );
       
   110     
       
   111     void SetNameL(const TDesC8& aDirection );
       
   112     
       
   113     void SetRelatedStateVarL(const TDesC8& aRelatedStateVar);
       
   114  
       
   115     void ConstructL();
       
   116      
       
   117     void SetType( TInt aType );
       
   118     
       
   119 private: // Constructors
       
   120 
       
   121     /**
       
   122     * C++ default constructor.
       
   123     * @param aParentService Parent service.
       
   124     */
       
   125     CUpnpArgument( CUpnpService& aParentService );
       
   126         
       
   127     /**
       
   128     * By default Symbian 2nd phase constructor is private.
       
   129     * Adds the arguments and their default values according to the XML node
       
   130     * @param aNode CSenElement.
       
   131     */
       
   132     void ConstructL( CUpnpArgument& aArgument );
       
   133 
       
   134     /**
       
   135     * Delete and null iValue member.
       
   136     */
       
   137     void DeleteAndNullValue();
       
   138     
       
   139     /**
       
   140     * Checks the error code for the SetValue method and leaves if needed.
       
   141     */
       
   142     void CheckErrorL(TInt aError, const TDesC8& aValue);
       
   143 private: // Data
       
   144 
       
   145     // Argument name buffer, owned
       
   146     HBufC8*     iName;
       
   147 
       
   148     // Related state varable buffer, owned
       
   149     HBufC8*     iRelatedStateVariable;
       
   150 
       
   151     // Direction, owned
       
   152     TInt        iDirection;
       
   153     
       
   154     // Value of the related state variable
       
   155     HBufC8*     iValue;
       
   156 
       
   157     // Type of the related state variable
       
   158     TInt        iType;
       
   159     
       
   160     // Parent service, owned
       
   161     CUpnpService&   iParentService;
       
   162 };
       
   163 
       
   164 #endif // C_CUPNPARGUMENT_H
       
   165 
       
   166 // End of File