os/persistentdata/loggingservices/eventlogger/LogServ/src/LogServRecentCondition.cpp
First public contribution.
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
18 #include <logfilterandeventconstants.hrh>
19 #include "LogServRecentCondition.h"
20 #include "logservpanic.h"
21 #include "LogServSqlStrings.h"
24 /////////////////////////////////////////////////////////////////////////////////////////
25 // -----> CLogServRecentCondition (source)
26 /////////////////////////////////////////////////////////////////////////////////////////
28 CLogServRecentCondition* CLogServRecentCondition::NewL(TResourceReader& aReader)
30 CLogServRecentCondition* self = new(ELeave)CLogServRecentCondition();
31 CleanupStack::PushL(self);
32 self->ConstructL(aReader);
37 CLogServRecentCondition::~CLogServRecentCondition()
42 TBool CLogServRecentCondition::IsMatch(const CLogEvent& aEvent) const
47 case ELogContactField:
48 match = (aEvent.Contact() == (TLogContactItemId )iValue);
51 case ELogDirectionField:
52 match = (iString && aEvent.Direction().CompareF(*iString) == 0);
55 case ELogDurationTypeField:
56 match = (aEvent.DurationType() == (TLogDurationType)iValue);
59 case ELogEventTypeField:
60 match = (aEvent.EventType() == TUid::Uid(iValue));
64 match = (iString && aEvent.Number().CompareF(*iString) == 0);
67 case ELogRemotePartyField:
68 match = (iString && aEvent.RemoteParty().CompareF(*iString) == 0);
72 match = (iString && aEvent.Status().CompareF(*iString) == 0);
76 match = (aEvent.Flags() & iValue);
79 #ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM
81 match = (aEvent.SimId() == (TSimId)iValue);
86 __ASSERT_DEBUG(EFalse, Panic(ELogUnknownField));
93 void CLogServRecentCondition::ConstructL(TResourceReader& aReader)
95 iField = (TUint16)aReader.ReadUint16();
96 TPtrC string(aReader.ReadTPtrC());
97 iValue = aReader.ReadInt32();
99 if (string.Length() > 0)
101 iString = string.AllocL();
107 #pragma BullseyeCoverage off
109 //When SYSLIBS_TEST macro is defined, creates a test recent list condition.
110 //Used from the unit tests to cover many of the production code branches, otherwise uncovered,
111 //because the recent list conditions can be loaded only from the resource file.
112 CLogServRecentCondition* CLogServRecentCondition::TestNewL(TUint16 aField)
114 CLogServRecentCondition* self = new(ELeave)CLogServRecentCondition;
115 CleanupStack::PushL(self);
116 self->TestConstructL(aField);
121 //When SYSLIBS_TEST macro is defined, creates a test recent list condition.
122 //Used from the unit tests to cover many of the production code branches, otherwise uncovered,
123 //because the recent list conditions can be loaded only from the resource file.
124 void CLogServRecentCondition::TestConstructL(TUint16 aField)
129 case ELogDirectionField:
130 iString = HBufC::NewL(16);
131 *iString = KLogRctTListDirection;
133 case ELogDurationTypeField:
134 iValue = KLogRctTListDurationType;
136 case ELogNumberField:
137 iString = HBufC::NewL(16);
138 *iString = KLogRctTListNumber;
140 case ELogRemotePartyField:
141 iString = HBufC::NewL(16);
142 *iString = KLogRctTListRemoteParty;
144 case ELogStatusField:
145 iString = HBufC::NewL(16);
146 *iString = KLogRctTListStatus;
149 iValue = KLogRctTListFlags;
151 #ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM
153 iValue = KLogRctTListSimId;
157 __ASSERT_DEBUG(EFalse, Panic(ELogUnknownField));
162 #pragma BullseyeCoverage on