phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberSequentialMatchStrategy.cpp
changeset 0 e686773b3f54
child 45 34879f5cfc63
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberSequentialMatchStrategy.cpp	Tue Feb 02 10:12:17 2010 +0200
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2005-2007 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:  Phone number matching strategy for sequential matching.
+*
+*/
+
+
+#include "CVPbkPhoneNumberSequentialMatchStrategy.h"
+
+#include <MVPbkContactStore.h>
+#include <MVPbkContactOperation.h>
+
+CVPbkPhoneNumberSequentialMatchStrategy::CVPbkPhoneNumberSequentialMatchStrategy() 
+    {
+    }
+
+inline void CVPbkPhoneNumberSequentialMatchStrategy::ConstructL(
+        const TConfig& aConfig,
+        CVPbkContactManager& aContactManager,
+        MVPbkContactFindObserver& aObserver)
+    {
+    BaseConstructL(aConfig, aContactManager, aObserver);
+    }
+
+CVPbkPhoneNumberSequentialMatchStrategy* CVPbkPhoneNumberSequentialMatchStrategy::NewL(
+        const TConfig& aConfig,
+        CVPbkContactManager& aContactManager, 
+        MVPbkContactFindObserver& aObserver)
+    {
+    CVPbkPhoneNumberSequentialMatchStrategy* self = 
+            new(ELeave) CVPbkPhoneNumberSequentialMatchStrategy;
+    CleanupStack::PushL(self);
+    self->ConstructL(aConfig, aContactManager, aObserver);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CVPbkPhoneNumberSequentialMatchStrategy::~CVPbkPhoneNumberSequentialMatchStrategy()
+    {
+    }
+
+MVPbkContactOperation* CVPbkPhoneNumberSequentialMatchStrategy::CreateFindOperationLC(
+        const TDesC& aPhoneNumber)
+    {
+    MVPbkContactOperation* operation = NULL;
+
+    // Get the next store's operation if it not null
+    while ( iCurrentOperation < StoresToMatch().Count() && !operation )
+        {
+        operation = StoresToMatch()[iCurrentOperation]->CreateMatchPhoneNumberOperationL(
+                aPhoneNumber, MaxMatchDigits(), FindObserver());
+        
+        if ( operation )
+            {
+            CleanupDeletePushL(operation);
+            // Go to next operation
+            }
+        ++iCurrentOperation;
+        }
+
+    return operation;
+    }
+
+void CVPbkPhoneNumberSequentialMatchStrategy::InitMatchingL()
+    {
+    iCurrentOperation = 0;
+    }
+    
+// End of File