axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Samisa Abeysinghe <samisa_abeysin...@yahoo.com>
Subject RE: Attribute setx()
Date Wed, 04 Aug 2004 08:37:29 GMT
Oh yes! That solves the problem.

However this brings to light a different problem. Namely 'consistancy'.
Why are we using two different types in two classes?
As I can see, in Attribute.cpp, not many STL string operations are used. Hence cahr* could
have
been used without problem.

Any ideas why we have two different data types in these two classes?

Thanks,
Samisa...

--- Roshan Weerasuriya <roshan@opensource.lk> wrote:

> hi,
> 
> I think we don't need to do this, hense all the memeber attributes
> (m_localname, m_prefix, etc) specified here are of the type AxisString
> (which is a stl string) and it allocates new memory for the values. 
> 
> Roshan
> 
> On Wed, 2004-08-04 at 08:07, Samisa Abeysinghe wrote:
> > Interesting observation!
> > 
> > I too think Attribute should be doing a deep copy like the BasicNode
> > does.
> > This will reduce the coupling between Attribute class and those classes
> > that use instances of Attribute.
> > 
> > BTW: rather than using 'malloc + strcpy' one could use strdup (just one
> > call).
> > 
> > Thanks,
> > Samisa...
> > 
> > 
> > 
> > -----Original Message-----
> > From: John Hawkins [mailto:HAWKINSJ@uk.ibm.com] 
> > Sent: Tuesday, August 03, 2004 10:11 PM
> > To: axis-c-dev@ws.apache.org
> > Subject: Attribute setx()
> > 
> > 
> > 
> > 
> > 
> > Hi Folks,
> > 
> > the set methods on Attribute all simply use the pointer given to them -
> > they do not copy the data e.g.
> > 
> > 
> > void Attribute::setLocalName(const AxisChar* localname)
> > {
> >     m_localname= localname;
> > }
> > 
> > void Attribute::setPrefix(const AxisChar* prefix)
> > {
> >     m_prefix= prefix;
> > }
> > 
> > void Attribute::setUri(const AxisChar* uri)
> > {
> >     m_uri= uri;
> > }
> > 
> > void Attribute::setValue(const AxisChar* value)
> > {
> >     m_value= value;
> > }
> > 
> > The set methods on BasicNodes do copy the data. e.g.
> > 
> > int CharacterElement::setValue(const AxisChar* pachValue)
> > {
> >     m_pachValue = (AxisChar*) malloc(strlen(pachValue)+1);
> >     strcpy(m_pachValue, pachValue);
> > 
> >     return AXIS_SUCCESS;
> > }
> > 
> > Is there any reason why they are different?
> > 
> > I would assume that we would like the Basicnode style of copying the
> > data
> > then the user can be happy in the knowledge that the memory clean up is
> > given to them "for free"?
> > 
> > 
> > 
> > 
> > John Hawkins
> > 
> > 
> > 
> >
>
--------------------------------------------------------------------------------------------------
> > This message, including any attachments, contains confidential information intended
for a
> specific individual and purpose, and is intended for the addressee only.  Any unauthorized
> disclosure, use, dissemination, copying, or distribution of this message or any of its
> attachments or the information contained in this e-mail, or the taking of any action
based on
> it, is strictly prohibited.  If you are not the intended recipient, please notify the
sender
> immediately by return e-mail and delete this message. 
> > 
> 
> 



		
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

Mime
View raw message