|
1 // Copyright (c) 1997-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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "ComponentInfo.h" |
|
17 |
|
18 |
|
19 CComponentInfo::CComponentInfo() |
|
20 : CBase() |
|
21 { |
|
22 } |
|
23 |
|
24 |
|
25 CComponentInfo::~CComponentInfo() |
|
26 { |
|
27 iComponentTesterGlobalCreationFuncLC = NULL; |
|
28 // We took ownership of these objects at construction, therefore we delete them |
|
29 if(iUnitTestsInfo) |
|
30 { |
|
31 iUnitTestsInfo->ResetAndDestroy(); |
|
32 delete iUnitTestsInfo; |
|
33 } |
|
34 } |
|
35 |
|
36 |
|
37 CComponentInfo* CComponentInfo::NewLC(ComponentTesterInitialiserLC aEntryFunc, RPointerArray<CUnitTestInfo>* aUnitTestsInfo) |
|
38 { |
|
39 CComponentInfo* self = new (ELeave) CComponentInfo(); |
|
40 CleanupStack::PushL(self); |
|
41 |
|
42 // There must be no Leave'able functions following the Construct |
|
43 // as we take control of the objects on exit. |
|
44 self->Construct(aEntryFunc, aUnitTestsInfo); |
|
45 return self; |
|
46 } |
|
47 |
|
48 |
|
49 EXPORT_C CComponentInfo* CComponentInfo::NewL(ComponentTesterInitialiserLC aEntryFunc, RPointerArray<CUnitTestInfo>* aUnitTestsInfo) |
|
50 { |
|
51 CComponentInfo* self = NewLC(aEntryFunc, aUnitTestsInfo); |
|
52 CleanupStack::Pop(); |
|
53 return self; |
|
54 } |
|
55 |
|
56 |
|
57 void CComponentInfo::Construct(ComponentTesterInitialiserLC aEntryFunc, RPointerArray<CUnitTestInfo>* aUnitTestsInfo) |
|
58 { |
|
59 // NOTE these must be the final lines of code. |
|
60 // There must be NO Leave'able code following this |
|
61 // as we take control of these objects on exit. |
|
62 iComponentTesterGlobalCreationFuncLC = aEntryFunc; |
|
63 iUnitTestsInfo = aUnitTestsInfo; |
|
64 } |
|
65 |
|
66 |