epoc32/include/msvarray.h
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
equal deleted inserted replaced
3:e1b950c65cb4 4:837f303aceeb
     1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #if !defined(__MSVARRAY_H__)
       
    17 #define __MSVARRAY_H__
       
    18 
       
    19 #if !defined(__MSVSTD_H__)
       
    20 #include <msvstd.h>
       
    21 #endif
       
    22 
       
    23 //*************************
       
    24 //  class TKeyArrayFixPtr
       
    25 //*************************
       
    26 
       
    27 class TKeyArrayFixPtr : public TKeyArrayFix
       
    28 // 
       
    29 // Generic Key class for sorting arrays of pointers in flat arrays. 
       
    30 //
       
    31 /**
       
    32 @internalComponent
       
    33 @released
       
    34 */
       
    35 	{ 
       
    36 public:
       
    37 	inline TKeyArrayFixPtr(TInt anOffset,TKeyCmpText aType);
       
    38 	inline TKeyArrayFixPtr(TInt anOffset,TKeyCmpText aType,TInt aLength);
       
    39 	inline TKeyArrayFixPtr(TInt anOffset,TKeyCmpNumeric aType);
       
    40 	// At returns dereferenced pointer to objects (but not index)
       
    41 	IMPORT_C TAny* At(TInt anIndex) const;
       
    42 	};
       
    43 
       
    44 
       
    45 //**********************************
       
    46 // CMsvEntryArray
       
    47 //**********************************
       
    48 //
       
    49 // The array of TMsvEntry pointers
       
    50 //
       
    51 
       
    52 class CMsvEntryArray : public CArrayPtrFlat<const TMsvEntry>
       
    53 /**
       
    54 @internalComponent
       
    55 @released
       
    56 */
       
    57 	{ 
       
    58 public: 
       
    59 	IMPORT_C static CMsvEntryArray* NewL(const CArrayFix<TUid>& iMtmList); 
       
    60 	IMPORT_C static CMsvEntryArray* NewLC(const CArrayFix<TUid>& iMtmList); 
       
    61 	IMPORT_C void SortL(TMsvSelectionOrdering aOrdering);
       
    62 	IMPORT_C ~CMsvEntryArray();
       
    63 private:
       
    64 	enum TGroupCriterion
       
    65 		{
       
    66 		EGroupByStandardFolders, 
       
    67 		EGroupByType, 
       
    68 		EGroupByPriority, 
       
    69 		EGroupByMtm, 
       
    70 		EStopGrouping
       
    71 		};
       
    72 private:
       
    73 	TInt NumberOfArraysToSplitIntoL(TGroupCriterion aGroupCriterion);
       
    74 	TBool OkToGroup(TGroupCriterion aGroupCriterion,TMsvSelectionOrdering aOrdering) const;
       
    75 	TInt ArrayId(const TMsvEntry* aEntry,TGroupCriterion aGroupCriterion) const;
       
    76 	void GroupL(TGroupCriterion aGroupCriterion,TMsvSelectionOrdering aOrdering,TBool aDoSort);
       
    77 	void ReverseOrder(TMsvSorting aSortType);
       
    78 	void ReverseOrder();
       
    79 	CMsvEntryArray(const CArrayFix<TUid>& iMtmList);
       
    80 	TKeyArrayFixPtr MessageSortKey(TMsvSorting aSortType) const;
       
    81 
       
    82 	TInt FindSubjectStart(const TDesC& aSubject, const TDesC& aSubjectSkipString) const;
       
    83 	void SubjectBasedSortL(TBool aReverse, const TDesC& aSubjectSkipString);
       
    84 	void DetailBasedSortL();
       
    85 
       
    86 private:
       
    87 	const CArrayFix<TUid>& iOrigMtmList;
       
    88 	CArrayFix<TUid>* iActualMtmList;
       
    89 	};
       
    90 
       
    91 // inline
       
    92 
       
    93 inline TKeyArrayFixPtr::TKeyArrayFixPtr(TInt anOffset,TKeyCmpText aType)
       
    94 	: TKeyArrayFix(anOffset,aType)
       
    95 	{}
       
    96 
       
    97 inline TKeyArrayFixPtr::TKeyArrayFixPtr(TInt anOffset,TKeyCmpText aType,TInt aLength)
       
    98 	: TKeyArrayFix(anOffset,aType,aLength)
       
    99 	{}
       
   100 
       
   101 inline TKeyArrayFixPtr::TKeyArrayFixPtr(TInt anOffset,TKeyCmpNumeric aType)
       
   102 	: TKeyArrayFix(anOffset,aType)
       
   103 	{}
       
   104 
       
   105 
       
   106 #endif