78 // Appends a new entry to a CObjectDataArray. |
78 // Appends a new entry to a CObjectDataArray. |
79 // --------------------------------------------------------------------------- |
79 // --------------------------------------------------------------------------- |
80 // |
80 // |
81 void CObjectDataArray::Append( CMdEObject* aMdeObject, CLocationData* aLocationData, CMdEQuery* aQuery ) |
81 void CObjectDataArray::Append( CMdEObject* aMdeObject, CLocationData* aLocationData, CMdEQuery* aQuery ) |
82 { |
82 { |
83 TInt mdeObjectIndex(KErrNone); |
83 iMdeObjectArray.Append( aMdeObject ); |
84 TInt locationDataIndex(KErrNone); |
84 iLocationArray.Append( aLocationData ); |
85 |
85 iQueryArray.Append( aQuery ); |
86 mdeObjectIndex = iMdeObjectArray.Append( aMdeObject ); |
|
87 |
|
88 if( mdeObjectIndex != KErrNone ) |
|
89 { |
|
90 delete aMdeObject; |
|
91 aMdeObject = NULL; |
|
92 |
|
93 delete aLocationData; |
|
94 aLocationData = NULL; |
|
95 |
|
96 delete aQuery; |
|
97 aQuery = NULL; |
|
98 } |
|
99 else |
|
100 { |
|
101 locationDataIndex = iLocationArray.Append( aLocationData ); |
|
102 |
|
103 if( locationDataIndex != KErrNone ) |
|
104 { |
|
105 iMdeObjectArray.Remove( mdeObjectIndex ); |
|
106 delete aMdeObject; |
|
107 aMdeObject = NULL; |
|
108 |
|
109 delete aLocationData; |
|
110 aLocationData = NULL; |
|
111 |
|
112 delete aQuery; |
|
113 aQuery = NULL; |
|
114 } |
|
115 else |
|
116 { |
|
117 if( iQueryArray.Append( aQuery ) != KErrNone ) |
|
118 { |
|
119 iMdeObjectArray.Remove( mdeObjectIndex ); |
|
120 delete aMdeObject; |
|
121 aMdeObject = NULL; |
|
122 |
|
123 iLocationArray.Remove( locationDataIndex ); |
|
124 delete aLocationData; |
|
125 aLocationData = NULL; |
|
126 |
|
127 delete aQuery; |
|
128 aQuery = NULL; |
|
129 } |
|
130 } |
|
131 } |
|
132 } |
86 } |
133 |
87 |
134 // --------------------------------------------------------------------------- |
88 // --------------------------------------------------------------------------- |
135 // Removes an entry from the array. |
89 // Removes an entry from the array. |
136 // --------------------------------------------------------------------------- |
90 // --------------------------------------------------------------------------- |
140 if ( aIndex < 0 || aIndex >= iMdeObjectArray.Count() ) |
94 if ( aIndex < 0 || aIndex >= iMdeObjectArray.Count() ) |
141 { |
95 { |
142 return; |
96 return; |
143 } |
97 } |
144 delete iMdeObjectArray[aIndex]; |
98 delete iMdeObjectArray[aIndex]; |
145 iMdeObjectArray[aIndex] = NULL; |
|
146 |
|
147 delete iLocationArray[aIndex]; |
99 delete iLocationArray[aIndex]; |
148 iLocationArray[aIndex] = NULL; |
|
149 |
|
150 delete iQueryArray[aIndex]; |
100 delete iQueryArray[aIndex]; |
151 iQueryArray[aIndex] = NULL; |
|
152 |
|
153 iMdeObjectArray.Remove( aIndex ); |
101 iMdeObjectArray.Remove( aIndex ); |
154 iLocationArray.Remove( aIndex ); |
102 iLocationArray.Remove( aIndex ); |
155 iQueryArray.Remove( aIndex ); |
103 iQueryArray.Remove( aIndex ); |
156 |
104 |
157 if( iMdeObjectArray.Count() == 0 ) |
105 if( iMdeObjectArray.Count() == 0 ) |