487 const TDesC8& aValue) |
485 const TDesC8& aValue) |
488 { |
486 { |
489 CSenBaseAttribute* pAttr = FindAttr(aName); |
487 CSenBaseAttribute* pAttr = FindAttr(aName); |
490 if (pAttr == NULL) |
488 if (pAttr == NULL) |
491 { |
489 { |
492 //Create new baseAttribute object |
490 User::LeaveIfError(iAttrs.Append(CSenBaseAttribute::NewL(aName, |
493 CSenBaseAttribute* newBaseAttribute = CSenBaseAttribute::NewL(aName, aValue); |
491 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); |
|
502 } |
492 } |
503 else |
493 else |
504 { |
494 { |
505 pAttr->SetValueL(aValue); |
495 pAttr->SetValueL(aValue); |
506 } |
496 } |
640 } |
630 } |
641 |
631 |
642 EXPORT_C CSenElement& CSenBaseElement::AddElementL(const TDesC8& aNsUri, |
632 EXPORT_C CSenElement& CSenBaseElement::AddElementL(const TDesC8& aNsUri, |
643 const TDesC8& aLocalName) |
633 const TDesC8& aLocalName) |
644 { |
634 { |
645 //Create new baseElement |
635 return AddElementL(*CSenBaseElement::NewL(aNsUri, aLocalName)); |
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; |
|
658 } |
636 } |
659 |
637 |
660 EXPORT_C CSenElement& CSenBaseElement::AddElementL( |
638 EXPORT_C CSenElement& CSenBaseElement::AddElementL( |
661 const TDesC8& aNsUri, |
639 const TDesC8& aNsUri, |
662 const TDesC8& aLocalName, |
640 const TDesC8& aLocalName, |
663 const TDesC8& aQName |
641 const TDesC8& aQName |
664 ) |
642 ) |
665 { |
643 { |
666 //Create new baseElement |
644 return AddElementL(*CSenBaseElement::NewL(aNsUri, aLocalName, aQName)); |
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; |
|
679 } |
645 } |
680 |
646 |
681 EXPORT_C CSenElement& CSenBaseElement::AddElementL(const TDesC8& aLocalName) |
647 EXPORT_C CSenElement& CSenBaseElement::AddElementL(const TDesC8& aLocalName) |
682 { |
648 { |
683 //Create new baseElement |
649 return AddElementL(*CSenBaseElement::NewL(aLocalName)); |
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; |
|
696 } |
650 } |
697 |
651 |
698 EXPORT_C CSenElement* CSenBaseElement::RemoveElement(CSenElement& aElement) |
652 EXPORT_C CSenElement* CSenBaseElement::RemoveElement(CSenElement& aElement) |
699 { |
653 { |
700 TInt idx = iElements.Find(&aElement); |
654 TInt idx = iElements.Find(&aElement); |