sl@0: // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include "LogServRecentCondition.h" sl@0: #include "logservpanic.h" sl@0: #include "LogServSqlStrings.h" sl@0: sl@0: sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: // -----> CLogServRecentCondition (source) sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: sl@0: CLogServRecentCondition* CLogServRecentCondition::NewL(TResourceReader& aReader) sl@0: { sl@0: CLogServRecentCondition* self = new(ELeave)CLogServRecentCondition(); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(aReader); sl@0: CleanupStack::Pop(); sl@0: return self; sl@0: } sl@0: sl@0: CLogServRecentCondition::~CLogServRecentCondition() sl@0: { sl@0: delete iString; sl@0: } sl@0: sl@0: TBool CLogServRecentCondition::IsMatch(const CLogEvent& aEvent) const sl@0: { sl@0: TBool match = EFalse; sl@0: switch (iField) sl@0: { sl@0: case ELogContactField: sl@0: match = (aEvent.Contact() == (TLogContactItemId )iValue); sl@0: break; sl@0: sl@0: case ELogDirectionField: sl@0: match = (iString && aEvent.Direction().CompareF(*iString) == 0); sl@0: break; sl@0: sl@0: case ELogDurationTypeField: sl@0: match = (aEvent.DurationType() == (TLogDurationType)iValue); sl@0: break; sl@0: sl@0: case ELogEventTypeField: sl@0: match = (aEvent.EventType() == TUid::Uid(iValue)); sl@0: break; sl@0: sl@0: case ELogNumberField: sl@0: match = (iString && aEvent.Number().CompareF(*iString) == 0); sl@0: break; sl@0: sl@0: case ELogRemotePartyField: sl@0: match = (iString && aEvent.RemoteParty().CompareF(*iString) == 0); sl@0: break; sl@0: sl@0: case ELogStatusField: sl@0: match = (iString && aEvent.Status().CompareF(*iString) == 0); sl@0: break; sl@0: sl@0: case ELogFlagsField: sl@0: match = (aEvent.Flags() & iValue); sl@0: break; sl@0: sl@0: #ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM sl@0: case ELogSimIdField: sl@0: match = (aEvent.SimId() == (TSimId)iValue); sl@0: break; sl@0: #endif sl@0: sl@0: default: sl@0: __ASSERT_DEBUG(EFalse, Panic(ELogUnknownField)); sl@0: break; sl@0: } sl@0: sl@0: return match; sl@0: } sl@0: sl@0: void CLogServRecentCondition::ConstructL(TResourceReader& aReader) sl@0: { sl@0: iField = (TUint16)aReader.ReadUint16(); sl@0: TPtrC string(aReader.ReadTPtrC()); sl@0: iValue = aReader.ReadInt32(); sl@0: sl@0: if (string.Length() > 0) sl@0: { sl@0: iString = string.AllocL(); sl@0: } sl@0: } sl@0: sl@0: #ifdef SYSLIBS_TEST sl@0: sl@0: #pragma BullseyeCoverage off sl@0: sl@0: //When SYSLIBS_TEST macro is defined, creates a test recent list condition. sl@0: //Used from the unit tests to cover many of the production code branches, otherwise uncovered, sl@0: //because the recent list conditions can be loaded only from the resource file. sl@0: CLogServRecentCondition* CLogServRecentCondition::TestNewL(TUint16 aField) sl@0: { sl@0: CLogServRecentCondition* self = new(ELeave)CLogServRecentCondition; sl@0: CleanupStack::PushL(self); sl@0: self->TestConstructL(aField); sl@0: CleanupStack::Pop(); sl@0: return self; sl@0: } sl@0: sl@0: //When SYSLIBS_TEST macro is defined, creates a test recent list condition. sl@0: //Used from the unit tests to cover many of the production code branches, otherwise uncovered, sl@0: //because the recent list conditions can be loaded only from the resource file. sl@0: void CLogServRecentCondition::TestConstructL(TUint16 aField) sl@0: { sl@0: iField = aField; sl@0: switch(iField) sl@0: { sl@0: case ELogDirectionField: sl@0: iString = HBufC::NewL(16); sl@0: *iString = KLogRctTListDirection; sl@0: break; sl@0: case ELogDurationTypeField: sl@0: iValue = KLogRctTListDurationType; sl@0: break; sl@0: case ELogNumberField: sl@0: iString = HBufC::NewL(16); sl@0: *iString = KLogRctTListNumber; sl@0: break; sl@0: case ELogRemotePartyField: sl@0: iString = HBufC::NewL(16); sl@0: *iString = KLogRctTListRemoteParty; sl@0: break; sl@0: case ELogStatusField: sl@0: iString = HBufC::NewL(16); sl@0: *iString = KLogRctTListStatus; sl@0: break; sl@0: case ELogFlagsField: sl@0: iValue = KLogRctTListFlags; sl@0: break; sl@0: #ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM sl@0: case ELogSimIdField: sl@0: iValue = KLogRctTListSimId; sl@0: break; sl@0: #endif sl@0: default: sl@0: __ASSERT_DEBUG(EFalse, Panic(ELogUnknownField)); sl@0: break; sl@0: } sl@0: } sl@0: sl@0: #pragma BullseyeCoverage on sl@0: sl@0: #endif//SYSLIBS_TEST