webservices/wsxml/src/senbaseelement.cpp
branchRCL_3
changeset 37 1adb97a15c2f
parent 36 c5fabff9b552
equal deleted inserted replaced
36:c5fabff9b552 37:1adb97a15c2f
   267         {
   267         {
   268         // we have a real attribute!
   268         // we have a real attribute!
   269         CSenBaseAttribute* pAttribute = CSenBaseAttribute::NewL(aQName,
   269         CSenBaseAttribute* pAttribute = CSenBaseAttribute::NewL(aQName,
   270                                                                 aLocalName,
   270                                                                 aLocalName,
   271                                                                 aValue);
   271                                                                 aValue);
       
   272         CleanupStack::PushL(pAttribute);
   272         AddAttributeL(pAttribute);
   273         AddAttributeL(pAttribute);
       
   274         CleanupStack::Pop(pAttribute);
   273         }
   275         }
   274     return aValue;
   276     return aValue;
   275     }
   277     }
   276 
   278 
   277 
   279 
   485                                         const TDesC8& aValue)
   487                                         const TDesC8& aValue)
   486     {
   488     {
   487     CSenBaseAttribute* pAttr = FindAttr(aName);
   489     CSenBaseAttribute* pAttr = FindAttr(aName);
   488     if (pAttr == NULL)
   490     if (pAttr == NULL)
   489         {
   491         {
   490         User::LeaveIfError(iAttrs.Append(CSenBaseAttribute::NewL(aName,
   492         //Create new baseAttribute object
   491                                                                  aValue)));
   493         CSenBaseAttribute* newBaseAttribute = CSenBaseAttribute::NewL(aName, aValue);
       
   494         //Push to cleanupstack 
       
   495         CleanupStack::PushL(newBaseAttribute);
       
   496         
       
   497         //Add the new baseAttribute to existing Attribute list
       
   498         User::LeaveIfError(iAttrs.Append(newBaseAttribute));
       
   499         
       
   500         //Pop from CleanupStack
       
   501         CleanupStack::Pop(newBaseAttribute);
   492         }
   502         }
   493     else
   503     else
   494         {
   504         {
   495         pAttr->SetValueL(aValue);
   505         pAttr->SetValueL(aValue);
   496         }
   506         }
   630     }
   640     }
   631 
   641 
   632 EXPORT_C CSenElement& CSenBaseElement::AddElementL(const TDesC8& aNsUri,
   642 EXPORT_C CSenElement& CSenBaseElement::AddElementL(const TDesC8& aNsUri,
   633                                                    const TDesC8& aLocalName)
   643                                                    const TDesC8& aLocalName)
   634     {
   644     {
   635     return AddElementL(*CSenBaseElement::NewL(aNsUri, aLocalName));
   645     //Create new baseElement
       
   646     CSenBaseElement *newBaseElement = CSenBaseElement::NewL(aNsUri, aLocalName);
       
   647     //Push it to CleanupStack
       
   648     CleanupStack::PushL(newBaseElement);
       
   649     
       
   650     //Add the baseElement
       
   651     CSenElement& newAddedElement  = AddElementL(*newBaseElement);
       
   652     
       
   653     //Pop baseElement from CleanupStack
       
   654     CleanupStack::Pop(newBaseElement);
       
   655     
       
   656     //Return the newly added element (got from the AddElement() API)
       
   657     return newAddedElement;
   636     }
   658     }
   637 
   659 
   638 EXPORT_C CSenElement& CSenBaseElement::AddElementL(
   660 EXPORT_C CSenElement& CSenBaseElement::AddElementL(
   639     const TDesC8& aNsUri,
   661     const TDesC8& aNsUri,
   640     const TDesC8& aLocalName,
   662     const TDesC8& aLocalName,
   641     const TDesC8& aQName
   663     const TDesC8& aQName
   642     )
   664     )
   643     {
   665     {
   644     return AddElementL(*CSenBaseElement::NewL(aNsUri, aLocalName, aQName));
   666     //Create new baseElement
       
   667     CSenBaseElement *newBaseElement = CSenBaseElement::NewL(aNsUri, aLocalName, aQName);
       
   668     //Push it to CleanupStack
       
   669     CleanupStack::PushL(newBaseElement);
       
   670 
       
   671     //Add the baseElement
       
   672     CSenElement& newAddedElement  =  AddElementL(*newBaseElement);
       
   673     
       
   674     //Pop baseElement from CleanupStack
       
   675     CleanupStack::Pop(newBaseElement);
       
   676         
       
   677     //Return the newly added element (got from the AddElement() API)
       
   678     return newAddedElement;
   645     }
   679     }
   646 
   680 
   647 EXPORT_C CSenElement& CSenBaseElement::AddElementL(const TDesC8& aLocalName)
   681 EXPORT_C CSenElement& CSenBaseElement::AddElementL(const TDesC8& aLocalName)
   648     {
   682     {
   649     return AddElementL(*CSenBaseElement::NewL(aLocalName));
   683     //Create new baseElement
       
   684     CSenBaseElement *newBaseElement = CSenBaseElement::NewL(aLocalName);
       
   685     //Push it to CleanupStack
       
   686     CleanupStack::PushL(newBaseElement);
       
   687     
       
   688     //Add the baseElement
       
   689     CSenElement& newAddedElement  =  AddElementL(*newBaseElement);
       
   690     
       
   691     //Pop baseElement from CleanupStack
       
   692     CleanupStack::Pop(newBaseElement);
       
   693        
       
   694     //Return the newly added element (got from the AddElement() API)
       
   695     return newAddedElement;
   650     }
   696     }
   651 
   697 
   652 EXPORT_C CSenElement* CSenBaseElement::RemoveElement(CSenElement& aElement)
   698 EXPORT_C CSenElement* CSenBaseElement::RemoveElement(CSenElement& aElement)
   653     {
   699     {
   654     TInt idx = iElements.Find(&aElement);
   700     TInt idx = iElements.Find(&aElement);