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