author | William Roberts <williamr@symbian.org> |
Wed, 31 Mar 2010 12:33:34 +0100 | |
branch | Symbian3 |
changeset 4 | 837f303aceeb |
permissions | -rw-r--r-- |
williamr@4 | 1 |
/* |
williamr@4 | 2 |
* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). |
williamr@4 | 3 |
* All rights reserved. |
williamr@4 | 4 |
* This component and the accompanying materials are made available |
williamr@4 | 5 |
* under the terms of "Eclipse Public License v1.0" |
williamr@4 | 6 |
* which accompanies this distribution, and is available |
williamr@4 | 7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
williamr@4 | 8 |
* |
williamr@4 | 9 |
* Initial Contributors: |
williamr@4 | 10 |
* Nokia Corporation - initial contribution. |
williamr@4 | 11 |
* |
williamr@4 | 12 |
* Contributors: |
williamr@4 | 13 |
* |
williamr@4 | 14 |
* Description: Virtual Phonebook sort order that is needed in view creation. |
williamr@4 | 15 |
* |
williamr@4 | 16 |
*/ |
williamr@4 | 17 |
|
williamr@4 | 18 |
|
williamr@4 | 19 |
#ifndef CVPBKSORTORDER_H |
williamr@4 | 20 |
#define CVPBKSORTORDER_H |
williamr@4 | 21 |
|
williamr@4 | 22 |
// INCLUDES |
williamr@4 | 23 |
#include <e32base.h> |
williamr@4 | 24 |
#include <mvpbkfieldtype.h> |
williamr@4 | 25 |
|
williamr@4 | 26 |
// FORWARD DECLARATIONS |
williamr@4 | 27 |
class TResourceReader; |
williamr@4 | 28 |
|
williamr@4 | 29 |
/** |
williamr@4 | 30 |
* Virtual Phonebook sort order. |
williamr@4 | 31 |
* This class can be used to create a sort order, which is needed |
williamr@4 | 32 |
* when creating Virtual Phonebook views. The sort order determines |
williamr@4 | 33 |
* how the view is sorted by setting a field type priority list. |
williamr@4 | 34 |
*/ |
williamr@4 | 35 |
class CVPbkSortOrder : |
williamr@4 | 36 |
public CBase, |
williamr@4 | 37 |
public MVPbkFieldTypeList |
williamr@4 | 38 |
{ |
williamr@4 | 39 |
public: |
williamr@4 | 40 |
/** |
williamr@4 | 41 |
* Constructs new sort order from a |
williamr@4 | 42 |
* VPBK_FIELD_TYPE_MAPPING_LIST resource. |
williamr@4 | 43 |
* |
williamr@4 | 44 |
* @param aReader Resource reader pointing to a |
williamr@4 | 45 |
* VPBK_FIELD_TYPE_MAPPING_LIST resource. |
williamr@4 | 46 |
* @param aMasterFieldTypeList Master field type list types from |
williamr@4 | 47 |
* the resource are mapped against. |
williamr@4 | 48 |
* @exception KErrNotFound if a matching field type is not |
williamr@4 | 49 |
* found from aFieldTypeList. |
williamr@4 | 50 |
*/ |
williamr@4 | 51 |
IMPORT_C static CVPbkSortOrder* NewL( |
williamr@4 | 52 |
TResourceReader& aReader, |
williamr@4 | 53 |
const MVPbkFieldTypeList& aMasterFieldTypeList); |
williamr@4 | 54 |
|
williamr@4 | 55 |
/** |
williamr@4 | 56 |
* Creates a new sort order from an existing one. |
williamr@4 | 57 |
* |
williamr@4 | 58 |
* @param aSortOrder The sort order to duplicate. |
williamr@4 | 59 |
*/ |
williamr@4 | 60 |
IMPORT_C static CVPbkSortOrder* NewL( |
williamr@4 | 61 |
const MVPbkFieldTypeList& aSortOrder); |
williamr@4 | 62 |
|
williamr@4 | 63 |
/** |
williamr@4 | 64 |
* Destructor. |
williamr@4 | 65 |
*/ |
williamr@4 | 66 |
~CVPbkSortOrder(); |
williamr@4 | 67 |
|
williamr@4 | 68 |
public: // Interface |
williamr@4 | 69 |
/** |
williamr@4 | 70 |
* Reserves aSortOrderLength items for the sort order length. |
williamr@4 | 71 |
* This quarantees that following Set() call will not leave because of |
williamr@4 | 72 |
* memory allocation failure. If more than aSortOrderLength items are |
williamr@4 | 73 |
* provided in following Set() calls, rest of the field types are ignored. |
williamr@4 | 74 |
* |
williamr@4 | 75 |
* @param aSortOrderLength Number of field types to reserve space for. |
williamr@4 | 76 |
* @exception Panics if aSortOrderLength <= 0 |
williamr@4 | 77 |
*/ |
williamr@4 | 78 |
IMPORT_C void SetReserveL(TInt aSortOrderLength); |
williamr@4 | 79 |
|
williamr@4 | 80 |
/** |
williamr@4 | 81 |
* Sets new fields types for this sort order from the list. |
williamr@4 | 82 |
* This will not leave because SetReserveL has to be called in advance to |
williamr@4 | 83 |
* reserve space for sort order field types. |
williamr@4 | 84 |
* |
williamr@4 | 85 |
* @param aSortOrder Priority ordered list of field types |
williamr@4 | 86 |
* used as the sort order. |
williamr@4 | 87 |
* @precond SetReserveL called with a proper sort order length. |
williamr@4 | 88 |
*/ |
williamr@4 | 89 |
IMPORT_C void Set(const MVPbkFieldTypeList& aSortOrder); |
williamr@4 | 90 |
|
williamr@4 | 91 |
public: // From MVPbkFieldTypeList |
williamr@4 | 92 |
TInt FieldTypeCount() const; |
williamr@4 | 93 |
const MVPbkFieldType& FieldTypeAt(TInt aIndex) const; |
williamr@4 | 94 |
TBool ContainsSame(const MVPbkFieldType& aFieldType) const; |
williamr@4 | 95 |
TInt MaxMatchPriority() const; |
williamr@4 | 96 |
const MVPbkFieldType* FindMatch(const TVPbkFieldVersitProperty& aMatchProperty, |
williamr@4 | 97 |
TInt aMatchPriority) const; |
williamr@4 | 98 |
const MVPbkFieldType* FindMatch( |
williamr@4 | 99 |
TVPbkNonVersitFieldType aNonVersitType) const; |
williamr@4 | 100 |
const MVPbkFieldType* Find(TInt aFieldTypeResId) const; |
williamr@4 | 101 |
|
williamr@4 | 102 |
private: // Implementation |
williamr@4 | 103 |
CVPbkSortOrder(); |
williamr@4 | 104 |
void ConstructL(TResourceReader& aReader, |
williamr@4 | 105 |
const MVPbkFieldTypeList& aMasterFieldTypeList); |
williamr@4 | 106 |
void ConstructL(const MVPbkFieldTypeList& aSortOrder); |
williamr@4 | 107 |
|
williamr@4 | 108 |
private: |
williamr@4 | 109 |
///Own: Maximum sort order length |
williamr@4 | 110 |
TInt iMaxSortOrderLength; |
williamr@4 | 111 |
///Ref: Sort order array |
williamr@4 | 112 |
RPointerArray<MVPbkFieldType> iSortOrder; |
williamr@4 | 113 |
///Own: Max match priority |
williamr@4 | 114 |
TInt iMaxMatchPriority; |
williamr@4 | 115 |
}; |
williamr@4 | 116 |
|
williamr@4 | 117 |
#endif // CVPBKSORTORDER_H |
williamr@4 | 118 |
|
williamr@4 | 119 |
// End of file |