languageinterworkingfw/servicehandler/src/liwserviceifbase.cpp
changeset 57 61b27eec6533
parent 45 7aa6007702af
equal deleted inserted replaced
45:7aa6007702af 57:61b27eec6533
     1 /*
       
     2 * Copyright (c) 2003-2005 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 the License "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:      
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 #include <ecom/ecom.h>
       
    24 #include "liwserviceifbase.h"
       
    25 #include "liwcommon.h"
       
    26 #include "liwservicedata.h"
       
    27 
       
    28 EXPORT_C CLiwServiceIfBase::~CLiwServiceIfBase()
       
    29     {
       
    30     if (iDtorKeyId.iUid)
       
    31         {
       
    32         REComSession::DestroyedImplementation(iDtorKeyId);
       
    33         }
       
    34     iCriterias.Close();
       
    35     
       
    36     if(iReserved)
       
    37     	delete (CLiwServiceData*)iReserved;
       
    38     }
       
    39 
       
    40 
       
    41 void CLiwServiceIfBase::SetDtorKeyId(TUid aDtorKeyId)
       
    42     {
       
    43     iDtorKeyId = aDtorKeyId;
       
    44     }
       
    45 
       
    46 
       
    47 TBool CLiwServiceIfBase::Match(CLiwCriteriaItem* aItem)
       
    48     {
       
    49     for (TInt index = 0; index < iCriterias.Count(); index++)
       
    50         {   
       
    51         if ((iCriterias[index]->ServiceClass() == aItem->ServiceClass()) &&
       
    52             (iCriterias[index]->ServiceCmd() == aItem->ServiceCmd()) &&
       
    53             (iCriterias[index]->ContentType() == aItem->ContentType()) &&
       
    54             (iCriterias[index]->Options() == aItem->Options()) &&
       
    55             (iCriterias[index]->DefaultProvider() == aItem->DefaultProvider()))
       
    56             {
       
    57             if (iCriterias[index]->ServiceCmd() == KLiwCmdAsStr)
       
    58                 {
       
    59                 return (iCriterias[index]->ServiceCmdStr() == aItem->ServiceCmdStr()) ? ETrue : EFalse;   
       
    60                 }
       
    61               
       
    62             else
       
    63                 {
       
    64                  return ETrue;    
       
    65                 }
       
    66             }
       
    67         }
       
    68 
       
    69     return EFalse;
       
    70     }
       
    71 
       
    72 
       
    73 void CLiwServiceIfBase::AddCriteria(CLiwCriteriaItem* aItem)
       
    74     {
       
    75     iCriterias.Append(aItem);
       
    76     }
       
    77 
       
    78 
       
    79 
       
    80 TUid CLiwServiceIfBase::ImplementationUid() const
       
    81     {
       
    82     return iImplUid;
       
    83     }
       
    84 
       
    85 
       
    86 
       
    87 void CLiwServiceIfBase::SetImplementationUid(TUid aUid)
       
    88     {
       
    89     iImplUid = aUid;
       
    90     }
       
    91 
       
    92 
       
    93 
       
    94 TBool CLiwServiceIfBase::HasCriteria(CLiwCriteriaItem& aItem) const
       
    95     {
       
    96     TInt index;
       
    97 
       
    98     for (index = 0; index < iCriterias.Count(); index++)
       
    99         {
       
   100         if (aItem == *(iCriterias[index]))
       
   101             {
       
   102             return ETrue;
       
   103             }
       
   104         }
       
   105 
       
   106     return EFalse;
       
   107     }
       
   108 
       
   109 
       
   110 EXPORT_C void* CLiwServiceIfBase::ExtensionInterface(TUid aInterface)
       
   111     {
       
   112     if(KLiwGetServiceDataIf==aInterface.iUid)
       
   113     {
       
   114     	return iReserved;
       
   115     }
       
   116     
       
   117     return NULL;
       
   118     }
       
   119 // Enf of file