You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ha...@apache.org on 2005/02/22 17:51:03 UTC

cvs commit: ws-axis/c/src/soap HeaderBlock.cpp Attribute.cpp

hawkeye     2005/02/22 08:51:02

  Modified:    c/src/soap HeaderBlock.cpp Attribute.cpp
  Log:
  Streamlined Attribute and improved checking mechanism. Updated HeaderBlock so it does some checking when creating attribute in three parm method
  and removed duplicate code.
  
  Revision  Changes    Path
  1.51      +19 -27    ws-axis/c/src/soap/HeaderBlock.cpp
  
  Index: HeaderBlock.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/HeaderBlock.cpp,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- HeaderBlock.cpp	22 Feb 2005 14:31:15 -0000	1.50
  +++ HeaderBlock.cpp	22 Feb 2005 16:51:02 -0000	1.51
  @@ -568,27 +568,7 @@
                                           const AxisChar *prefix,
                                           const AxisChar *value)
   {
  -    Attribute* pAttribute = NULL;
  -
  -    if (localname)
  -    {
  -        //Attribute* pAttribute = new Attribute(localname, prefix, value); 
  -        pAttribute = new Attribute(localname, prefix, value); // Samisa - possible bug in line above 
  -        
  -       
  -        list<Attribute*>::iterator itCurrAttribute= m_attributes.begin();
  -        while(itCurrAttribute != m_attributes.end())
  -        {        
  -            if ((strcmp((*itCurrAttribute)->getLocalName(), localname) ==0) && (strcmp((*itCurrAttribute)->getPrefix(), prefix) ==0))
  -                return NULL;                 
  -            else
  -                itCurrAttribute++;        
  -        }    
  -        
  -        m_attributes.push_back(pAttribute);
  -    }
  -
  -    return pAttribute;
  +    return createAttribute(localname, prefix, NULL, value);
   }
   
   IAttribute* HeaderBlock::createAttribute(const AxisChar *localname,
  @@ -597,12 +577,24 @@
                                           const AxisChar *value)
   {
   	Attribute* pAttribute=NULL;
  -	if(localname)
  -	{
  -	    pAttribute = new Attribute(localname, prefix, uri, value);
  -	    m_attributes.push_back(pAttribute);
  -	}
  -
  +  if(!localname)
  +   {
  +      localname="";
  +   }
  +   
  +    pAttribute = new Attribute(localname, prefix, uri, value);
  +//	    m_attributes.push_back(pAttribute);
  +	
  +       list<Attribute*>::iterator itCurrAttribute= m_attributes.begin();
  +       while(itCurrAttribute != m_attributes.end())
  +       {        
  +         if ((strcmp((*itCurrAttribute)->getLocalName(), localname) ==0) && (strcmp((*itCurrAttribute)->getPrefix(), prefix) ==0))
  +                return NULL;                 
  +            else
  +                itCurrAttribute++;        
  +        }    
  +        
  +        m_attributes.push_back(pAttribute);
       return pAttribute;
   }
   
  
  
  
  1.32      +10 -11    ws-axis/c/src/soap/Attribute.cpp
  
  Index: Attribute.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/Attribute.cpp,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- Attribute.cpp	11 Feb 2005 18:45:33 -0000	1.31
  +++ Attribute.cpp	22 Feb 2005 16:51:02 -0000	1.32
  @@ -56,7 +56,7 @@
   {
   	if(NULL==localname)
   	{
  -		return AXIS_FAIL;
  +        localname="";
   	}
       m_localname= localname;
       return AXIS_SUCCESS;
  @@ -66,7 +66,7 @@
   {
   	if(NULL==prefix)
   	{
  -		return AXIS_FAIL;
  +        prefix="";
   	}
   	
       m_prefix= prefix;
  @@ -77,7 +77,7 @@
   {
   	if(NULL==uri)
   	{
  -		return AXIS_FAIL;
  +        uri="";
   	}
       m_uri= uri;
       return AXIS_SUCCESS;
  @@ -87,7 +87,7 @@
   {
   	if(NULL==value)
   	{
  -		return AXIS_FAIL;
  +        value="";
   	}
       m_value= value;
       return AXIS_SUCCESS;
  @@ -126,6 +126,12 @@
       m_value= value;
   }
   
  +Attribute::Attribute(const AxisChar *localname, const AxisChar *prefix, 
  +                     const AxisChar *value)
  +{
  +    Attribute(localname, prefix, "", value);
  +}
  +
   Attribute::Attribute(const Attribute& rCopy)
   {
       //in case sting is changed to char* use new[] and strcpy here
  @@ -234,12 +240,5 @@
   }
   #endif
   
  -Attribute::Attribute(const AxisChar *localname, const AxisChar *prefix, 
  -                     const AxisChar *value)
  -{
  -    m_localname= localname;
  -    m_prefix= prefix;
  -    m_value= value;
  -}
   
   AXIS_CPP_NAMESPACE_END