PECengine/ListLibrary2/AuthSrc/CPEngAuthorizationResponse.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2005 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:  Container of one reactive authorization response
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __CPENGAUTHORIZATIONRESPONSE_H__
       
    19 #define __CPENGAUTHORIZATIONRESPONSE_H__
       
    20 
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include "CPEngAuthorizationItem.h"
       
    25 #include "MPEngAuthorizationStatus.h"
       
    26 
       
    27 
       
    28 // CLASS DECLARATION
       
    29 /**
       
    30  * Container of one reactive authorization response
       
    31  *
       
    32  * @lib PEngListLib2
       
    33  * @since 3.0
       
    34  */
       
    35 class CPEngAuthorizationResponse : public CPEngAuthorizationItem,
       
    36             public MPEngAuthorizationStatus
       
    37     {
       
    38     public:  // Constructors and destructor
       
    39 
       
    40         /**
       
    41          * Two-phased constructor,
       
    42          */
       
    43         static CPEngAuthorizationResponse* NewLC( const TDesC& aUserId,
       
    44                                                   TInt& aSize );
       
    45 
       
    46         /**
       
    47          * Two-phased constructor, constructs class from the stream
       
    48          */
       
    49         static CPEngAuthorizationResponse* NewLC( RReadStream& aStream,
       
    50                                                   TInt& aSize );
       
    51 
       
    52         /**
       
    53          * Destructor.
       
    54          */
       
    55         virtual ~CPEngAuthorizationResponse();
       
    56 
       
    57 
       
    58 
       
    59     public: // from CPEngAuthorizationItem
       
    60 
       
    61         /**
       
    62          * Update local flag
       
    63          * @see <CPEngAuthorizationItem.h>
       
    64          */
       
    65         void DoUpdateLocalFlags( const CPEngAuthorizationItem& aSource );
       
    66 
       
    67 
       
    68 
       
    69     public: // From MPEngAuthorizationStatus
       
    70 
       
    71         /**
       
    72          * User id of the user authorization was issued to
       
    73          * @since 3.0
       
    74          * @see <MPEngAuthorizationStatus.h>
       
    75          */
       
    76         const TDesC& UserId() const;
       
    77 
       
    78 
       
    79         /**
       
    80          * Status of the authorization
       
    81          * @since 3.0
       
    82          * @see <MPEngAuthorizationStatus.h>
       
    83          */
       
    84         TInt AuthorizationStatus() const;
       
    85 
       
    86 
       
    87         /**
       
    88          * List of authorized attributes
       
    89          * @since 3.0
       
    90          * @see <MPEngAuthorizationStatus.h>
       
    91          */
       
    92         const RArray<TUint32>& AuthorizedAttributes() const;
       
    93 
       
    94         /**
       
    95          * Contact item extension interface.
       
    96          * @since 3.0
       
    97          * @see <MPEngAuthorizationStatus.h>
       
    98          */
       
    99         MPEngAuthorizationStatusExt* Extension() {
       
   100             return NULL;
       
   101             };
       
   102         const MPEngAuthorizationStatusExt* Extension() const {
       
   103             return NULL;
       
   104             };
       
   105 
       
   106 
       
   107     public: // New functions
       
   108 
       
   109         /**
       
   110          * Set Response type
       
   111          *
       
   112          * @since 3.0
       
   113          * @param aResponseType type of the response
       
   114          */
       
   115         void SetResponseType( TInt aResponseType );
       
   116 
       
   117 
       
   118         /**
       
   119          * Set attributes to be authorized
       
   120          * If already authorized attributes are passed, they are included
       
   121          * as well then, in order to keep their authorization
       
   122          *
       
   123          * @since 3.0
       
   124          * @param aAttributes attributes to be authorized
       
   125          */
       
   126         void SetAttributesToAuthorizeL(
       
   127             const TArray<TUint32>& aAttributes,
       
   128             const RArray<TUint32>* aAuthorizedAttributes );
       
   129 
       
   130         /**
       
   131          * Add Attribute to the authorized attributes
       
   132          *
       
   133          * @since 3.0
       
   134          * @param aAttribute attribute to add to authorized attributes
       
   135          */
       
   136         void AddAttributeL( TUint32 aAttribute );
       
   137 
       
   138 
       
   139         /**
       
   140          * Externalize to the given stream
       
   141          * @since 3.0
       
   142          * @param aStream write stream
       
   143          */
       
   144         void ExternalizeL( RWriteStream& aStream ) const ;
       
   145 
       
   146 
       
   147         /**
       
   148          * Internalize from the given stream
       
   149          * @since 3.0
       
   150          * @param aStream read stream
       
   151          */
       
   152         void InternalizeL( RReadStream& aStream );
       
   153 
       
   154 
       
   155     public: // Function for the
       
   156 
       
   157         /**
       
   158          * Compare function toe use with RPointerArray.
       
   159          *
       
   160          * Two instances are compared based on the TDesC.CompareF function
       
   161          * of the requesting Id
       
   162          *
       
   163          * @since 3.0
       
   164          * @param aFirst fist class for comparison
       
   165          * @param aSecond second class for comparison
       
   166          * @return -1 if fist is smaller,
       
   167          *         +1 is second is smaller,
       
   168          *         0 if they are same
       
   169          */
       
   170         static TInt Compare( const CPEngAuthorizationResponse& aFirst,
       
   171                              const CPEngAuthorizationResponse& aSecond );
       
   172 
       
   173     private: // constructors
       
   174 
       
   175         /**
       
   176          * C++ constructor.
       
   177          */
       
   178         CPEngAuthorizationResponse( TInt& aSize );
       
   179 
       
   180         /**
       
   181          * Symbian constructor.
       
   182          */
       
   183         void ConstructL( const TDesC& aUserId );
       
   184 
       
   185 
       
   186     private:    // Data
       
   187 
       
   188         /// OWN: Response type
       
   189         TInt                      iResponseType;
       
   190 
       
   191         /// OWN: Attributes to be authorized
       
   192         RArray<TUint32>           iAttributes;
       
   193 
       
   194     };
       
   195 
       
   196 #endif      // __CPENGAUTHORIZATIONRESPONSE_H__
       
   197 
       
   198 // End of File
       
   199