ncdengine/inc/ncdutils.h
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2006-2008 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:   Public utility classes for NCD provider usage.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef M_NCD_UTILS_H
       
    20 #define M_NCD_UTILS_H
       
    21 
       
    22 
       
    23 #include <e32cmn.h>
       
    24 #include <s32strm.h>
       
    25 #include <badesca.h>
       
    26 
       
    27 #include "ncdkeyvaluepair.h"
       
    28 #include "ncdpurchasedownloadinfo.h"
       
    29 #include "ncdpurchaseinstallinfo.h"
       
    30 #include "ncdpurchasehistoryfilter.h"
       
    31 #include "ncdpurchasedetails.h"
       
    32 #include "ncdsearchfilter.h"
       
    33 
       
    34 class MNcdClientLocalizer;
       
    35 class CNcdString;
       
    36 class CNcdAttributes;
       
    37 
       
    38 /**
       
    39  *  A default implementation for the MNcdKeyValuePair interface,
       
    40  *  providing storage for the key and value in simple heap allocated
       
    41  *  buffers.
       
    42  *
       
    43  *  @lib ncdutils_20019119.dll
       
    44  *  
       
    45  *  @see MNcdKeyValuePair
       
    46  */
       
    47 class CNcdKeyValuePair : public CBase, public MNcdKeyValuePair
       
    48     {
       
    49 public: // Construction & destruction
       
    50 
       
    51     /**
       
    52      * Constructor.
       
    53      *
       
    54      * @param aKey Key. Can not be empty
       
    55      * @param aValue Value. Can be an empty descriptor
       
    56      * 
       
    57      * @return Pointer to the created object.
       
    58      * @exception System wide error code.
       
    59      * @throw KErrArgument if aKey is empty
       
    60      */
       
    61     IMPORT_C static CNcdKeyValuePair* NewL( 
       
    62         const TDesC& aKey, const TDesC& aValue );
       
    63     
       
    64     /**
       
    65      * Constructor, leaves pointer on clean-up stack.
       
    66      *
       
    67      * @param aKey Key. Can not be empty
       
    68      * @param aValue Value. Can be an empty descriptor
       
    69      * 
       
    70      * @return Pointer to the created object.
       
    71      * @exception System wide error code.
       
    72      * @throw KErrArgument if aKey is empty
       
    73      */
       
    74     IMPORT_C static CNcdKeyValuePair* NewLC(
       
    75         const TDesC& aKey, const TDesC& aValue );
       
    76     
       
    77 
       
    78     /**
       
    79     * Creates a copy of an key-value -pair.
       
    80     * 
       
    81     * @param aOther Pair to copy
       
    82     * @return A copy of the given pair
       
    83     */
       
    84     IMPORT_C static CNcdKeyValuePair* NewL( const MNcdKeyValuePair& aOther );
       
    85 
       
    86     
       
    87    /**
       
    88     * Creates a copy of the key-value -pair, leaves pointer on clean-up stack
       
    89     * 
       
    90     * @param aOther Pair to copy
       
    91     * @return A copy of the given pair
       
    92     */
       
    93     IMPORT_C static CNcdKeyValuePair* NewLC( const MNcdKeyValuePair& aOther );
       
    94 
       
    95 
       
    96     /** 
       
    97      * Internalizes the key-value pair from a stream
       
    98      *
       
    99      * @param aStream
       
   100      * @return A new key-value pair
       
   101      */     
       
   102     IMPORT_C static CNcdKeyValuePair* NewL( RReadStream& aStream );
       
   103 
       
   104 
       
   105     /** 
       
   106      * Internalizes the key-value pair from a stream
       
   107      *
       
   108      * @param aStream
       
   109      * @return A new key-value pair
       
   110      */     
       
   111     IMPORT_C static CNcdKeyValuePair* NewLC( RReadStream& aStream );
       
   112     
       
   113             
       
   114     /**
       
   115      * Destructor.
       
   116      *
       
   117      * 
       
   118      */
       
   119     virtual ~CNcdKeyValuePair();
       
   120 
       
   121 public: // from MNcdKeyValuePair
       
   122 
       
   123     /**
       
   124      * Returns the key set for the pair.
       
   125      * 
       
   126      * 
       
   127      * @return Key of the pair.
       
   128      */
       
   129     const TDesC& Key() const;
       
   130 
       
   131     /**
       
   132      * Returns the value set for the pair.
       
   133      * 
       
   134      * 
       
   135      * @return Value of the pair.
       
   136      */
       
   137     const TDesC& Value() const;
       
   138 
       
   139 public: // new functions
       
   140 
       
   141     /**
       
   142      * Set the key for the pair.
       
   143      * 
       
   144      * 
       
   145      * @param aKey Key for the pair.     
       
   146      * @throw KErrArgument if the key is empty
       
   147      */
       
   148     IMPORT_C void SetKeyL( const TDesC& aKey );
       
   149 
       
   150     /**
       
   151      * Set the value for the pair.
       
   152      * 
       
   153      * 
       
   154      * @param aValue value for the pair.
       
   155      */
       
   156     IMPORT_C void SetValueL( const TDesC& aValue );
       
   157     
       
   158 
       
   159     /** 
       
   160      * Comparison method. Compares the keys of two pairs to 
       
   161      * determine equivalence.
       
   162      *
       
   163      * @return  Boolean, ETrue if pairs match.
       
   164      */
       
   165     IMPORT_C static TBool MatchByKey( 
       
   166         const CNcdKeyValuePair& aFirst, 
       
   167         const CNcdKeyValuePair& aSecond );
       
   168 
       
   169 
       
   170     /**
       
   171      * Externalizes the pair to a stream
       
   172      *
       
   173      * @param aStream Target stream
       
   174      */
       
   175     IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
       
   176 
       
   177 
       
   178     /**
       
   179      * Externalizes the pair to a descriptor
       
   180      *
       
   181      * @return Descriptor containing the pair
       
   182      */
       
   183     IMPORT_C HBufC8* ExternalizeToDesLC() const;
       
   184     
       
   185 
       
   186     /**
       
   187      * Internalizes the pair from a stream
       
   188      *
       
   189      * @param aStream Source stream
       
   190      */
       
   191     IMPORT_C void InternalizeL( RReadStream& aStream );
       
   192 
       
   193 private: // Construction & assignment
       
   194 
       
   195     /**
       
   196      * Private 2nd phase constructor.
       
   197      */
       
   198     void ConstructL( const TDesC& aKey, const TDesC& aValue );
       
   199     
       
   200     /**
       
   201      * Private constructor.
       
   202      */
       
   203     CNcdKeyValuePair();
       
   204 
       
   205 private: // Data members
       
   206 
       
   207     // Key of the pair
       
   208     HBufC* iKey;
       
   209     
       
   210     // Value of the pair
       
   211     HBufC* iValue;
       
   212     
       
   213     };
       
   214 
       
   215 
       
   216 /**
       
   217  *  A default implementation for the MNcdPurchaseDownloadInfo interface.
       
   218  *
       
   219  *  @lib ncdutils_20019119.dll
       
   220  *  
       
   221  *  @see MNcdPurchaseDownloadInfo
       
   222  */
       
   223 class CNcdPurchaseDownloadInfo : public CBase,
       
   224                                  public MNcdPurchaseDownloadInfo
       
   225     {
       
   226 public: // construction and destruction
       
   227 
       
   228     /**
       
   229      * Constructor.
       
   230      * 
       
   231      * 
       
   232      * @return Download information class.
       
   233      */
       
   234     IMPORT_C static CNcdPurchaseDownloadInfo* NewL();
       
   235 
       
   236     /**
       
   237      * Constructor.
       
   238      * 
       
   239      * 
       
   240      * @return Download information class.
       
   241      */
       
   242     IMPORT_C static CNcdPurchaseDownloadInfo* NewLC();
       
   243 
       
   244     /**
       
   245      * Copies and returns new download information.
       
   246      * 
       
   247      * 
       
   248      * @param aSource Download information to be copied.
       
   249      * @return Download information class.
       
   250      */
       
   251     IMPORT_C static CNcdPurchaseDownloadInfo* NewL( 
       
   252         const MNcdPurchaseDownloadInfo& aSource );
       
   253 
       
   254     /**
       
   255      * Copies and returns new download information.
       
   256      * 
       
   257      * 
       
   258      * @param aSource Download information to be copied.
       
   259      * @return Download information class.
       
   260      */
       
   261     IMPORT_C static CNcdPurchaseDownloadInfo* NewLC(
       
   262         const MNcdPurchaseDownloadInfo& aSource );
       
   263 
       
   264     /**
       
   265      * Destructor.
       
   266      * Because a class object outside of this library may be inherited 
       
   267      * from this class, this virtual destructor is also set to 
       
   268      * IMPORT_C.
       
   269      */
       
   270     IMPORT_C virtual ~CNcdPurchaseDownloadInfo();
       
   271 
       
   272 public: // from MNcdPurchaseDownloadInfo
       
   273 
       
   274     /**
       
   275      * Gets the content usage type.
       
   276      * 
       
   277      * 
       
   278      * @return Content usage.
       
   279      */
       
   280     IMPORT_C TContentUsage ContentUsage() const;
       
   281 
       
   282     /**
       
   283      * Gets the content URI.
       
   284      * 
       
   285      * 
       
   286      * @return Content URI.
       
   287      */
       
   288     IMPORT_C const TDesC& ContentUri() const;
       
   289 
       
   290     /**
       
   291      * Gets the content validity delta.
       
   292      * 
       
   293      * 
       
   294      * @return Content validity delta. -1 if not set.
       
   295      */
       
   296     IMPORT_C TInt ContentValidityDelta() const;
       
   297 
       
   298     /**
       
   299      * Gets the content mime type.
       
   300      * 
       
   301      * 
       
   302      * @return Content mime type.
       
   303      */
       
   304     IMPORT_C const TDesC& ContentMimeType() const;
       
   305 
       
   306     /**
       
   307      * Gets the content size.
       
   308      * 
       
   309      * 
       
   310      * @return Content size.
       
   311      */
       
   312     IMPORT_C TInt ContentSize() const;
       
   313 
       
   314     /**
       
   315      * Is content launchable.
       
   316      * 
       
   317      * 
       
   318      * @return Launchable status.
       
   319      */
       
   320     IMPORT_C TBool IsLaunchable() const;
       
   321 
       
   322     /**
       
   323      * Gets the descriptor type.
       
   324      * 
       
   325      * 
       
   326      * @return Descriptor type.
       
   327      */
       
   328     IMPORT_C const TDesC& DescriptorType() const;
       
   329 
       
   330     /**
       
   331      * Gets the descriptor name.
       
   332      * 
       
   333      * 
       
   334      * @return Descriptor name.
       
   335      */
       
   336     IMPORT_C const TDesC& DescriptorName() const;
       
   337 
       
   338     /**
       
   339      * Gets the descriptor URI.
       
   340      * 
       
   341      * 
       
   342      * @return Descriptor URI.
       
   343      */
       
   344     IMPORT_C const TDesC& DescriptorUri() const;
       
   345 
       
   346     /**
       
   347      * Gets the descriptor data.
       
   348      * 
       
   349      * 
       
   350      * @return Descriptor data.
       
   351      */
       
   352     IMPORT_C const TDesC8& DescriptorData() const;
       
   353 
       
   354     /**
       
   355      * Gets the rights URI.
       
   356      * 
       
   357      * 
       
   358      * @return Rights URI.
       
   359      */
       
   360     IMPORT_C const TDesC& RightsUri() const;
       
   361 
       
   362     /**
       
   363      * Gets the rights type.
       
   364      * 
       
   365      * 
       
   366      * @return Rights type.
       
   367      */
       
   368     IMPORT_C const TDesC& RightsType() const;
       
   369 
       
   370     /**
       
   371      * Gets the activation key.
       
   372      *
       
   373      * 
       
   374      * @return Activation key.
       
   375      */
       
   376     IMPORT_C const TDesC& ActivationKey() const;
       
   377     
       
   378     /**
       
   379      * Gets the install notification URI.
       
   380      *
       
   381      * 
       
   382      * @return Install notification URI.
       
   383      */
       
   384     IMPORT_C const TDesC& InstallNotificationUri() const;
       
   385     
       
   386     
       
   387     /**
       
   388      * @see MNcdDownloadInfo::AttributeStringL
       
   389      */
       
   390     IMPORT_C const TDesC& AttributeStringL( TDownloadAttribute aAttribute ) const;
       
   391     
       
   392 
       
   393     /**
       
   394      * @see MNcdDownloadInfo::AttributeInt32L
       
   395      */
       
   396     IMPORT_C TInt32 AttributeInt32L( TDownloadAttribute aAttribute ) const;
       
   397     
       
   398     
       
   399 public: // new methods
       
   400 
       
   401     /**
       
   402      * Externalizer.
       
   403      * 
       
   404      * 
       
   405      * @param aStream Write stream.
       
   406      */
       
   407     IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
       
   408 
       
   409     /**
       
   410      * Internalizer.
       
   411      * 
       
   412      * 
       
   413      * @param aStream Read stream.
       
   414      */
       
   415     IMPORT_C void InternalizeL( RReadStream& aStream );
       
   416 
       
   417     /**
       
   418      * Sets the content usage type.
       
   419      * 
       
   420      * 
       
   421      * @param aUsage Content usage.
       
   422      */
       
   423     IMPORT_C void SetContentUsage( TContentUsage aUsage );
       
   424 
       
   425     /**
       
   426      * Sets the content URI.
       
   427      * 
       
   428      * 
       
   429      * @param aUri Content URI.
       
   430      */
       
   431     IMPORT_C void SetContentUriL( const TDesC& aUri );
       
   432 
       
   433     /**
       
   434      * Sets the content validity delta.
       
   435      * 
       
   436      * 
       
   437      * @return Content validity delta.
       
   438      */
       
   439     IMPORT_C void SetContentValidityDelta( TInt aValidityDelta );
       
   440 
       
   441     /**
       
   442      * Sets the content mime type.
       
   443      * 
       
   444      * 
       
   445      * @param aMimeType Content mime type.
       
   446      */
       
   447     IMPORT_C void SetContentMimeTypeL( const TDesC& aMimeType );
       
   448 
       
   449     /**
       
   450      * Sets the content size.
       
   451      * 
       
   452      * 
       
   453      * @param aSize Content size.
       
   454      */
       
   455     IMPORT_C void SetContentSize( TInt aSize );
       
   456 
       
   457     /**
       
   458      * Sets content launchable.
       
   459      * 
       
   460      * 
       
   461      * @param aLaunchable Launchable status.
       
   462      */
       
   463     IMPORT_C void SetLaunchable( TBool aLaunchable );
       
   464 
       
   465     /**
       
   466      * Sets the descriptor type.
       
   467      * 
       
   468      * 
       
   469      * @param aType Descriptor type.
       
   470      */
       
   471     IMPORT_C void SetDescriptorTypeL( const TDesC& aType );
       
   472 
       
   473     /**
       
   474      * Sets the descriptor name.
       
   475      * 
       
   476      * 
       
   477      * @param aName Descriptor name.
       
   478      */
       
   479     IMPORT_C void SetDescriptorNameL( const TDesC& aName );
       
   480 
       
   481     /**
       
   482      * Sets the descriptor URI.
       
   483      * 
       
   484      * 
       
   485      * @param aUri Descriptor URI.
       
   486      */
       
   487     IMPORT_C void SetDescriptorUriL( const TDesC& aUri );
       
   488 
       
   489     /**
       
   490      * Sets the descriptor data.
       
   491      * 
       
   492      * 
       
   493      * @param aData Descriptor data.
       
   494      */
       
   495     IMPORT_C void SetDescriptorDataL( const TDesC8& aData );
       
   496 
       
   497     /**
       
   498      * Sets the rights URI.
       
   499      * 
       
   500      * 
       
   501      * @param aUri Rights URI.
       
   502      */
       
   503     IMPORT_C void SetRightsUriL( const TDesC& aUri );
       
   504 
       
   505     /**
       
   506      * Sets the rights type.
       
   507      * 
       
   508      * 
       
   509      * @param aType Rights type.
       
   510      */
       
   511     IMPORT_C void SetRightsTypeL( const TDesC& aType );
       
   512 
       
   513     /**
       
   514      * Sets the activation key.
       
   515      * 
       
   516      * 
       
   517      * @param aActivationKey Activation key.
       
   518      */
       
   519     IMPORT_C void SetActivationKeyL( const TDesC& aActivationKey );
       
   520 
       
   521     /**
       
   522      * Sets the install notification URI.
       
   523      * 
       
   524      * 
       
   525      * @param aInstallNotificationUri Install notification URI.
       
   526      */
       
   527     IMPORT_C void SetInstallNotificationUriL( const TDesC& aInstallNotificationUri );
       
   528     
       
   529     /**
       
   530      * Integer attribute setter
       
   531      */
       
   532     IMPORT_C void SetAttributeL( TDownloadAttribute aAttribute, TInt32 aValue );
       
   533     
       
   534     /**
       
   535      * String attribute setter
       
   536      */
       
   537     IMPORT_C void SetAttributeL( TDownloadAttribute aAttribute, const TDesC& aValue );
       
   538     
       
   539 
       
   540 protected: // Protected and imported constructor functions enable inheritance
       
   541            // outside of this library.
       
   542 
       
   543     /**
       
   544      * Constructor.
       
   545      */
       
   546     IMPORT_C CNcdPurchaseDownloadInfo();
       
   547 
       
   548     /**
       
   549      * 2nd phase constructor.
       
   550      */
       
   551     IMPORT_C void ConstructL();
       
   552 
       
   553     /**
       
   554      * Alternative 2nd phase constructor.
       
   555      */
       
   556     IMPORT_C void ConstructL( const MNcdPurchaseDownloadInfo& aSource );
       
   557 
       
   558 
       
   559     /**
       
   560      * Creates attributes if they haven't been created yet
       
   561      */
       
   562     IMPORT_C void CreateAttributesL();
       
   563     
       
   564         
       
   565 private:
       
   566 
       
   567     // Content usage.
       
   568     TContentUsage iContentUsage;
       
   569 
       
   570     // Content URI.
       
   571     HBufC* iContentUri;
       
   572     
       
   573     // Content validity delta.
       
   574     TInt iValidityDelta;
       
   575 
       
   576     // Content mime type.
       
   577     HBufC* iContentMimeType;
       
   578 
       
   579     // Content size.
       
   580     TInt iContentSize;
       
   581 
       
   582     // Launchable status.
       
   583     TBool iLaunchable;
       
   584 
       
   585     // Descriptor type.
       
   586     HBufC* iDescriptorType;
       
   587 
       
   588     // Descriptor name.
       
   589     HBufC* iDescriptorName;
       
   590 
       
   591     // Descriptor URI.
       
   592     HBufC* iDescriptorUri;
       
   593 
       
   594     // Descriptor data.
       
   595     HBufC8* iDescriptorData;
       
   596 
       
   597     // Rights URI.
       
   598     HBufC* iRightsUri;
       
   599 
       
   600     // Rights type.
       
   601     HBufC* iRightsType;
       
   602 
       
   603     // Activation key.
       
   604     HBufC* iActivationKey;
       
   605 
       
   606     // Install notification URI.
       
   607     HBufC* iInstallNotificationUri;
       
   608 
       
   609     CNcdAttributes* iAttributes;
       
   610     };
       
   611 
       
   612 
       
   613 /**
       
   614  *  A default implementation for the MNcdPurchaseInstallInfo interface.
       
   615  *
       
   616  *  @lib ncdutils_20019119.dll
       
   617  *  
       
   618  *  @see MNcdPurchaseInstallInfo
       
   619  */
       
   620 class CNcdPurchaseInstallInfo : public CBase,
       
   621                                 public MNcdPurchaseInstallInfo
       
   622     {
       
   623 public: // construction and destruction
       
   624 
       
   625     /**
       
   626      * Constructor.
       
   627      * 
       
   628      * 
       
   629      * @return File installation information class.
       
   630      */
       
   631     IMPORT_C static CNcdPurchaseInstallInfo* NewL();
       
   632 
       
   633     /**
       
   634      * Constructor.
       
   635      * 
       
   636      * 
       
   637      * @return File installation information class.
       
   638      */
       
   639     IMPORT_C static CNcdPurchaseInstallInfo* NewLC();
       
   640 
       
   641     /**
       
   642      * Copies and returns new file installation information.
       
   643      * 
       
   644      * 
       
   645      * @param aSource File installation information to be copied.
       
   646      * @return File installation information class.
       
   647      */
       
   648     IMPORT_C static CNcdPurchaseInstallInfo* NewL( 
       
   649         const MNcdPurchaseInstallInfo& aSource );
       
   650 
       
   651     /**
       
   652      * Copies and returns new file installation information.
       
   653      * 
       
   654      * 
       
   655      * @param aSource File installation information to be copied.
       
   656      * @return File installation information class.
       
   657      */
       
   658     IMPORT_C static CNcdPurchaseInstallInfo* NewLC(
       
   659         const MNcdPurchaseInstallInfo& aSource );
       
   660 
       
   661     /**
       
   662      * Destructor
       
   663      */
       
   664     IMPORT_C virtual ~CNcdPurchaseInstallInfo();
       
   665 
       
   666 public: // from MNcdPurchaseInstallInfo
       
   667 
       
   668     /**
       
   669      * Get name and path of installed file.
       
   670      * 
       
   671      * 
       
   672      * @return File name.
       
   673      */
       
   674     IMPORT_C const TDesC& Filename() const;
       
   675     
       
   676     /**
       
   677      * Get application UID of installed application.
       
   678      * 
       
   679      * 
       
   680      * @return TUid Application UID.
       
   681      */
       
   682     IMPORT_C TUid ApplicationUid() const;
       
   683     
       
   684     /**
       
   685      * Get application version of installed application.
       
   686      * 
       
   687      * 
       
   688      * @return Application version.
       
   689      */
       
   690     IMPORT_C const TDesC& ApplicationVersion() const;
       
   691     
       
   692     /**
       
   693      * Get name of installed theme.
       
   694      * 
       
   695      * 
       
   696      * @return Theme name.
       
   697      */
       
   698     IMPORT_C const TDesC& ThemeName() const;
       
   699     
       
   700 
       
   701 public: // new methods
       
   702 
       
   703 
       
   704     /**
       
   705      * Externalizer
       
   706      * 
       
   707      * 
       
   708      * @param aStream Write stream
       
   709      */
       
   710     IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
       
   711     
       
   712     /**
       
   713      * Internalizer
       
   714      * 
       
   715      * 
       
   716      * @param aStream Read stream
       
   717      */
       
   718     IMPORT_C void InternalizeL( RReadStream& aStream );
       
   719 
       
   720     /**
       
   721      * Set name and path of installed file.
       
   722      * 
       
   723      * 
       
   724      * @param aFilename File name.
       
   725      */
       
   726     IMPORT_C void SetFilenameL( const TDesC& aFilename );
       
   727     
       
   728     /**
       
   729      * Set application UID of installed application.
       
   730      * 
       
   731      * 
       
   732      * @param aApplicationUid Application UID.
       
   733      */
       
   734     IMPORT_C void SetApplicationUid( const TUid aApplicationUid );
       
   735 
       
   736     /**
       
   737      * Set application version of installed application.
       
   738      * 
       
   739      * 
       
   740      * @param aApplicationVersion Application version.
       
   741      */
       
   742     IMPORT_C void SetApplicationVersionL( const TDesC& aApplicationVersion );
       
   743     
       
   744     /**
       
   745      * Set name of installed theme.
       
   746      * 
       
   747      * 
       
   748      * @param aThemeName Theme name.
       
   749      */
       
   750     IMPORT_C void SetThemeNameL( const TDesC& aThemeName );
       
   751 
       
   752 protected:
       
   753 
       
   754     /**
       
   755      * Private 2nd phase constructor.
       
   756      */
       
   757     IMPORT_C void BaseConstructL();
       
   758 
       
   759 
       
   760     /**
       
   761      * Private 2nd phase constructor.
       
   762      */
       
   763     IMPORT_C void BaseConstructL( const MNcdPurchaseInstallInfo& aSource );
       
   764 
       
   765     /**
       
   766      * Private constructor.
       
   767      */
       
   768     IMPORT_C CNcdPurchaseInstallInfo();
       
   769 
       
   770 private:
       
   771 
       
   772     // Name and path of installed file.
       
   773     HBufC* iFilename;
       
   774 
       
   775     // Application UID of installed application.
       
   776     TUid iApplicationUid;
       
   777 
       
   778     // Application version of installed application.
       
   779     HBufC* iApplicationVersion;
       
   780 
       
   781     // Name of installed theme.
       
   782     HBufC* iThemeName;
       
   783 
       
   784     };
       
   785 
       
   786 
       
   787 /**
       
   788  *  A default implementation for the MNcdPurchaseHistoryFilter interface.
       
   789  *
       
   790  *  @lib ncdutils_20019119.dll
       
   791  *  
       
   792  *  @see MNcdPurchaseHistoryFilter
       
   793  */
       
   794  class CNcdPurchaseHistoryFilter : public CBase,
       
   795                                    public MNcdPurchaseHistoryFilter
       
   796     {
       
   797 public: // Construction & destruction
       
   798 
       
   799     /**
       
   800      * Constructor.
       
   801      * @return CNcdPurchaseHistoryFilter* Filter for purchase event queries.
       
   802      */
       
   803     IMPORT_C static CNcdPurchaseHistoryFilter* NewL();
       
   804     
       
   805     /**
       
   806      * Constructor.
       
   807      * @return CNcdPurchaseHistoryFilter* Filter for purchase event queries.
       
   808      */
       
   809     IMPORT_C static CNcdPurchaseHistoryFilter* NewLC();
       
   810     
       
   811     /**
       
   812      * Constructor.
       
   813      * @param aClientUids Client UIDs.
       
   814      * @param aNamespace Namespace. Can be KNullDesC.
       
   815      * @param aEntityId Entity ID. Can be KNullDesC.
       
   816      * @param aEventId Event ID.
       
   817      * @return CNcdPurchaseHistoryFilter* Filter for purchase event queries.
       
   818      */
       
   819     IMPORT_C static CNcdPurchaseHistoryFilter* NewL(
       
   820         TArray< TUid > aClientUids,
       
   821         const TDesC& aNamespace,
       
   822         const TDesC& aEntityId,
       
   823         const TUint aEventId );
       
   824     
       
   825     /**
       
   826      * Constructor.
       
   827      * @param aClientUids Client UIDs.
       
   828      * @param aNamespace Namespace. Can be KNullDesC.
       
   829      * @param aEntityId Entity ID. Can be KNullDesC.
       
   830      * @param aEventId Event ID.
       
   831      * @return CNcdPurchaseHistoryFilter* Filter for purchase event queries.
       
   832      */
       
   833     IMPORT_C static CNcdPurchaseHistoryFilter* NewLC(
       
   834         TArray< TUid > aClientUids,
       
   835         const TDesC& aNamespace,
       
   836         const TDesC& aEntityId,
       
   837         const TUint aEventId );
       
   838 
       
   839     /**
       
   840      * Destructor.
       
   841      */
       
   842     virtual ~CNcdPurchaseHistoryFilter();
       
   843 
       
   844 private: // Construction
       
   845 
       
   846     /**
       
   847      * Private constructor.
       
   848      * @param aClientUids Client UIDs.
       
   849      * @param aNamespace Namespace. Can be KNullDesC.
       
   850      * @param aEntityId Entity ID. Can be KNullDesC.
       
   851      * @param aEventId Event ID.
       
   852      */
       
   853     void ConstructL(
       
   854         TArray< TUid > aClientUids,
       
   855         const TDesC& aNamespace,
       
   856         const TDesC& aEntityId,
       
   857         const TUint aEventId );
       
   858     
       
   859     /**
       
   860      * Private constructor.
       
   861      */
       
   862     CNcdPurchaseHistoryFilter();
       
   863 
       
   864 public: // from MNcdPurchaseHistoryFilter
       
   865 
       
   866     /**
       
   867      * @see MNcdPurchaseHistoryFilter::ClientUids
       
   868      */
       
   869     const TArray< TUid > ClientUids() const;
       
   870 
       
   871     /**
       
   872      * @see MNcdPurchaseHistoryFilter::Namespace
       
   873      */
       
   874     const TDesC& Namespace() const;
       
   875 
       
   876     /**
       
   877      * @see MNcdPurchaseHistoryFilter::EntityId
       
   878      */
       
   879     const TDesC& EntityId() const;
       
   880 
       
   881     /**
       
   882      * @see MNcdPurchaseHistoryFilter::EventId
       
   883      */
       
   884     TUint EventId() const;
       
   885 
       
   886 
       
   887 public: // New functions
       
   888 
       
   889     /**
       
   890      * Externalizer
       
   891      * @param aStream Write stream
       
   892      */
       
   893     IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
       
   894     
       
   895     /**
       
   896      * Internalizer
       
   897      * @param aStream Read stream
       
   898      */
       
   899     IMPORT_C void InternalizeL( RReadStream& aStream );
       
   900     
       
   901     /**
       
   902      * Set client UIDs.
       
   903      * @param aClientUids Client UIDs.
       
   904      */
       
   905     IMPORT_C void SetClientUids( const TArray< TUid > aClientUids );
       
   906 
       
   907     /**
       
   908      * Set namespace.
       
   909      * @param aNamespace Namespace. Can be KNullDesC.
       
   910      */
       
   911     IMPORT_C void SetNamespaceL( const TDesC& aNamespace );
       
   912 
       
   913     /**
       
   914      * Set entity ID.
       
   915      * @param aEntityId Entity ID. Can be KNullDesC.
       
   916      */
       
   917     IMPORT_C void SetEntityIdL( const TDesC& aEntityId );
       
   918 
       
   919     /**
       
   920      * Set event ID.
       
   921      * @param aEventId Event ID.
       
   922      */
       
   923     IMPORT_C void SetEventId( const TUint aEventId );
       
   924 
       
   925 private: // Data members
       
   926 
       
   927     RArray< TUid > iClientUids;
       
   928     HBufC* iNamespace;
       
   929     HBufC* iEntityId;
       
   930     TUint iEventId;
       
   931 
       
   932     };
       
   933 
       
   934 
       
   935 /**
       
   936  *  A default implementation for the MNcdPurchaseDetails interface.
       
   937  *
       
   938  *  @lib ncdutils_20019119.dll
       
   939  *  
       
   940  *  @see MNcdPurchaseDetails
       
   941  * 
       
   942  *  The number of DownloadedFiles must always match the number of
       
   943  *  DownloadInfos. DownloadFiles are added/removed automatically if necessary
       
   944  *  when the details are saved to purchase history
       
   945  * 
       
   946  *  The number of InstallInfos must be equal to or lesser than the number
       
   947  *  of DownloadInfos. Excess InstallInfos are removed when the details
       
   948  *  are saved to purchase history 
       
   949  */
       
   950 class CNcdPurchaseDetails : public CBase,
       
   951                             public MNcdPurchaseDetails
       
   952     {
       
   953 public: // Construction & destruction
       
   954 
       
   955     /**
       
   956      * Constructor.
       
   957      *
       
   958      * 
       
   959      * @return const CNcdPurchaseDetails* Purchase details.
       
   960      * @exception Leave System wide error code.
       
   961      */
       
   962     IMPORT_C static CNcdPurchaseDetails* NewL();
       
   963     
       
   964     /**
       
   965      * Constructor. Leaves pointer on cleanup stack.
       
   966      *
       
   967      * 
       
   968      * @return const CNcdPurchaseDetails* Purchase details.
       
   969      * @exception Leave System wide error code.
       
   970      */
       
   971     IMPORT_C static CNcdPurchaseDetails* NewLC();
       
   972     
       
   973     /**
       
   974      * Copy constructor.
       
   975      *
       
   976      * 
       
   977      * @param aDetails Details object to copy information from.
       
   978      * @return const CNcdPurchaseDetails* Purchase details.
       
   979      * @exception Leave System wide error code.
       
   980      */
       
   981     IMPORT_C static CNcdPurchaseDetails* NewL( const MNcdPurchaseDetails& aDetails );
       
   982     
       
   983     /**
       
   984      * Copy constructor. Leaves pointer on cleanup stack.
       
   985      *
       
   986      * 
       
   987      * @param aDetails Details object to copy information from.
       
   988      * @return const CNcdPurchaseDetails* Purchase details.
       
   989      * @exception Leave System wide error code.
       
   990      */
       
   991     IMPORT_C static CNcdPurchaseDetails* NewLC( const MNcdPurchaseDetails& aDetails );
       
   992     
       
   993     /**
       
   994      * Destructor.
       
   995      */
       
   996     virtual ~CNcdPurchaseDetails();
       
   997     
       
   998 public: // From MNcdPurchaseDetails
       
   999 
       
  1000     /**
       
  1001      * @see MNcdPurchaseDetails::State
       
  1002      */
       
  1003     TState State() const;
       
  1004 
       
  1005     /**
       
  1006      * @see MNcdPurchaseDetails::ClientUid
       
  1007      */
       
  1008     TUid ClientUid() const;
       
  1009     
       
  1010     /**
       
  1011      * @see MNcdPurchaseDetails::Namespace
       
  1012      */
       
  1013     const TDesC& Namespace() const;
       
  1014     
       
  1015     /**
       
  1016      * @see MNcdPurchaseDetails::EntityId
       
  1017      */
       
  1018     const TDesC& EntityId() const;
       
  1019     
       
  1020     /**
       
  1021      * @see MNcdPurchaseDetails::ItemName
       
  1022      */
       
  1023     const TDesC& ItemName() const;
       
  1024 
       
  1025     /**
       
  1026      * @see MNcdPurchaseDetails::ItemPurpose
       
  1027      */
       
  1028     TUint ItemPurpose() const;
       
  1029     
       
  1030     /**
       
  1031      * @see MNcdPurchaseDetails::CatalogSourceName
       
  1032      */
       
  1033     const TDesC& CatalogSourceName() const;
       
  1034     
       
  1035     /**
       
  1036      * @see MNcdPurchaseDetails::DownloadInfoL
       
  1037      */
       
  1038     TArray< MNcdPurchaseDownloadInfo* > DownloadInfoL() const;
       
  1039     
       
  1040     /**
       
  1041      * @see MNcdPurchaseDetails::PurchaseOptionId
       
  1042      */
       
  1043     const TDesC& PurchaseOptionId() const;
       
  1044     
       
  1045     /**
       
  1046      * @see MNcdPurchaseDetails::PurchaseOptionName
       
  1047      */
       
  1048     const TDesC& PurchaseOptionName() const;
       
  1049     
       
  1050     /**
       
  1051      * @see MNcdPurchaseDetails::PurchaseOptionPrice
       
  1052      */
       
  1053     const TDesC& PurchaseOptionPrice() const;
       
  1054     
       
  1055     /**
       
  1056      * @see MNcdPurchaseDetails::FinalPrice
       
  1057      */
       
  1058     const TDesC& FinalPrice() const;
       
  1059     
       
  1060     /**
       
  1061      * @see MNcdPurchaseDetails::PaymentMethodName
       
  1062      */
       
  1063     const TDesC& PaymentMethodName() const;
       
  1064     
       
  1065     /**
       
  1066      * @see MNcdPurchaseDetails::PurchaseTime
       
  1067      */
       
  1068     TTime PurchaseTime() const;
       
  1069     
       
  1070     /**
       
  1071      * @see MNcdPurchaseDetails::DownloadedFiles
       
  1072      */
       
  1073     const MDesCArray& DownloadedFiles() const;
       
  1074     
       
  1075     /**
       
  1076      * @see MNcdPurchaseDetails::InstallInfoL
       
  1077      */
       
  1078     TArray< MNcdPurchaseInstallInfo* > InstallInfoL() const;
       
  1079 
       
  1080     /**
       
  1081      * @see MNcdPurchaseDetails::Icon
       
  1082      */
       
  1083     const TDesC8& Icon() const;
       
  1084 
       
  1085     /**
       
  1086      * @see MNcdPurchaseDetails::HasIcon
       
  1087      */
       
  1088     TBool HasIcon() const;
       
  1089 
       
  1090     /**
       
  1091      * @see MNcdPurchaseDetails::DownloadAccessPoint
       
  1092      */
       
  1093     const TDesC& DownloadAccessPoint() const;
       
  1094 
       
  1095     /**
       
  1096      * @see MNcdPurchaseDetails::Description
       
  1097      */
       
  1098     const TDesC& Description() const;
       
  1099 
       
  1100     /**
       
  1101      * @see MNcdPurchaseDetails::Version
       
  1102      */
       
  1103     const TDesC& Version() const;
       
  1104     
       
  1105     /**
       
  1106      * @see MNcdPurchaseDetails::ServerUri
       
  1107      */
       
  1108     const TDesC& ServerUri() const;
       
  1109 
       
  1110     /**
       
  1111      * @see MNcdPurchaseDetails::ItemType
       
  1112      */
       
  1113     TItemType ItemType() const;
       
  1114     
       
  1115     /**
       
  1116      * @see MNcdPurchaseDetails::TotalContentSize
       
  1117      */
       
  1118     TInt TotalContentSize() const;
       
  1119     
       
  1120     /**
       
  1121      * @see MNcdPurchaseDetails::OriginNodeId
       
  1122      */
       
  1123     const TDesC& OriginNodeId() const;
       
  1124 
       
  1125     /**
       
  1126      * @see MNcdPurchaseDetails::LastOperationTime
       
  1127      */
       
  1128      TTime LastOperationTime() const;
       
  1129     
       
  1130     /**
       
  1131      * @see MNcdPurchaseDetails::LastOperationErrorCode
       
  1132      */
       
  1133     TInt LastOperationErrorCode() const;    
       
  1134 
       
  1135     
       
  1136     /**
       
  1137      * @see MNcdPurchaseDetails::AttributeString
       
  1138      */
       
  1139     const TDesC& AttributeString( TPurchaseAttribute aAttribute ) const;
       
  1140     
       
  1141         
       
  1142     /**
       
  1143      * @see MNcdPurchaseDetails::AttributeInt32
       
  1144      */
       
  1145     TInt32 AttributeInt32( TPurchaseAttribute aAttribute ) const;
       
  1146     
       
  1147 public: // New functions
       
  1148 
       
  1149     /**
       
  1150      * Externalizer
       
  1151      * @param aStream Write stream.
       
  1152      * @exception Leave System wide error code.
       
  1153      */
       
  1154     IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
       
  1155 
       
  1156     /**
       
  1157      * Internalizer
       
  1158      * @param aStream Read stream.
       
  1159      * @exception Leave System wide error code.
       
  1160      */
       
  1161     IMPORT_C void InternalizeL( RReadStream& aStream );
       
  1162 
       
  1163     /**
       
  1164      * Set client UID.
       
  1165      *
       
  1166      * 
       
  1167      * @param aClientUid Client UID.
       
  1168      */
       
  1169     IMPORT_C void SetClientUid( TUid aClientUid );
       
  1170     
       
  1171     /**
       
  1172      * Set namespace.
       
  1173      *
       
  1174      * 
       
  1175      * @param aNamespace Namespace.
       
  1176      * @exception Leave System wide error code.
       
  1177      */
       
  1178     IMPORT_C void SetNamespaceL( const TDesC& aNamespace );
       
  1179     
       
  1180     /**
       
  1181      * Set namespace.
       
  1182      *
       
  1183      * 
       
  1184      * @param aNamespace Namespace. Ownership is transferred.
       
  1185      */
       
  1186     IMPORT_C void SetNamespace( HBufC* aNamespace );
       
  1187     
       
  1188     /**
       
  1189      * Set entity ID.
       
  1190      *
       
  1191      * 
       
  1192      * @param aEntityId Entity ID.
       
  1193      * @exception Leave System wide error code.
       
  1194      */
       
  1195     IMPORT_C void SetEntityIdL( const TDesC& aEntityId );
       
  1196     
       
  1197     /**
       
  1198      * Set entity ID.
       
  1199      *
       
  1200      * 
       
  1201      * @param aEntityId Entity ID. Ownership is transferred.
       
  1202      */
       
  1203     IMPORT_C void SetEntityId( HBufC* aEntityId );
       
  1204     
       
  1205     /**
       
  1206      * Set item name.
       
  1207      *
       
  1208      * 
       
  1209      * @param aItemName Item name.
       
  1210      * @exception Leave System wide error code.
       
  1211      */
       
  1212     IMPORT_C void SetItemNameL( const TDesC& aItemName );
       
  1213 
       
  1214     /**
       
  1215      * Set item name.
       
  1216      *
       
  1217      * 
       
  1218      * @param aItemName Item name. Ownership is transferred.
       
  1219      */
       
  1220     IMPORT_C void SetItemName( HBufC* aItemName );
       
  1221 
       
  1222     /**
       
  1223      * Set item purpose.
       
  1224      *
       
  1225      * 
       
  1226      * @param aItemPurpose Item purpose. Bit field of TNcdItemPurpose flags.
       
  1227      * @see TNcdItemPurpose
       
  1228      */
       
  1229     IMPORT_C void SetItemPurpose( TUint aItemPurpose );
       
  1230     
       
  1231     /**
       
  1232      * Set catalog source name.
       
  1233      *
       
  1234      * 
       
  1235      * @param aCatalogSourceName Catalog source name.
       
  1236      * @exception Leave System wide error code.
       
  1237      */
       
  1238     IMPORT_C void SetCatalogSourceNameL( const TDesC& aCatalogSourceName );
       
  1239     
       
  1240     /**
       
  1241      * Set catalog source name.
       
  1242      *
       
  1243      * 
       
  1244      * @param aCatalogSourceName Catalog source name. Ownership is transferred.
       
  1245      */
       
  1246     IMPORT_C void SetCatalogSourceName( HBufC* aCatalogSourceName );
       
  1247     
       
  1248     /**
       
  1249      * Set download infos.
       
  1250      *
       
  1251      * 
       
  1252      * @param aDownloadInfo Download infos. Ownership is not transferred, copies
       
  1253      *  will be taken.
       
  1254      */
       
  1255     IMPORT_C void SetDownloadInfoL(
       
  1256         const TArray< MNcdPurchaseDownloadInfo* >& aDownloadInfo );
       
  1257 
       
  1258 
       
  1259     /**
       
  1260      * Add download info
       
  1261      *
       
  1262      * 
       
  1263      * @param aDownloadInfo A download info. Ownership is transferred if the 
       
  1264      * operation is successful.
       
  1265      */
       
  1266     IMPORT_C void AddDownloadInfoL( MNcdPurchaseDownloadInfo* aDownloadInfo );
       
  1267 
       
  1268 
       
  1269     /**
       
  1270      * Insert download info
       
  1271      *
       
  1272      * 
       
  1273      * @param aDownloadInfo A download info. Ownership is transferred if the      
       
  1274      * operation is successful.
       
  1275      * @param aIndex
       
  1276      */
       
  1277     IMPORT_C void InsertDownloadInfoL( 
       
  1278         MNcdPurchaseDownloadInfo* aDownloadInfo, 
       
  1279         TInt aIndex );
       
  1280 
       
  1281     
       
  1282     /**
       
  1283      * Remove download info
       
  1284      *
       
  1285      * 
       
  1286      * @param aIndex Index
       
  1287      */
       
  1288     IMPORT_C void RemoveDownloadInfo( TInt aIndex );
       
  1289     
       
  1290     /**
       
  1291      * Download info count getter
       
  1292      *
       
  1293      * 
       
  1294      */
       
  1295     IMPORT_C TInt DownloadInfoCount() const;
       
  1296     
       
  1297     /**
       
  1298      * Download info getter
       
  1299      *
       
  1300      * 
       
  1301      * @return Download info
       
  1302      */
       
  1303     IMPORT_C CNcdPurchaseDownloadInfo& DownloadInfo( TInt aIndex );
       
  1304 
       
  1305     
       
  1306     /**
       
  1307      * Set purchase option ID.
       
  1308      *
       
  1309      * 
       
  1310      * @param aPurchaseOptionId Purchase option ID.
       
  1311      * @exception Leave System wide error code.
       
  1312      */
       
  1313     IMPORT_C void SetPurchaseOptionIdL( const TDesC& aPurchaseOptionId );
       
  1314     
       
  1315     /**
       
  1316      * Set purchase option ID.
       
  1317      *
       
  1318      * 
       
  1319      * @param aPurchaseOptionId Purchase option ID. Ownership is transferred.
       
  1320      */
       
  1321     IMPORT_C void SetPurchaseOptionId( HBufC* aPurchaseOptionId );
       
  1322     
       
  1323     /**
       
  1324      * Set purchase option name.
       
  1325      *
       
  1326      * 
       
  1327      * @param aPurchaseOptionName Purchase option name.
       
  1328      * @exception Leave System wide error code.
       
  1329      */
       
  1330     IMPORT_C void SetPurchaseOptionNameL( const TDesC& aPurchaseOptionName );
       
  1331     
       
  1332     /**
       
  1333      * Set purchase option name.
       
  1334      *
       
  1335      * 
       
  1336      * @param aPurchaseOptionName Purchase option name. Ownership is transferred.
       
  1337      */
       
  1338     IMPORT_C void SetPurchaseOptionName( HBufC* aPurchaseOptionName );
       
  1339     
       
  1340     /**
       
  1341      * Set purchase option price.
       
  1342      *
       
  1343      * 
       
  1344      * @param aPurchaseOptionPrice Purchase option price.
       
  1345      * @exception Leave System wide error code.
       
  1346      */
       
  1347     IMPORT_C void SetPurchaseOptionPriceL( const TDesC& aPurchaseOptionPrice );
       
  1348     
       
  1349     /**
       
  1350      * Set purchase option price.
       
  1351      *
       
  1352      * 
       
  1353      * @param aPurchaseOptionPrice Purchase option price. Ownership is transferred.
       
  1354      */
       
  1355     IMPORT_C void SetPurchaseOptionPrice( HBufC* aPurchaseOptionPrice );
       
  1356     
       
  1357     /**
       
  1358      * Set final price.
       
  1359      *
       
  1360      * 
       
  1361      * @param aFinalPrice Final price.
       
  1362      * @exception Leave System wide error code.
       
  1363      */
       
  1364     IMPORT_C void SetFinalPriceL( const TDesC& aFinalPrice );
       
  1365     
       
  1366     /**
       
  1367      * Set final price.
       
  1368      *
       
  1369      * 
       
  1370      * @param aFinalPrice Final price. Ownership is transferred.
       
  1371      */
       
  1372     IMPORT_C void SetFinalPrice( HBufC* aFinalPrice );
       
  1373     
       
  1374     /**
       
  1375      * Set payment method name.
       
  1376      *
       
  1377      * 
       
  1378      * @param aPaymentMethodName Payment method name.
       
  1379      * @exception Leave System wide error code.
       
  1380      */
       
  1381     IMPORT_C void SetPaymentMethodNameL( const TDesC& aPaymentMethodName );
       
  1382     
       
  1383     /**
       
  1384      * Set payment method name.
       
  1385      *
       
  1386      * 
       
  1387      * @param aPaymentMethodName Payment method name. Ownership is transferred.
       
  1388      */
       
  1389     IMPORT_C void SetPaymentMethodName( HBufC* aPaymentMethodName );
       
  1390     
       
  1391     /**
       
  1392      * Set time of purchase.
       
  1393      *
       
  1394      * 
       
  1395      * @param aPurchaseTime Purchase time.
       
  1396      */
       
  1397     IMPORT_C void SetPurchaseTime( TTime aPurchaseTime );
       
  1398     
       
  1399     /**
       
  1400      * Set file name(s) of the downloaded file(s).
       
  1401      *
       
  1402      * 
       
  1403      * @param aDownloadedFiles Array of file names. Ownership is transferred.
       
  1404      */
       
  1405     IMPORT_C void SetDownloadedFiles( CDesCArray* aDownloadedFiles );
       
  1406     
       
  1407     /**
       
  1408      * Set file name(s) of the downloaded file(s).
       
  1409      *
       
  1410      * 
       
  1411      * @param aDownloadedFiles Array of file names. Ownership is not transferred,
       
  1412      *  copies will be taken.
       
  1413      * @exception Leave System wide error code.
       
  1414      */
       
  1415     IMPORT_C void SetDownloadedFilesL( const MDesCArray& aDownloadedFiles );
       
  1416 
       
  1417 
       
  1418     
       
  1419     /**
       
  1420      * Replaces a file name of the downloaded file.
       
  1421      *
       
  1422      * 
       
  1423      * @param aIndex Index
       
  1424      * @param aDownloadFile New file name
       
  1425      * @exception Leave System wide error code.
       
  1426      */
       
  1427     IMPORT_C void ReplaceDownloadedFileL( TInt aIndex, 
       
  1428         const TDesC& aDownloadedFile );
       
  1429     
       
  1430     
       
  1431     /**
       
  1432      * Add file name for a downloaded file.
       
  1433      *
       
  1434      * 
       
  1435      * @param aDownloadedFile Filename
       
  1436      * @exception Leave System wide error code.
       
  1437      */
       
  1438     IMPORT_C void AddDownloadedFileL( const TDesC& aDownloadedFile );
       
  1439 
       
  1440 
       
  1441     /**
       
  1442      * Insert file name for a downloaded file.
       
  1443      *
       
  1444      * 
       
  1445      * @param aDownloadedFile Filename
       
  1446      * @param aIndex
       
  1447      * @exception Leave System wide error code.
       
  1448      */
       
  1449     IMPORT_C void InsertDownloadedFileL( 
       
  1450         const TDesC& aDownloadedFile, 
       
  1451         TInt aIndex );
       
  1452 
       
  1453     /**
       
  1454      * Remove a file name
       
  1455      *
       
  1456      * 
       
  1457      * @param aIndex
       
  1458      */
       
  1459     IMPORT_C void RemoveDownloadedFile( TInt aIndex );
       
  1460     
       
  1461     
       
  1462     /**
       
  1463      * Set file installation infos.
       
  1464      *
       
  1465      * 
       
  1466      * @param aInstallInfo File installation info array. Ownership is not
       
  1467      *  transferred, copies will be taken.
       
  1468      * @exception Leave System wide error code.
       
  1469      */
       
  1470     IMPORT_C void SetInstallInfoL(
       
  1471         const TArray< MNcdPurchaseInstallInfo* >& aInstallInfo );
       
  1472 
       
  1473 
       
  1474     /**
       
  1475      * Add file installation info.
       
  1476      *
       
  1477      * 
       
  1478      * @param aInstallInfo File installation info. Ownership is transferred 
       
  1479      * if the operation is successful.     
       
  1480      * @exception Leave System wide error code.
       
  1481      */
       
  1482     IMPORT_C void AddInstallInfoL( MNcdPurchaseInstallInfo* aInstallInfo );
       
  1483 
       
  1484 
       
  1485     /**
       
  1486      * Insert file installation info.
       
  1487      *
       
  1488      * 
       
  1489      * @param aInstallInfo File installation info. Ownership is transferred 
       
  1490      * if the operation is successful.     
       
  1491      * @param aIndex
       
  1492      * @exception Leave System wide error code.
       
  1493      */
       
  1494     IMPORT_C void InsertInstallInfoL( 
       
  1495         MNcdPurchaseInstallInfo* aInstallInfo,
       
  1496         TInt aIndex );
       
  1497 
       
  1498     /**
       
  1499      * Remove install info
       
  1500      *
       
  1501      * 
       
  1502      * @param aIndex Index
       
  1503      */
       
  1504     IMPORT_C void RemoveInstallInfo( TInt aIndex );
       
  1505 
       
  1506     /**
       
  1507      * Install info count getter
       
  1508      *
       
  1509      * 
       
  1510      * @return Install info count
       
  1511      */
       
  1512     IMPORT_C TInt InstallInfoCount() const;
       
  1513     
       
  1514     
       
  1515     /**
       
  1516      * Install info getter
       
  1517      *
       
  1518      * 
       
  1519      * @param aIndex Index
       
  1520      * @return Install info
       
  1521      */
       
  1522     IMPORT_C CNcdPurchaseInstallInfo& InstallInfo( TInt aIndex );
       
  1523     
       
  1524     /**
       
  1525      * Set icon.
       
  1526      *
       
  1527      * 
       
  1528      * @param aIcon Icon data.
       
  1529      * @exception Leave System wide error code.
       
  1530      */
       
  1531     IMPORT_C void SetIconL( const TDesC8& aIcon );
       
  1532 
       
  1533     /**
       
  1534      * Set icon.
       
  1535      *
       
  1536      * 
       
  1537      * @param aIcon Icon data. Ownership is transferred.
       
  1538      */
       
  1539     IMPORT_C void SetIcon( HBufC8* aIcon );
       
  1540     
       
  1541     /**
       
  1542      * Get icon data.
       
  1543      *
       
  1544      * @note Ownership is transferred.
       
  1545      * @return Icon data.
       
  1546      */
       
  1547     IMPORT_C HBufC8* GetIconData();
       
  1548     
       
  1549     /**
       
  1550      * Setter for HasIcon flag.
       
  1551      *
       
  1552      * @param aHasIcon flag value.
       
  1553      */
       
  1554     IMPORT_C void SetHasIcon( TBool aHasIcon );
       
  1555     
       
  1556     /**
       
  1557      * Set access point used in download process.
       
  1558      *
       
  1559      * 
       
  1560      * @param aAccessPoint Access point.
       
  1561      * @exception Leave System wide error code.
       
  1562      */
       
  1563     IMPORT_C void SetDownloadAccessPointL( const TDesC& aAccessPoint );
       
  1564 
       
  1565     /**
       
  1566      * Set access point used in download process.
       
  1567      *
       
  1568      * 
       
  1569      * @param aAccessPoint Access point. Ownership is transferred.
       
  1570      */
       
  1571     IMPORT_C void SetDownloadAccessPoint( HBufC* aAccessPoint );
       
  1572 
       
  1573     /**
       
  1574      * Set description.
       
  1575      *
       
  1576      * 
       
  1577      * @param aDescription Description.
       
  1578      * @exception Leave System wide error code.
       
  1579      */
       
  1580     IMPORT_C void SetDescriptionL( const TDesC& aDescription );
       
  1581 
       
  1582     /**
       
  1583      * Set description.
       
  1584      *
       
  1585      * 
       
  1586      * @param aDescription Description. Ownership is transferred.
       
  1587      */
       
  1588     IMPORT_C void SetDescription( HBufC* aDescription );
       
  1589 
       
  1590     /**
       
  1591      * Set version.
       
  1592      *
       
  1593      * 
       
  1594      * @param aVersion Version.
       
  1595      * @exception Leave System wide error code.
       
  1596      */
       
  1597     IMPORT_C void SetVersionL( const TDesC& aVersion );
       
  1598 
       
  1599     /**
       
  1600      * Set version.
       
  1601      *
       
  1602      * 
       
  1603      * @param aVersion Version. Ownership is transferred.
       
  1604      */
       
  1605     IMPORT_C void SetVersion( HBufC* aVersion );
       
  1606 
       
  1607     /**
       
  1608      * Set server URI.
       
  1609      *
       
  1610      * 
       
  1611      * @param aServerUri Server URI.
       
  1612      * @exception Leave System wide error code.
       
  1613      */
       
  1614     IMPORT_C void SetServerUriL( const TDesC& aServerUri );
       
  1615 
       
  1616     /**
       
  1617      * Set server URI.
       
  1618      *
       
  1619      * 
       
  1620      * @param aServerUri Server URI. Ownership is transferred.
       
  1621      */
       
  1622     IMPORT_C void SetServerUri( HBufC* aServerUri );
       
  1623 
       
  1624     /**
       
  1625      * Set item type.
       
  1626      *
       
  1627      * 
       
  1628      * @param aItemType Item type.
       
  1629      */
       
  1630     IMPORT_C void SetItemType( TItemType aItemType );
       
  1631     
       
  1632     /**
       
  1633      * Set the total content size.
       
  1634      *
       
  1635      * 
       
  1636      * @param aSize The size.
       
  1637      */
       
  1638     IMPORT_C void SetTotalContentSize( TInt aSize );
       
  1639     
       
  1640     /**
       
  1641      * Set the origin node id.
       
  1642      *
       
  1643      * 
       
  1644      * @param aOriginNodeId The id.
       
  1645      */
       
  1646     IMPORT_C void SetOriginNodeIdL( const TDesC& aOriginNodeId );
       
  1647     
       
  1648     /**
       
  1649      * Set the origin node id.
       
  1650      *
       
  1651      * 
       
  1652      * @param aOriginNodeId The id.
       
  1653      */
       
  1654     IMPORT_C void SetOriginNodeId( HBufC* aOriginNodeId );
       
  1655 
       
  1656     /**
       
  1657      * Set the last operation time to the current universal time.
       
  1658      *
       
  1659      * 
       
  1660      */
       
  1661     IMPORT_C void SetLastUniversalOperationTime();
       
  1662       
       
  1663     /**
       
  1664      * Set the last operation time. This should be universal time.
       
  1665      *
       
  1666      * 
       
  1667      * @param aTime The universal time.
       
  1668      */
       
  1669     IMPORT_C void SetLastOperationTime( const TTime& aTime );
       
  1670 
       
  1671     /**
       
  1672      * Set the last operation error code.
       
  1673      *
       
  1674      * 
       
  1675      * @param aError The error code.
       
  1676      */
       
  1677     IMPORT_C void SetLastOperationErrorCode( TInt aError );
       
  1678 
       
  1679     /**
       
  1680      * Integer attribute setter
       
  1681      */
       
  1682     IMPORT_C void SetAttributeL( TPurchaseAttribute aAttribute, TInt32 aValue );
       
  1683     
       
  1684     /**
       
  1685      * String attribute setter
       
  1686      */
       
  1687     IMPORT_C void SetAttributeL( 
       
  1688         TPurchaseAttribute aAttribute, const TDesC& aValue );
       
  1689     
       
  1690     /**
       
  1691      * Externalizes attributes to a stream
       
  1692      * 
       
  1693      * @param aStream Write stream
       
  1694      */
       
  1695     IMPORT_C void ExternalizeAttributesL( RWriteStream& aStream ) const;
       
  1696     
       
  1697     /**
       
  1698      * Internalizes attributes from a stream
       
  1699      * 
       
  1700      * @param aStream Read stream
       
  1701      */    
       
  1702     IMPORT_C void InternalizeAttributesL( RReadStream& aStream );
       
  1703     
       
  1704     
       
  1705 private: // Construction
       
  1706 
       
  1707     /**
       
  1708      * Private 2nd phase constructor.
       
  1709      */
       
  1710     void ConstructL();
       
  1711 
       
  1712     /**
       
  1713      * Private constructor.
       
  1714      */
       
  1715     CNcdPurchaseDetails();
       
  1716 
       
  1717     /**
       
  1718      * Creates attributes if they haven't been created yet
       
  1719      */
       
  1720     void CreateAttributesL();
       
  1721     
       
  1722 private: // Data members
       
  1723 
       
  1724     // Client UID.
       
  1725     TUid iClientUid;
       
  1726     
       
  1727     // Namespace.
       
  1728     HBufC* iNamespace;
       
  1729     
       
  1730     // Entity ID.
       
  1731     HBufC* iEntityId;
       
  1732     
       
  1733     // Item name.
       
  1734     HBufC* iItemName;
       
  1735 
       
  1736     // Item purpose.
       
  1737     TUint iItemPurpose;
       
  1738     
       
  1739     // Catalog source name.
       
  1740     HBufC* iCatalogSourceName;
       
  1741     
       
  1742     // Download info array.
       
  1743     RPointerArray< MNcdPurchaseDownloadInfo > iDownloadInfo;
       
  1744     
       
  1745     // Purchase option ID.
       
  1746     HBufC* iPurchaseOptionId;
       
  1747     
       
  1748     // Purchase option name.
       
  1749     HBufC* iPurchaseOptionName;
       
  1750     
       
  1751     // Purchase option price.
       
  1752     HBufC* iPurchaseOptionPrice;
       
  1753     
       
  1754     // Final price.
       
  1755     HBufC* iFinalPrice;
       
  1756     
       
  1757     // Payment method name.
       
  1758     HBufC* iPaymentMethodName;
       
  1759     
       
  1760     // Purchase time.
       
  1761     TTime iPurchaseTime;
       
  1762     
       
  1763     // Downloaded files array.
       
  1764     CDesCArray* iDownloadedFiles;
       
  1765     
       
  1766     // Install info array.
       
  1767     RPointerArray< MNcdPurchaseInstallInfo > iInstallInfo;
       
  1768 
       
  1769     // Icon data.
       
  1770     HBufC8* iIcon;
       
  1771     
       
  1772     // Determines whether this object has an icon.
       
  1773     TBool iHasIcon;
       
  1774 
       
  1775     // Access point used in download process.
       
  1776     HBufC* iDownloadAccessPoint;
       
  1777 
       
  1778     // Description.
       
  1779     HBufC* iDescription;
       
  1780 
       
  1781     // Version.
       
  1782     HBufC* iVersion;
       
  1783 
       
  1784     // Server URI.
       
  1785     HBufC* iServerUri;
       
  1786 
       
  1787     // Item type.
       
  1788     TItemType iItemType;
       
  1789     
       
  1790     // Total downloadable content size in bytes.
       
  1791     TInt iTotalContentSize;
       
  1792     
       
  1793     // The id of the structure node that this entity was purchased from,
       
  1794     HBufC* iOriginNodeId;
       
  1795 
       
  1796     // The universal time that informs when the last operation 
       
  1797     // was directed to the purchase item.
       
  1798     TTime iLastOperationTime;
       
  1799     
       
  1800     // The error code of the last operation that was directed
       
  1801     // to the purchase item.
       
  1802     TInt iLastOperationErrorCode;
       
  1803 
       
  1804     // Additional attributes, owned
       
  1805     CNcdAttributes* iAttributes; 
       
  1806     };
       
  1807 
       
  1808 /**
       
  1809  *  A default implementation for the MNcdSearchFilter interface.
       
  1810  *
       
  1811  *  @lib ncdutils_20019119.dll
       
  1812  *  
       
  1813  *  @see MNcdSearchFilter
       
  1814  */
       
  1815 class CNcdSearchFilter : public CBase,
       
  1816                          public MNcdSearchFilter
       
  1817     {
       
  1818 
       
  1819 public:
       
  1820 
       
  1821     /**
       
  1822      * Default factory method for CNcdSearchFilter objects. Leaves contents uninitialized.
       
  1823      *
       
  1824      * @return CNcdSearchFilter object pointer.
       
  1825      */
       
  1826     IMPORT_C static CNcdSearchFilter *NewL();
       
  1827 
       
  1828     /**
       
  1829      * Default factory method for CNcdSearchFilter objects. Leaves contents uninitialized.
       
  1830      * Leaves object pointer on cleanup stack.
       
  1831      *
       
  1832      * @return CNcdSearchFilter object pointer.
       
  1833      */
       
  1834     IMPORT_C static CNcdSearchFilter *NewLC();
       
  1835 
       
  1836     /**
       
  1837      * Factory method for CNcdSearchFilter objects. Initializes as a copy of another filter.
       
  1838      *
       
  1839      * @param aFilter Initialization copy source.
       
  1840      * @return CNcdSearchFilter object pointer.
       
  1841      */
       
  1842     IMPORT_C static CNcdSearchFilter *NewL( const CNcdSearchFilter& aFilter );
       
  1843 
       
  1844     /**
       
  1845      * Factory method for CNcdSearchFilter objects. Initializes as a copy of another filter.
       
  1846      * Leaves object pointer on cleanup stack.
       
  1847      *
       
  1848      * @param aFilter Initialization copy source.
       
  1849      * @return CNcdSearchFilter object pointer.
       
  1850      */
       
  1851     IMPORT_C static CNcdSearchFilter *NewLC( const CNcdSearchFilter& aFilter );
       
  1852 
       
  1853     /**
       
  1854      * Factory method for CNcdSearchFilter objects. Initializes from a stream externalized with
       
  1855      * CNcdSearchFilter::ExternalizeL().
       
  1856      *
       
  1857      * @param aStream Initialization source stream.
       
  1858      * @return CNcdSearchFilter object pointer.
       
  1859      */
       
  1860     IMPORT_C static CNcdSearchFilter *NewL( RReadStream& aStream );
       
  1861 
       
  1862     /**
       
  1863      * Factory method for CNcdSearchFilter objects. Initializes from a stream externalized with
       
  1864      * CNcdSearchFilter::ExternalizeL(). Leaves object pointer on cleanup stack.
       
  1865      *
       
  1866      * @param aStream Initialization source stream.
       
  1867      * @return CNcdSearchFilter object pointer.
       
  1868      */
       
  1869     IMPORT_C static CNcdSearchFilter *NewLC( RReadStream& aStream );
       
  1870     
       
  1871     /**
       
  1872      * Destructor.
       
  1873      */
       
  1874     virtual ~CNcdSearchFilter();
       
  1875      
       
  1876 public: //  From MNcdSearchFilter
       
  1877 
       
  1878     /**
       
  1879      * @see MNcdSearchFilter::Keywords
       
  1880      */
       
  1881     virtual const MDesCArray& Keywords() const;
       
  1882 
       
  1883     /**
       
  1884      * @see MNcdSearchFilter::Keywords
       
  1885      */
       
  1886     virtual TUint ContentPurposes() const;
       
  1887 
       
  1888 
       
  1889     /**
       
  1890      * @see MNcdSearchFilter::SearchMode
       
  1891      */
       
  1892     virtual MNcdSearchFilter::TSearchMode SearchMode() const;
       
  1893     
       
  1894     
       
  1895     /**
       
  1896      * @see MNcdSearchFilter::RecursionDepth
       
  1897      */
       
  1898     virtual TUint RecursionDepth() const;
       
  1899     
       
  1900     
       
  1901 public:
       
  1902 
       
  1903     /**
       
  1904      * Adds a search keyword.
       
  1905      * By default, no keywords are set
       
  1906      *
       
  1907      * @param aKeyword Search keyword to add.
       
  1908      */
       
  1909     IMPORT_C void AddKeywordL( const TDesC& aKeyword );
       
  1910     
       
  1911     /**
       
  1912      * Set flags for filtering by content purpose.
       
  1913      * By default, no content flags are set
       
  1914      *
       
  1915      * @param aFlags Content flags for filtering. A combination of TNcdItemPurpose flags.
       
  1916      * @see TNcdItemPurpose
       
  1917      */
       
  1918     IMPORT_C void SetContentPurposes( TUint aFlags );
       
  1919     
       
  1920     
       
  1921     /**
       
  1922      * Set search mode
       
  1923      *
       
  1924      * By default, mode is ENormal
       
  1925      *
       
  1926      * @param aMode Search mode
       
  1927      */
       
  1928     IMPORT_C void SetSearchMode( MNcdSearchFilter::TSearchMode aMode );
       
  1929     
       
  1930     
       
  1931     /**
       
  1932      * Set recursion depth
       
  1933      *
       
  1934      * By default, recursion depth is 2. Depth of 0 disabled recursion
       
  1935      *
       
  1936      * @param aRecursionDepth Depth of recursion
       
  1937      * @leave KErrArgument if aRecursionDepth is greater than 5
       
  1938      */
       
  1939     IMPORT_C void SetRecursionDepthL( TUint aRecursionDepth );
       
  1940     
       
  1941     
       
  1942     /**
       
  1943      * Internalize member data.
       
  1944      *
       
  1945      * @param aStream Source stream.
       
  1946      */
       
  1947     virtual void InternalizeL( RReadStream& aStream );
       
  1948     
       
  1949     
       
  1950     /**
       
  1951      * Externalize member data.
       
  1952      *
       
  1953      * @param aStream Destination stream.
       
  1954      */
       
  1955     virtual void ExternalizeL( RWriteStream& aStream );
       
  1956 
       
  1957 
       
  1958 protected:
       
  1959 
       
  1960     /**
       
  1961      * First phase constructor.
       
  1962      */
       
  1963     CNcdSearchFilter();    
       
  1964     
       
  1965     /**
       
  1966      * Second phase constructor.
       
  1967      */
       
  1968     void ConstructL();
       
  1969     
       
  1970     
       
  1971 private:
       
  1972 
       
  1973     /**
       
  1974      * Keywords to filter the search based on
       
  1975      */
       
  1976     CDesCArray *iKeywords;
       
  1977     
       
  1978     /**
       
  1979      * Purposes to filter the search based on
       
  1980      */
       
  1981     TUint iPurposes;
       
  1982     
       
  1983     /**
       
  1984      * Search mode
       
  1985      */
       
  1986     MNcdSearchFilter::TSearchMode iSearchMode;
       
  1987     
       
  1988     /**
       
  1989      * Recursion depth
       
  1990      */
       
  1991     TUint iRecursionDepth;    
       
  1992     };
       
  1993     
       
  1994 #endif // M_NCD_UTILS_H