contacts_plat/virtual_phonebook_policy_api/inc/phonebook/CVPbkContactViewSortPolicy.h
branchRCL_3
changeset 63 f4a778e096c2
child 64 c1e8ba0c2b16
equal deleted inserted replaced
62:5b6f26637ad3 63:f4a778e096c2
       
     1 /*
       
     2 * Copyright (c) 2002-2007 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:  an interface for sort policy for the Virtual Phonebook.
       
    15 *                The implementation uses UID: KVPbkSortPolicyImplementationUID
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef CVPBKCONTACTVIEWSORTPOLICY_H
       
    21 #define CVPBKCONTACTVIEWSORTPOLICY_H
       
    22 
       
    23 #include <ecom/ecom.h>
       
    24 #include <VPbkPolicyUid.h>
       
    25 #include <MVPbkContactViewSortPolicy.h>
       
    26 
       
    27 class CVPbkContactManager;
       
    28 
       
    29 /**
       
    30  * ECom plugin for contact sort policy.
       
    31  */
       
    32 class CVPbkContactViewSortPolicy : public CBase,
       
    33                                    public MVPbkContactViewSortPolicy
       
    34     {
       
    35     public: // Constructor and destructor
       
    36         struct TParam
       
    37             {
       
    38             inline TParam(const MVPbkFieldTypeList& aFieldTypes,
       
    39                           const MVPbkFieldTypeList& aSortOrder,
       
    40                           RFs* aFs = NULL);
       
    41 
       
    42             ///Ref: Global list of available field types.
       
    43             const MVPbkFieldTypeList& iFieldTypes;
       
    44             ///Ref: Initial sort order for the sort policy.
       
    45             const MVPbkFieldTypeList& iSortOrder;
       
    46             ///Ref: (optional) handle to file server
       
    47             RFs* iFs;
       
    48             ///Own: Reserve for future extension
       
    49             TAny* iSpare;
       
    50             };
       
    51 
       
    52         /**
       
    53          * Returns new instance of this class.
       
    54          */
       
    55         static CVPbkContactViewSortPolicy* NewL(TParam& aParam);
       
    56 
       
    57         static CVPbkContactViewSortPolicy* NewL();
       
    58 
       
    59         ~CVPbkContactViewSortPolicy();
       
    60 
       
    61     private:
       
    62         ///Own: Destructor ID key
       
    63         TUid iDtorIDKey;
       
    64     };
       
    65 
       
    66 
       
    67 // INLINE FUNCTIONS
       
    68 
       
    69 inline CVPbkContactViewSortPolicy::TParam::TParam(
       
    70         const MVPbkFieldTypeList& aFieldTypes, 
       
    71         const MVPbkFieldTypeList& aSortOrder,
       
    72         RFs* aFs) :
       
    73     iFieldTypes(aFieldTypes),
       
    74     iSortOrder(aSortOrder),
       
    75     iFs(NULL)
       
    76     {
       
    77     if (aFs)
       
    78         {
       
    79         iFs = aFs;
       
    80         }
       
    81     }
       
    82 
       
    83 
       
    84 inline CVPbkContactViewSortPolicy* CVPbkContactViewSortPolicy::NewL(TParam& aParam)
       
    85     {
       
    86     TAny* ptr = NULL;
       
    87     ptr = REComSession::CreateImplementationL(
       
    88         TUid::Uid(KVPbkSortPolicyImplementationUID), 
       
    89         _FOFF(CVPbkContactViewSortPolicy, iDtorIDKey), 
       
    90         &aParam);
       
    91 
       
    92     return reinterpret_cast<CVPbkContactViewSortPolicy*>(ptr);
       
    93     } 
       
    94 
       
    95 inline CVPbkContactViewSortPolicy* CVPbkContactViewSortPolicy::NewL()
       
    96     {
       
    97     TAny* ptr = NULL;
       
    98     ptr = REComSession::CreateImplementationL
       
    99         (TUid::Uid(KVPbkSortPolicyImplementationUID), 
       
   100          _FOFF(CVPbkContactViewSortPolicy, iDtorIDKey), 
       
   101          NULL);
       
   102 
       
   103     return reinterpret_cast<CVPbkContactViewSortPolicy*>(ptr);
       
   104     } 
       
   105     
       
   106 inline CVPbkContactViewSortPolicy::~CVPbkContactViewSortPolicy()
       
   107     {
       
   108     REComSession::DestroyedImplementation(iDtorIDKey);
       
   109     }   
       
   110 
       
   111 
       
   112 #endif // CVPBKCONTACTVIEWSORTPOLICY_H
       
   113 
       
   114 //End of file