simpleengine/xmlutils/src/simpleelement.cpp
branchRCL_3
changeset 35 fbd2e7cec7ef
parent 34 2669f8761a99
equal deleted inserted replaced
34:2669f8761a99 35:fbd2e7cec7ef
   219 // ----------------------------------------------------------
   219 // ----------------------------------------------------------
   220 //
   220 //
   221 TInt CSimpleElement::SimpleElementsL( 
   221 TInt CSimpleElement::SimpleElementsL( 
   222     RPointerArray<MSimpleElement>& aElementArray )
   222     RPointerArray<MSimpleElement>& aElementArray )
   223     {
   223     {
       
   224     CleanupClosePushL( aElementArray );
   224     // Reset the output array first.
   225     // Reset the output array first.
   225     aElementArray.Reset();
   226     aElementArray.Reset();
   226     iElements.ResetAndDestroy();
   227     iElements.ResetAndDestroy();
   227 
   228 
   228     // Go through CSenElements and convert them one by one and 
   229     // Go through CSenElements and convert them one by one and 
   232     for ( TInt i = 0; i < elemCount; i++ )
   233     for ( TInt i = 0; i < elemCount; i++ )
   233         {
   234         {
   234         CSenElement* pElement = elems[i];
   235         CSenElement* pElement = elems[i];
   235         CSimpleElement* simple = CSimpleElement::NewL( pElement, EFalse );
   236         CSimpleElement* simple = CSimpleElement::NewL( pElement, EFalse );
   236         CleanupStack::PushL( simple );
   237         CleanupStack::PushL( simple );
   237         User::LeaveIfError( aElementArray.Append( simple ));
   238         iElements.AppendL( simple );
   238         CleanupStack::Pop( simple );
   239         CleanupStack::Pop( simple );
   239         User::LeaveIfError( iElements.Append( simple ) );
   240         aElementArray.AppendL( simple );
   240         }
   241         }
       
   242     CleanupStack::Pop( &aElementArray ); 
       
   243     
   241     return elemCount ? KErrNone : KErrNotFound;
   244     return elemCount ? KErrNone : KErrNotFound;
   242     }
   245     }
   243 
   246 
   244 // ----------------------------------------------------------
   247 // ----------------------------------------------------------
   245 // CSimpleElement::AttrValueLC
   248 // CSimpleElement::AttrValueLC
   290 // CSimpleElement::SimpleAttributesL
   293 // CSimpleElement::SimpleAttributesL
   291 // ----------------------------------------------------------
   294 // ----------------------------------------------------------
   292 //
   295 //
   293 TInt CSimpleElement::SimpleAttributesL( RPointerArray<MSimpleAttribute>& aArray )
   296 TInt CSimpleElement::SimpleAttributesL( RPointerArray<MSimpleAttribute>& aArray )
   294     {  
   297     {  
       
   298     CleanupClosePushL( aArray );
       
   299     
   295     // Reset the output array first.
   300     // Reset the output array first.
   296     aArray.Reset();
   301     aArray.Reset();
   297     iAttributes.ResetAndDestroy();
   302     iAttributes.ResetAndDestroy();
   298 
   303 
   299     // Go through CSenAttributes and convert them one by one and add to the output array.
   304     // Go through CSenAttributes and convert them one by one and add to the output array.
   302     for ( TInt i = 0; i < elemCount; i++ )
   307     for ( TInt i = 0; i < elemCount; i++ )
   303         {
   308         {
   304         CSenBaseAttribute* pAttr = elems[i];
   309         CSenBaseAttribute* pAttr = elems[i];
   305         CSimpleAttribute* attr = CSimpleAttribute::NewL( pAttr );
   310         CSimpleAttribute* attr = CSimpleAttribute::NewL( pAttr );
   306         CleanupStack::PushL( attr );
   311         CleanupStack::PushL( attr );
   307         User::LeaveIfError(iAttributes.Append( attr ));
   312         iAttributes.AppendL( attr );
   308         CleanupStack::Pop( attr );        
   313         CleanupStack::Pop( attr );        
   309         User::LeaveIfError(aArray.Append( attr ));
   314         aArray.AppendL( attr );
   310         }
   315         }
       
   316     CleanupStack::Pop( &aArray );
       
   317     
   311     return elemCount ? KErrNone : KErrNotFound;
   318     return elemCount ? KErrNone : KErrNotFound;
   312     }
   319     }
   313 
   320 
   314 // ----------------------------------------------------------
   321 // ----------------------------------------------------------
   315 // CSimpleElement::SimpleParentL
   322 // CSimpleElement::SimpleParentL