idlehomescreen/xmluirendering/uiengine/src/xnpropertycomparator.cpp
changeset 0 f72a12da539e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/idlehomescreen/xmluirendering/uiengine/src/xnpropertycomparator.cpp	Thu Dec 17 08:40:49 2009 +0200
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Compares two objects.
+*
+*/
+
+// INCLUDES
+#include "xnpropertycomparator.h"
+#include "xnproperty.h"
+#include "xnpropertylist.h"
+#include "xndomproperty.h"
+
+// -----------------------------------------------------------------------------
+// TXnPropertyComparator::TXnPropertyComparator()
+// -----------------------------------------------------------------------------
+//
+TXnPropertyComparator::TXnPropertyComparator()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TXnPropertyComparator::~TXnPropertyComparator()
+// -----------------------------------------------------------------------------
+//
+TXnPropertyComparator::~TXnPropertyComparator()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TXnPropertyComparator::Equals()
+// -----------------------------------------------------------------------------
+//
+TBool TXnPropertyComparator::Equals( CBase& aItem1, CBase& aItem2 )
+    {
+    CXnPropertyKey& item1 = static_cast< CXnPropertyKey& >( aItem1 );
+    CXnProperty& item2 = static_cast< CXnProperty& >( aItem2 );
+    // return ETrue if keys match and pseudoclasses are not set
+    // or if keys match and both pseudoclasses are set and match
+    CXnDomProperty* property2 = item2.Property();
+    if ( item1.iPseudoClass == property2->PseudoClass() &&
+         *( item1.iString ) == property2->Name() )
+        {
+        // names match, pseudoclasses match or are both not set
+        return ETrue;
+        }
+    // all other cases return false.
+    return EFalse;
+    }