PECengine/AttributeLibrary2/SrcWVAttributes/CPEngWVInfoLinkConstruct.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2004 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:  WV InfoLink attribute constructor.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CPENGWVINFOLINKCONSTRUCT_H
       
    19 #define CPENGWVINFOLINKCONSTRUCT_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include    "CPEngWVAttributeConstructBase.h"
       
    23 #include    "CPEngWVAttributeModelBase.h"
       
    24 #include    <PEngWVPresenceAttributes2.h>
       
    25 #include    <E32Base.h>
       
    26 
       
    27 
       
    28 
       
    29 /**
       
    30  * WV InfoLink attribute constructor.
       
    31  *
       
    32  * @lib PEngAttrLib
       
    33  * @since 3.0
       
    34  */
       
    35 NONSHARABLE_CLASS( CPEngWVInfoLinkConstruct ) : public CPEngWVAttributeConstructBase
       
    36     {
       
    37 public:  // Constructors and destructor
       
    38 
       
    39     /**
       
    40      * C++ constructor.
       
    41      */
       
    42     CPEngWVInfoLinkConstruct( TPEngWVCspVersion aCurrentCspVer );
       
    43 
       
    44 
       
    45     /**
       
    46      * Destructor.
       
    47      */
       
    48     virtual ~CPEngWVInfoLinkConstruct();
       
    49 
       
    50 
       
    51 
       
    52 public: // Functions from MPEngPresenceAttrConstructorTypeImp
       
    53 
       
    54     /**
       
    55      * From MPEngPresenceAttrConstructorTypeImp.
       
    56      *
       
    57      * @since 3.0
       
    58      */
       
    59     MPEngPresenceAttrModelTypeImp* NewAttributeInstanceLC( TBool aUserOwnAttribute ) const;
       
    60 
       
    61 
       
    62 
       
    63 
       
    64 public: //Attribute model implementation
       
    65 
       
    66 
       
    67 
       
    68     /**
       
    69      * InfoLink data holder.
       
    70      *
       
    71      * @lib PEngAttrLib
       
    72      * @since 3.0
       
    73      */
       
    74     NONSHARABLE_CLASS( CPEngWVInfoLink ) : public CBase
       
    75         {
       
    76 public:  // Constructors and destructor
       
    77 
       
    78         /**
       
    79          * Two-phased constructor.
       
    80          */
       
    81         static CPEngWVInfoLink* NewLC();
       
    82         static CPEngWVInfoLink* NewLC( RReadStream& aStream );
       
    83 
       
    84         /**
       
    85          * Destructor.
       
    86          */
       
    87         virtual ~CPEngWVInfoLink();
       
    88 
       
    89 
       
    90 private:
       
    91 
       
    92         /**
       
    93          * C++ default constructor.
       
    94          */
       
    95         CPEngWVInfoLink();
       
    96 
       
    97 
       
    98 public:
       
    99 
       
   100 
       
   101         /**
       
   102          * Setters to set data fields.
       
   103          */
       
   104         void SetUrlL( const TDesC& aUrl );
       
   105         void SetDescriptionL( const TDesC& aDescr );
       
   106         void SetMimeTypeL( const TDesC& aMimeType );
       
   107 
       
   108         /**
       
   109          * Getters to access data fields.
       
   110          */
       
   111         void GetUrl( TPtrC16& aUrl ) const;
       
   112         void GetDescription( TPtrC16& aDescr ) const;
       
   113         void GetMimeType( TPtrC16& aMimeType ) const;
       
   114 
       
   115         /**
       
   116          * Serialization support.
       
   117          */
       
   118         TInt ExternalizeSize() const;
       
   119         void ExternalizeL( RWriteStream& aStream ) const;
       
   120         void InternalizeL( RReadStream& aStream );
       
   121 
       
   122 
       
   123 private:    //Data
       
   124 
       
   125         //OWN: Info link
       
   126         HBufC* iInfoLink;
       
   127 
       
   128         //OWN: Info link description
       
   129         HBufC* iInfoLinkDescr;
       
   130 
       
   131         //OWN: Info link mime type
       
   132         HBufC* iInfoLinkMimeType;
       
   133         };
       
   134 
       
   135 
       
   136 
       
   137 
       
   138     /**
       
   139      * WV InfoLink attribute implementation.
       
   140      *
       
   141      * @lib PEngAttrLib
       
   142      * @since 3.0
       
   143      */
       
   144     NONSHARABLE_CLASS( CPEngWVInfoLinkModel ): public CPEngWVAttributeModelBase
       
   145         {
       
   146 
       
   147 public:  // Constructors and destructor
       
   148 
       
   149         /**
       
   150          * Destructor.
       
   151          */
       
   152         ~CPEngWVInfoLinkModel();
       
   153 
       
   154 
       
   155         /**
       
   156          * C++ constructor.
       
   157          */
       
   158         CPEngWVInfoLinkModel( TBool aUserOwnAttribute );
       
   159 
       
   160 
       
   161 public: // From MPEngPresenceAttrModelTypeImp
       
   162 
       
   163 
       
   164         /**
       
   165          * From MPEngPresenceAttrModelTypeImp.
       
   166          */
       
   167         TBool SetDataL( TInt* aIntData,
       
   168                         const TDesC8* a8Data,
       
   169                         const TDesC16* a16Data,
       
   170                         TInt aField,
       
   171                         TInt aGroup );
       
   172 
       
   173         TBool GetData( TInt* aIntData,
       
   174                        TPtrC8* a8Data,
       
   175                        TPtrC16* a16Data,
       
   176                        TInt aField,
       
   177                        TInt aGroup ) const;
       
   178 
       
   179 
       
   180         void EncodeDataToXmlL( MPEngXMLSerializer& aSerializer ) const;
       
   181 
       
   182         void DecodeDataFromXmlL( MPEngXMLParser& aParser,
       
   183                                  const TDesC8& aValueBlock );
       
   184 
       
   185         void ResetDataL();
       
   186         TInt DataExternalizeSize() const;
       
   187         void ExternalizeDataL( RWriteStream& aStream ) const;
       
   188         void InternalizeDataL( RReadStream& aStream  );
       
   189 
       
   190 
       
   191 
       
   192 
       
   193 private: // Helpers
       
   194 
       
   195         /**
       
   196          * Helper to set info link field value.
       
   197          *
       
   198          * @param aInfoLink The infolink struct to update.
       
   199          * @param aData The new data.
       
   200          * @param aInfoLinkFieldId The field.
       
   201          * @return ETrue if the aInfoLinkFieldId was a valid
       
   202          * infolink field. Else EFalse.
       
   203          */
       
   204         TBool SetInfoLinkDataL( CPEngWVInfoLink& aInfoLink,
       
   205                                 const TDesC16& aData,
       
   206                                 TInt aInfoLinkFieldId );
       
   207 
       
   208         /**
       
   209          * Helper to get info link field value.
       
   210          *
       
   211          * @param aInfoLink The infolink struct from to get.
       
   212          * @param aInfoLinkFieldId The field to get.
       
   213          * @param aData On the return points to the field data.
       
   214          * @return ETrue if the aInfoLinkFieldId was a valid
       
   215          * infolink field. Else EFalse.
       
   216          */
       
   217         TBool GetInfoLinkData( const CPEngWVInfoLink& aInfoLink,
       
   218                                TInt aInfoLinkFieldId,
       
   219                                TPtrC16& aData ) const;
       
   220 
       
   221 
       
   222 private: //Data
       
   223 
       
   224         //OWN: Info link array
       
   225         RPointerArray< CPEngWVInfoLink > iInfoLinks;
       
   226 
       
   227         };
       
   228     };
       
   229 
       
   230 #endif      //CPENGWVINFOLINKCONSTRUCT_H
       
   231 
       
   232 //  End of File
       
   233