sl@0
|
1 |
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include <barsread.h>
|
sl@0
|
17 |
#include <logcli.h>
|
sl@0
|
18 |
#include <logfilterandeventconstants.hrh>
|
sl@0
|
19 |
#include "LogServRecentCondition.h"
|
sl@0
|
20 |
#include "logservpanic.h"
|
sl@0
|
21 |
#include "LogServSqlStrings.h"
|
sl@0
|
22 |
|
sl@0
|
23 |
|
sl@0
|
24 |
/////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
25 |
// -----> CLogServRecentCondition (source)
|
sl@0
|
26 |
/////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
27 |
|
sl@0
|
28 |
CLogServRecentCondition* CLogServRecentCondition::NewL(TResourceReader& aReader)
|
sl@0
|
29 |
{
|
sl@0
|
30 |
CLogServRecentCondition* self = new(ELeave)CLogServRecentCondition();
|
sl@0
|
31 |
CleanupStack::PushL(self);
|
sl@0
|
32 |
self->ConstructL(aReader);
|
sl@0
|
33 |
CleanupStack::Pop();
|
sl@0
|
34 |
return self;
|
sl@0
|
35 |
}
|
sl@0
|
36 |
|
sl@0
|
37 |
CLogServRecentCondition::~CLogServRecentCondition()
|
sl@0
|
38 |
{
|
sl@0
|
39 |
delete iString;
|
sl@0
|
40 |
}
|
sl@0
|
41 |
|
sl@0
|
42 |
TBool CLogServRecentCondition::IsMatch(const CLogEvent& aEvent) const
|
sl@0
|
43 |
{
|
sl@0
|
44 |
TBool match = EFalse;
|
sl@0
|
45 |
switch (iField)
|
sl@0
|
46 |
{
|
sl@0
|
47 |
case ELogContactField:
|
sl@0
|
48 |
match = (aEvent.Contact() == (TLogContactItemId )iValue);
|
sl@0
|
49 |
break;
|
sl@0
|
50 |
|
sl@0
|
51 |
case ELogDirectionField:
|
sl@0
|
52 |
match = (iString && aEvent.Direction().CompareF(*iString) == 0);
|
sl@0
|
53 |
break;
|
sl@0
|
54 |
|
sl@0
|
55 |
case ELogDurationTypeField:
|
sl@0
|
56 |
match = (aEvent.DurationType() == (TLogDurationType)iValue);
|
sl@0
|
57 |
break;
|
sl@0
|
58 |
|
sl@0
|
59 |
case ELogEventTypeField:
|
sl@0
|
60 |
match = (aEvent.EventType() == TUid::Uid(iValue));
|
sl@0
|
61 |
break;
|
sl@0
|
62 |
|
sl@0
|
63 |
case ELogNumberField:
|
sl@0
|
64 |
match = (iString && aEvent.Number().CompareF(*iString) == 0);
|
sl@0
|
65 |
break;
|
sl@0
|
66 |
|
sl@0
|
67 |
case ELogRemotePartyField:
|
sl@0
|
68 |
match = (iString && aEvent.RemoteParty().CompareF(*iString) == 0);
|
sl@0
|
69 |
break;
|
sl@0
|
70 |
|
sl@0
|
71 |
case ELogStatusField:
|
sl@0
|
72 |
match = (iString && aEvent.Status().CompareF(*iString) == 0);
|
sl@0
|
73 |
break;
|
sl@0
|
74 |
|
sl@0
|
75 |
case ELogFlagsField:
|
sl@0
|
76 |
match = (aEvent.Flags() & iValue);
|
sl@0
|
77 |
break;
|
sl@0
|
78 |
|
sl@0
|
79 |
#ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM
|
sl@0
|
80 |
case ELogSimIdField:
|
sl@0
|
81 |
match = (aEvent.SimId() == (TSimId)iValue);
|
sl@0
|
82 |
break;
|
sl@0
|
83 |
#endif
|
sl@0
|
84 |
|
sl@0
|
85 |
default:
|
sl@0
|
86 |
__ASSERT_DEBUG(EFalse, Panic(ELogUnknownField));
|
sl@0
|
87 |
break;
|
sl@0
|
88 |
}
|
sl@0
|
89 |
|
sl@0
|
90 |
return match;
|
sl@0
|
91 |
}
|
sl@0
|
92 |
|
sl@0
|
93 |
void CLogServRecentCondition::ConstructL(TResourceReader& aReader)
|
sl@0
|
94 |
{
|
sl@0
|
95 |
iField = (TUint16)aReader.ReadUint16();
|
sl@0
|
96 |
TPtrC string(aReader.ReadTPtrC());
|
sl@0
|
97 |
iValue = aReader.ReadInt32();
|
sl@0
|
98 |
|
sl@0
|
99 |
if (string.Length() > 0)
|
sl@0
|
100 |
{
|
sl@0
|
101 |
iString = string.AllocL();
|
sl@0
|
102 |
}
|
sl@0
|
103 |
}
|
sl@0
|
104 |
|
sl@0
|
105 |
#ifdef SYSLIBS_TEST
|
sl@0
|
106 |
|
sl@0
|
107 |
#pragma BullseyeCoverage off
|
sl@0
|
108 |
|
sl@0
|
109 |
//When SYSLIBS_TEST macro is defined, creates a test recent list condition.
|
sl@0
|
110 |
//Used from the unit tests to cover many of the production code branches, otherwise uncovered,
|
sl@0
|
111 |
//because the recent list conditions can be loaded only from the resource file.
|
sl@0
|
112 |
CLogServRecentCondition* CLogServRecentCondition::TestNewL(TUint16 aField)
|
sl@0
|
113 |
{
|
sl@0
|
114 |
CLogServRecentCondition* self = new(ELeave)CLogServRecentCondition;
|
sl@0
|
115 |
CleanupStack::PushL(self);
|
sl@0
|
116 |
self->TestConstructL(aField);
|
sl@0
|
117 |
CleanupStack::Pop();
|
sl@0
|
118 |
return self;
|
sl@0
|
119 |
}
|
sl@0
|
120 |
|
sl@0
|
121 |
//When SYSLIBS_TEST macro is defined, creates a test recent list condition.
|
sl@0
|
122 |
//Used from the unit tests to cover many of the production code branches, otherwise uncovered,
|
sl@0
|
123 |
//because the recent list conditions can be loaded only from the resource file.
|
sl@0
|
124 |
void CLogServRecentCondition::TestConstructL(TUint16 aField)
|
sl@0
|
125 |
{
|
sl@0
|
126 |
iField = aField;
|
sl@0
|
127 |
switch(iField)
|
sl@0
|
128 |
{
|
sl@0
|
129 |
case ELogDirectionField:
|
sl@0
|
130 |
iString = HBufC::NewL(16);
|
sl@0
|
131 |
*iString = KLogRctTListDirection;
|
sl@0
|
132 |
break;
|
sl@0
|
133 |
case ELogDurationTypeField:
|
sl@0
|
134 |
iValue = KLogRctTListDurationType;
|
sl@0
|
135 |
break;
|
sl@0
|
136 |
case ELogNumberField:
|
sl@0
|
137 |
iString = HBufC::NewL(16);
|
sl@0
|
138 |
*iString = KLogRctTListNumber;
|
sl@0
|
139 |
break;
|
sl@0
|
140 |
case ELogRemotePartyField:
|
sl@0
|
141 |
iString = HBufC::NewL(16);
|
sl@0
|
142 |
*iString = KLogRctTListRemoteParty;
|
sl@0
|
143 |
break;
|
sl@0
|
144 |
case ELogStatusField:
|
sl@0
|
145 |
iString = HBufC::NewL(16);
|
sl@0
|
146 |
*iString = KLogRctTListStatus;
|
sl@0
|
147 |
break;
|
sl@0
|
148 |
case ELogFlagsField:
|
sl@0
|
149 |
iValue = KLogRctTListFlags;
|
sl@0
|
150 |
break;
|
sl@0
|
151 |
#ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM
|
sl@0
|
152 |
case ELogSimIdField:
|
sl@0
|
153 |
iValue = KLogRctTListSimId;
|
sl@0
|
154 |
break;
|
sl@0
|
155 |
#endif
|
sl@0
|
156 |
default:
|
sl@0
|
157 |
__ASSERT_DEBUG(EFalse, Panic(ELogUnknownField));
|
sl@0
|
158 |
break;
|
sl@0
|
159 |
}
|
sl@0
|
160 |
}
|
sl@0
|
161 |
|
sl@0
|
162 |
#pragma BullseyeCoverage on
|
sl@0
|
163 |
|
sl@0
|
164 |
#endif//SYSLIBS_TEST
|