epoc32/include/mw/favouritesitemlist.h
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
     1.1 --- a/epoc32/include/mw/favouritesitemlist.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/mw/favouritesitemlist.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,146 @@
     1.4 -favouritesitemlist.h
     1.5 +/*
     1.6 +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
     1.7 +* All rights reserved.
     1.8 +* This component and the accompanying materials are made available
     1.9 +* under the terms of the License "Eclipse Public License v1.0"
    1.10 +* which accompanies this distribution, and is available
    1.11 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.12 +*
    1.13 +* Initial Contributors:
    1.14 +* Nokia Corporation - initial contribution.
    1.15 +*
    1.16 +* Contributors:
    1.17 +*
    1.18 +* Description:  Declaration of FavouritesItemList
    1.19 +*
    1.20 +*/
    1.21 +
    1.22 +
    1.23 +#ifndef FAVOURITES_ITEM_LIST_H
    1.24 +#define FAVOURITES_ITEM_LIST_H
    1.25 +
    1.26 +// INCLUDE FILES
    1.27 +
    1.28 +#include <e32base.h>
    1.29 +
    1.30 +// CONSTANTS
    1.31 +
    1.32 +// FORWARD DECLARATION
    1.33 +
    1.34 +class CFavouritesItem;
    1.35 +class RWriteStream;
    1.36 +class RReadStream;
    1.37 +
    1.38 +// CLASS DECLARATION
    1.39 +
    1.40 +/**
    1.41 +* CFavouritesItemList is the Array of CFavouritesItem-s. 
    1.42 +* Items are owned and deleted upon destruction.
    1.43 +* Note: using this array downcasted to its base can result in leaks.
    1.44 +* Delete method of base class is not virtual!
    1.45 +*/
    1.46 +class CFavouritesItemList: public CArrayPtrFlat<CFavouritesItem>
    1.47 +    {
    1.48 +    public:     // Constructor and destructor
    1.49 +
    1.50 +        /**
    1.51 +        * Constructor.
    1.52 +        * @since 0.9       
    1.53 +        */
    1.54 +        IMPORT_C CFavouritesItemList();
    1.55 +
    1.56 +        /**
    1.57 +        * Destructor. Elements are destroyed.
    1.58 +        * @since 0.9       
    1.59 +        */
    1.60 +        IMPORT_C virtual ~CFavouritesItemList();
    1.61 +
    1.62 +    public:     // new methods
    1.63 +
    1.64 +        /**
    1.65 +        * Remove and destroy an element. Invalid params will Panic.
    1.66 +        * @since 0.9       
    1.67 +        * @param aIndex Index of element to delete.
    1.68 +        * @return void 
    1.69 +        */
    1.70 +        IMPORT_C void Delete( TInt aIndex );
    1.71 +
    1.72 +        /**
    1.73 +        * Remove and destroy elements. Invalid params Panic.
    1.74 +        * @since 0.9       
    1.75 +        * @param aIndex Index of start element to delete.
    1.76 +        * @param aCount Number of items to delete.
    1.77 +        * @return void
    1.78 +        */
    1.79 +        IMPORT_C void Delete( TInt aIndex, TInt aCount );
    1.80 +
    1.81 +    public:     // Sorting
    1.82 +
    1.83 +        /**
    1.84 +        * Comparison function type; compare two items. Should leave in error.
    1.85 +        * @since 0.9       
    1.86 +        * @param aLeft item to compare to aRight.
    1.87 +        * @param aRight Item to compare to aLeft.
    1.88 +        * @return
    1.89 +        *   - negative value, if aLeft is less than aRight;
    1.90 +        *   - 0,              if aLeft equals to aRight;
    1.91 +        *   - positive value, if aLeft is greater than aRight.
    1.92 +        */
    1.93 +        typedef TInt (*ComparisonFuncL)
    1.94 +            ( const CFavouritesItem& aLeft, const CFavouritesItem& aRight );
    1.95 +
    1.96 +        /**
    1.97 +        * Sort the list using bubble-sort.
    1.98 +        * @since 0.9       
    1.99 +        * @param aCompareItemsL Function to be used two elements.
   1.100 +        */
   1.101 +        IMPORT_C void SortL( ComparisonFuncL aCompareItemsL );
   1.102 +
   1.103 +    public:     // Uid <--> array index conversion
   1.104 +
   1.105 +        /**
   1.106 +        * Convert Uid to index.
   1.107 +        * @since 0.9       
   1.108 +        * @param aUid Uid to convert.
   1.109 +        * @return Index for this Uid, or -KErrNotFound if not found.
   1.110 +        */
   1.111 +        IMPORT_C TInt UidToIndex( TInt aUid ) const;
   1.112 +
   1.113 +        /**
   1.114 +        * Convert index to Uid.
   1.115 +        * @since 0.9       
   1.116 +        * @param aIndex Index to convert.
   1.117 +        * @return Uid for this index, or KFavouritesNullUid if not found.
   1.118 +        */
   1.119 +        IMPORT_C TInt IndexToUid( TInt aIndex ) const;
   1.120 +
   1.121 +        /**
   1.122 +        * Get pointer to item having aUid.
   1.123 +        * @since 0.9       
   1.124 +        * @param aUid Uid of item to look for.
   1.125 +        * @return Pointer to item having aUid, or NULL if there is no such
   1.126 +        * item. Item is still owned by the list.
   1.127 +        */
   1.128 +        IMPORT_C const CFavouritesItem* ItemByUid( TInt aUid ) const;
   1.129 +
   1.130 +    public:     // (But not exported:) Streaming
   1.131 +
   1.132 +        /**
   1.133 +        * Externalize into a stream.
   1.134 +        * @since 0.9       
   1.135 +        * @param aStream The stream to externalize to.
   1.136 +        */
   1.137 +        void ExternalizeL( RWriteStream& aStream ) const;
   1.138 +
   1.139 +        /**
   1.140 +        * Internalize from a stream. Existing data is kept, new ones appended.
   1.141 +        * @since 0.9       
   1.142 +        * @param aStream The stream to externalize from.
   1.143 +        */
   1.144 +        void InternalizeL( RReadStream& aStream );
   1.145 +
   1.146 +    };
   1.147 +
   1.148 +#endif
   1.149 +
   1.150 +// End of file