idlehomescreen/xmluirendering/uiengine/src/xnpropertycomparator.cpp
changeset 0 f72a12da539e
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2 * Copyright (c) 2002-2004 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:  Compares two objects.
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDES
       
    19 #include "xnpropertycomparator.h"
       
    20 #include "xnproperty.h"
       
    21 #include "xnpropertylist.h"
       
    22 #include "xndomproperty.h"
       
    23 
       
    24 // -----------------------------------------------------------------------------
       
    25 // TXnPropertyComparator::TXnPropertyComparator()
       
    26 // -----------------------------------------------------------------------------
       
    27 //
       
    28 TXnPropertyComparator::TXnPropertyComparator()
       
    29     {
       
    30     }
       
    31 
       
    32 // -----------------------------------------------------------------------------
       
    33 // TXnPropertyComparator::~TXnPropertyComparator()
       
    34 // -----------------------------------------------------------------------------
       
    35 //
       
    36 TXnPropertyComparator::~TXnPropertyComparator()
       
    37     {
       
    38     }
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // TXnPropertyComparator::Equals()
       
    42 // -----------------------------------------------------------------------------
       
    43 //
       
    44 TBool TXnPropertyComparator::Equals( CBase& aItem1, CBase& aItem2 )
       
    45     {
       
    46     CXnPropertyKey& item1 = static_cast< CXnPropertyKey& >( aItem1 );
       
    47     CXnProperty& item2 = static_cast< CXnProperty& >( aItem2 );
       
    48     // return ETrue if keys match and pseudoclasses are not set
       
    49     // or if keys match and both pseudoclasses are set and match
       
    50     CXnDomProperty* property2 = item2.Property();
       
    51     if ( item1.iPseudoClass == property2->PseudoClass() &&
       
    52          *( item1.iString ) == property2->Name() )
       
    53         {
       
    54         // names match, pseudoclasses match or are both not set
       
    55         return ETrue;
       
    56         }
       
    57     // all other cases return false.
       
    58     return EFalse;
       
    59     }