0
|
1 |
/**
|
|
2 |
* ====================================================================
|
|
3 |
* container.cpp
|
|
4 |
* Copyright (c) 2006-2007 Nokia Corporation
|
|
5 |
*
|
|
6 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7 |
* you may not use this file except in compliance with the License.
|
|
8 |
* You may obtain a copy of the License at
|
|
9 |
*
|
|
10 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11 |
*
|
|
12 |
* Unless required by applicable law or agreed to in writing, software
|
|
13 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15 |
* See the License for the specific language governing permissions and
|
|
16 |
* limitations under the License.
|
|
17 |
* ====================================================================
|
|
18 |
*/
|
|
19 |
|
|
20 |
#include "container.h"
|
|
21 |
|
|
22 |
//Construction.
|
|
23 |
CLogContainer* CLogContainer::NewL(TInt aDirection, TUid aType)
|
|
24 |
{
|
|
25 |
CLogContainer* self = new (ELeave) CLogContainer;
|
|
26 |
CleanupStack::PushL(self);
|
|
27 |
self->ConstructL(aDirection, aType);
|
|
28 |
CleanupStack::Pop(self);
|
|
29 |
return self;
|
|
30 |
}
|
|
31 |
void CLogContainer::ConstructL(TInt aDirection, TUid aType)
|
|
32 |
{
|
|
33 |
//
|
|
34 |
iEventArray = new (ELeave) CEventArray(1);
|
|
35 |
iLog = CLogEngine::NewL(*iEventArray, aDirection, aType);
|
|
36 |
}
|
|
37 |
CLogContainer::CLogContainer()
|
|
38 |
{
|
|
39 |
//
|
|
40 |
}
|
|
41 |
|
|
42 |
|
|
43 |
//Destructor
|
|
44 |
CLogContainer::~CLogContainer()
|
|
45 |
{
|
|
46 |
//Release reserved memory
|
|
47 |
if (iLog)
|
|
48 |
{
|
|
49 |
delete iLog;
|
|
50 |
}
|
|
51 |
if (iEventArray)
|
|
52 |
{
|
|
53 |
delete iEventArray;
|
|
54 |
}
|
|
55 |
}
|
|
56 |
|
|
57 |
//Operational methods. Pass the commands to the engine...
|
|
58 |
void CLogContainer::StartL()
|
|
59 |
{
|
|
60 |
iLog->StartL();
|
|
61 |
}
|
|
62 |
TInt CLogContainer::Count()
|
|
63 |
{
|
|
64 |
return iEventArray->Count();
|
|
65 |
}
|
|
66 |
//CLogEvent& CLogContainer::Get(TInt aIndex) const
|
|
67 |
CEventData& CLogContainer::Get(TInt aIndex) const
|
|
68 |
{
|
|
69 |
if (aIndex < 0 || aIndex > iEventArray->Count())
|
|
70 |
{
|
|
71 |
User::Panic(_L("CLogContainer Get method called with invalid index!"), KErrArgument);
|
|
72 |
}
|
|
73 |
//
|
|
74 |
return (*iEventArray)[aIndex];
|
|
75 |
}
|