applicationinterworkingfw/ServiceHandler/src/AiwBinding.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     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 "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 #include "AiwBinding.h"
       
    22 
       
    23 
       
    24 CAiwBinding* CAiwBinding::NewL()
       
    25     {
       
    26     return new (ELeave) CAiwBinding();
       
    27     }
       
    28 
       
    29 
       
    30 
       
    31 CAiwBinding* CAiwBinding::NewLC()
       
    32     {
       
    33     CAiwBinding* bind = new (ELeave) CAiwBinding();
       
    34     CleanupStack::PushL(bind);
       
    35     return bind;
       
    36     }
       
    37 
       
    38 
       
    39 void CAiwBinding::AddProviderL(CAiwServiceIfBase* aProvider, TBool aIsDefault)
       
    40     {
       
    41     if (aIsDefault)
       
    42         {
       
    43         // Default provider will be the first item in array.
       
    44         User::LeaveIfError(iProviders.Insert(aProvider, 0));
       
    45         }
       
    46     else
       
    47         {
       
    48         User::LeaveIfError(iProviders.Append(aProvider));
       
    49         }
       
    50     }
       
    51 
       
    52 
       
    53 
       
    54 TInt CAiwBinding::HasCriteriaItem(CAiwCriteriaItem& aItem) const
       
    55     {
       
    56     const TInt count = iInterest.Count();
       
    57     for (TInt i = 0; i < count; i++)
       
    58         {
       
    59         if ((*iInterest[i]) == aItem)
       
    60             {
       
    61             return i;
       
    62             }
       
    63         }
       
    64 
       
    65     return KErrNotFound;
       
    66     }
       
    67 
       
    68 
       
    69 TBool CAiwBinding::HasProvider(CAiwServiceIfBase* aProvider) const
       
    70     {
       
    71     for (TInt i = 0; i < iProviders.Count(); i++)
       
    72         {
       
    73         if (iProviders[i] == aProvider)
       
    74             {
       
    75             return ETrue;
       
    76             }
       
    77         }
       
    78 
       
    79     return EFalse;
       
    80     }
       
    81 
       
    82 
       
    83 void CAiwBinding::RemoveCriteria(TInt aIndex)
       
    84     {
       
    85     iInterest.Remove( aIndex ); 
       
    86     }
       
    87 
       
    88 
       
    89 TBool CAiwBinding::RemoveProvider(TInt aImplUid)
       
    90     {
       
    91     for (TInt i = 0; i < iProviders.Count(); i++)
       
    92         {
       
    93         if (iProviders[i]->ImplementationUid().iUid == aImplUid)
       
    94             {
       
    95             iProviders.Remove( i );
       
    96             return ETrue;
       
    97             }
       
    98         }
       
    99 
       
   100     return EFalse;
       
   101     }
       
   102 
       
   103     
       
   104 TBool CAiwBinding::HasServiceCmd(TInt aServiceCmd) const    
       
   105     {
       
   106     for (TInt i = 0; i < iInterest.Count(); i++)
       
   107         {
       
   108         if(iInterest[i]->ServiceCmd() == aServiceCmd)
       
   109             {
       
   110             return ETrue;
       
   111             }
       
   112         }
       
   113     return EFalse;
       
   114     }
       
   115 
       
   116 // End of file