|
1 // Copyright (c) 2007-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 "testscripts.h" |
|
17 |
|
18 CScriptSectionItem::CScriptSectionItem(CScriptSection& aParent) |
|
19 : iParent(aParent) |
|
20 { |
|
21 } |
|
22 |
|
23 void CScriptSectionItem::ConstructL(const TDesC& aItem, const TDesC& aValue) |
|
24 { |
|
25 iItem = aItem.AllocL(); |
|
26 iValue = aValue.AllocL(); |
|
27 } |
|
28 |
|
29 EXPORT_C CScriptSectionItem::~CScriptSectionItem() |
|
30 { |
|
31 delete iItem; |
|
32 delete iValue; |
|
33 } |
|
34 |
|
35 EXPORT_C CScriptSectionItem* CScriptSection::Item(const TDesC& aItem) |
|
36 { |
|
37 CScriptSectionItem* sectionItem = iLastItem; |
|
38 |
|
39 if (!iLastItem || iLastItem->Item().CompareF(aItem) != 0) |
|
40 { |
|
41 const TInt count = iItems->Count(); |
|
42 |
|
43 for (TInt i = 0; i < count; i++) |
|
44 { |
|
45 sectionItem = iItems->At(i); |
|
46 iLastItem = sectionItem; |
|
47 |
|
48 if (sectionItem->Item().CompareF(aItem) == 0) |
|
49 { |
|
50 break; |
|
51 } |
|
52 else |
|
53 { |
|
54 sectionItem = NULL; |
|
55 } |
|
56 } |
|
57 } |
|
58 |
|
59 return sectionItem; |
|
60 } |
|
61 |
|
62 EXPORT_C CScriptSectionItem* CScriptSectionItem::NewLC(CScriptSection& aParent, const TDesC& aItem, const TDesC& aValue) |
|
63 { |
|
64 CScriptSectionItem* self = new (ELeave) CScriptSectionItem(aParent); |
|
65 CleanupStack::PushL(self); |
|
66 self->ConstructL(aItem, aValue); |
|
67 return self; |
|
68 } |