|
1 /* |
|
2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <xmlengdom.h> |
|
21 #include "hnmdqueries.h" |
|
22 #include "hnmdquery.h" |
|
23 #include "hnglobals.h" |
|
24 #include "hnmdmodel.h" |
|
25 #include "hnconvutils.h" |
|
26 |
|
27 // ======== MEMBER FUNCTIONS ======== |
|
28 |
|
29 // --------------------------------------------------------------------------- |
|
30 // |
|
31 // --------------------------------------------------------------------------- |
|
32 // |
|
33 void CHnMdQueries::ConstructL( TXmlEngElement aElement ) |
|
34 { |
|
35 // construction... |
|
36 RXmlEngNodeList< TXmlEngElement > entries; |
|
37 CleanupClosePushL( entries ); |
|
38 aElement.GetChildElements( entries ); |
|
39 |
|
40 TInt entriesAmount = entries.Count(); |
|
41 |
|
42 for (TInt j = 0; j < entriesAmount; j++ ) |
|
43 { |
|
44 TXmlEngElement item = entries.Next(); |
|
45 |
|
46 if ( !item.Name().Compare( KQueryElementItem8 ) ) |
|
47 { |
|
48 CHnMdQuery *query = CHnMdQuery::NewL( item ); |
|
49 AddQuery( query ); |
|
50 } |
|
51 } |
|
52 CleanupStack::PopAndDestroy( &entries ); |
|
53 } |
|
54 |
|
55 // --------------------------------------------------------------------------- |
|
56 // |
|
57 // --------------------------------------------------------------------------- |
|
58 // |
|
59 TInt CHnMdQueries::AddQuery( CHnMdQuery* aQuery ) |
|
60 { |
|
61 return iQueries.Append( aQuery ); |
|
62 } |
|
63 |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 // --------------------------------------------------------------------------- |
|
67 // |
|
68 CHnMdQuery& CHnMdQueries::Query( TInt aPosition ) const |
|
69 { |
|
70 ASSERT( aPosition >=0 && aPosition < iQueries.Count() ); |
|
71 return *iQueries[aPosition]; |
|
72 } |
|
73 |
|
74 // --------------------------------------------------------------------------- |
|
75 // |
|
76 // --------------------------------------------------------------------------- |
|
77 // |
|
78 TInt CHnMdQueries::Count() const |
|
79 { |
|
80 return iQueries.Count(); |
|
81 } |
|
82 |
|
83 // --------------------------------------------------------------------------- |
|
84 // |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 CHnMdQueries* CHnMdQueries::NewL( TXmlEngElement aElement ) |
|
88 { |
|
89 CHnMdQueries* self = CHnMdQueries::NewLC( aElement ); |
|
90 CleanupStack::Pop( self ); |
|
91 return self; |
|
92 } |
|
93 |
|
94 // --------------------------------------------------------------------------- |
|
95 // |
|
96 // --------------------------------------------------------------------------- |
|
97 // |
|
98 CHnMdQueries* CHnMdQueries::NewLC( TXmlEngElement aElement ) |
|
99 { |
|
100 CHnMdQueries* self = new( ELeave ) CHnMdQueries(); |
|
101 CleanupStack::PushL( self ); |
|
102 self->ConstructL( aElement ); |
|
103 return self; |
|
104 } |
|
105 |
|
106 // --------------------------------------------------------------------------- |
|
107 // |
|
108 // --------------------------------------------------------------------------- |
|
109 // |
|
110 CHnMdQueries::CHnMdQueries() |
|
111 { |
|
112 } |
|
113 |
|
114 // --------------------------------------------------------------------------- |
|
115 // |
|
116 // --------------------------------------------------------------------------- |
|
117 // |
|
118 CHnMdQueries::~CHnMdQueries() |
|
119 { |
|
120 iQueries.ResetAndDestroy(); |
|
121 } |
|
122 |
|
123 |
|
124 |