You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@locus.apache.org on 2000/04/19 18:31:40 UTC

cvs commit: xml-xalan/c/src/PlatformSupport AttributeListImpl.cpp AttributeListImpl.hpp

dbertoni    00/04/19 09:31:40

  Modified:    c/src/PlatformSupport AttributeListImpl.cpp
                        AttributeListImpl.hpp
  Log:
  Fixed bug where existing attributes were not updated.
  
  Revision  Changes    Path
  1.5       +15 -3     xml-xalan/c/src/PlatformSupport/AttributeListImpl.cpp
  
  Index: AttributeListImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/AttributeListImpl.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AttributeListImpl.cpp	2000/04/11 14:35:29	1.4
  +++ AttributeListImpl.cpp	2000/04/19 16:31:39	1.5
  @@ -138,7 +138,7 @@
   		{
   			assert(theRHS.m_AttributeVector[i] != 0);
   
  -			const AttributeVectorEntry* const	theEntry =
  +			AttributeVectorEntry* const	theEntry =
   				new AttributeVectorEntry(*theRHS.m_AttributeVector[i]);
   
   			// Add the item...
  @@ -342,8 +342,20 @@
   
   	bool	fResult = false;
   
  -	// Don't add it if it's already there.
  -	if (m_AttributeKeyMap.find(name) == m_AttributeKeyMap.end())
  +	// Update the attribute, if it's already there
  +	const AttributeKeyMapType::iterator		i =
  +		m_AttributeKeyMap.find(name);
  +
  +	if (i != m_AttributeKeyMap.end())
  +	{
  +		// Create the new vectors, then swap them...
  +		XMLChVectorType		theNewType(type, endArray(type) + 1);
  +		XMLChVectorType		theNewValue(value, endArray(value) + 1);
  +
  +		theNewType.swap(i->second->m_Type);
  +		theNewValue.swap(i->second->m_Value); 
  +	}
  +	else
   	{
   		AttributeVectorEntry*	const	theEntry =
   						new AttributeVectorEntry(XMLChVectorType(name, endArray(name) + 1),
  
  
  
  1.5       +5 -5      xml-xalan/c/src/PlatformSupport/AttributeListImpl.hpp
  
  Index: AttributeListImpl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/AttributeListImpl.hpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AttributeListImpl.hpp	2000/04/11 14:35:29	1.4
  +++ AttributeListImpl.hpp	2000/04/19 16:31:39	1.5
  @@ -174,8 +174,8 @@
   		}
   
   		const XMLChVectorType	m_Name;
  -		const XMLChVectorType	m_Value;
  -		const XMLChVectorType	m_Type;
  +		XMLChVectorType			m_Value;
  +		XMLChVectorType			m_Type;
   	};
   
   #if defined(XALAN_NO_NAMESPACES)
  @@ -185,8 +185,8 @@
   	// This map will associate a name with a pointer to the entry that corresponds
   	// to that name.
   	typedef map<const XMLCh*,
  -					 const AttributeVectorEntry*,
  -					 less_null_terminated_arrays<XMLCh> >	AttributeKeyMapType;
  +				AttributeVectorEntry*,
  +				less_null_terminated_arrays<XMLCh> >	AttributeKeyMapType;
   #else
   	// This vector will hold the entries.
   	typedef std::vector<const AttributeVectorEntry*>		AttributeVectorType;
  @@ -194,7 +194,7 @@
   	// This map will associate a name with a pointer to the entry that corresponds
   	// to that name.
   	typedef std::map<const XMLCh*,
  -					 const AttributeVectorEntry*,
  +					 AttributeVectorEntry*,
   					 less_null_terminated_arrays<XMLCh> >	AttributeKeyMapType;
   #endif