ws-axis-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From di...@apache.org
Subject cvs commit: ws-axis/c/src/soap/xsd/constraints IConstrainingFacet.hpp Pattern.cpp Pattern.hpp WhiteSpace.cpp WhiteSpace.hpp
Date Thu, 20 Jan 2005 09:51:28 GMT
dicka       2005/01/20 01:51:27

  Modified:    c/build  buildClient.xml buildServerEngine.xml
               c/src/soap Makefile.am
               c/src/soap/xsd AnyURI.cpp AnyURI.hpp Base64Binary.cpp
                        Boolean.cpp Boolean.hpp Date.cpp Date.hpp
                        DateTime.cpp DateTime.hpp Decimal.cpp Decimal.hpp
                        Double.cpp Double.hpp Duration.cpp Duration.hpp
                        Float.cpp Float.hpp HexBinary.cpp
                        IAnySimpleType.cpp IAnySimpleType.hpp Integer.cpp
                        NOTATION.cpp NOTATION.hpp String.cpp String.hpp
                        Time.cpp Time.hpp XSD_QName.cpp XSD_QName.hpp
               c/vc     AxisClientDLL.dsp AxisServerDLL.dsp
                        Distribution.dsw
  Added:       c/src/soap/xsd/constraints IConstrainingFacet.hpp
                        Pattern.cpp Pattern.hpp WhiteSpace.cpp
                        WhiteSpace.hpp
  Log:
  Initial work on adding constraint validation/processing to XSD SOAP objects.
  
  Submitted by: Adrian Dick
  
  Revision  Changes    Path
  1.6       +2 -0      ws-axis/c/build/buildClient.xml
  
  Index: buildClient.xml
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/build/buildClient.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- buildClient.xml	11 Jan 2005 09:53:18 -0000	1.5
  +++ buildClient.xml	20 Jan 2005 09:51:23 -0000	1.6
  @@ -45,6 +45,7 @@
   						<include name="soap/*.cpp"/>
   						<include name="soap/*.c"/>
   						<include name="soap/xsd/*.cpp"/>
  +						<include name="soap/xsd/constraints/*.cpp"/>
   						<include name="wsdd/*.cpp"/>
   						<include name="xml/*.cpp"/>
   						<include name="transport/axis/AxisTransportException.cpp"/>
  @@ -78,6 +79,7 @@
   						<include name="soap/*.cpp"/>
   						<include name="soap/*.c"/>
   						<include name="soap/xsd/*.cpp"/>
  +						<include name="soap/xsd/constraints/*.cpp"/>
   						<include name="wsdd/*.cpp"/>
   						<include name="xml/*.cpp"/>
   						<include name="transport/axis/AxisTransportException.cpp"/>
  
  
  
  1.4       +2 -0      ws-axis/c/build/buildServerEngine.xml
  
  Index: buildServerEngine.xml
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/build/buildServerEngine.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- buildServerEngine.xml	11 Jan 2005 09:53:18 -0000	1.3
  +++ buildServerEngine.xml	20 Jan 2005 09:51:23 -0000	1.4
  @@ -38,6 +38,7 @@
   						<include name="engine/server/*.cpp"/>
   						<include name="soap/*.cpp"/>
   						<include name="soap/xsd/*.cpp"/>
  +						<include name="soap/xsd/constraints/*.cpp"/>
   						<include name="soap/*.c"/>
   						<include name="wsdd/*.cpp"/>
   						<include name="xml/*.cpp"/>
  @@ -70,6 +71,7 @@
   						<include name="soap/*.cpp"/>
   						<include name="soap/*.c"/>
   						<include name="soap/xsd/*.cpp"/>
  +						<include name="soap/xsd/constraints/*.cpp"/>
   						<include name="wsdd/*.cpp"/>
   						<include name="xml/*.cpp"/>
   						<include name="transport/axis/AxisTransportException.cpp"/>
  
  
  
  1.16      +3 -1      ws-axis/c/src/soap/Makefile.am
  
  Index: Makefile.am
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/Makefile.am,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- Makefile.am	18 Jan 2005 04:13:03 -0000	1.15
  +++ Makefile.am	20 Jan 2005 09:51:23 -0000	1.16
  @@ -38,7 +38,9 @@
           xsd/NOTATION.cpp \
           xsd/String.cpp \
           xsd/Time.cpp \
  -        xsd/XSD_QName.cpp
  +        xsd/XSD_QName.cpp \
  +        xsd/constraints/WhiteSpace.cpp \
  +        xsd/constraints/Pattern.cpp
   
   libsoap_la_LIBADD = $(LDFLAGS)
   INCLUDES = -I../../include
  
  
  
  1.3       +6 -7      ws-axis/c/src/soap/xsd/AnyURI.cpp
  
  Index: AnyURI.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/AnyURI.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AnyURI.cpp	19 Jan 2005 15:22:33 -0000	1.2
  +++ AnyURI.cpp	20 Jan 2005 09:51:23 -0000	1.3
  @@ -21,13 +21,7 @@
   		AxisString valueAsString = value;
   		AxisChar* serializedValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
   		
  -        if (m_Buf)
  -        {
  -            delete [] m_Buf;
  -            m_Buf = NULL;
  -        }
  -		m_Buf = new char[strlen (serializedValue) + 1];
  -		strcpy (m_Buf, serializedValue);
  +        IAnySimpleType::serialize(serializedValue);
           delete [] serializedValue;
   		return m_Buf;
       }
  @@ -42,6 +36,11 @@
   		m_AnyURI = new char[strlen (valueAsChar) + 1];
   		strcpy (m_AnyURI, valueAsChar);
   		return m_AnyURI;
  +    }
  +
  +    WhiteSpace* AnyURI::getWhiteSpace()
  +    {
  +        return new WhiteSpace(REPLACE);
       }
   
   AXIS_CPP_NAMESPACE_END
  
  
  
  1.3       +8 -0      ws-axis/c/src/soap/xsd/AnyURI.hpp
  
  Index: AnyURI.hpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/AnyURI.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AnyURI.hpp	19 Jan 2005 15:22:33 -0000	1.2
  +++ AnyURI.hpp	20 Jan 2005 09:51:23 -0000	1.3
  @@ -63,6 +63,14 @@
   	 * @return Deserialized AnyURI value.
   	 */
       AxisChar* deserializeAnyURI(const AxisChar* valueAsChar) throw (AxisSoapException);
  +
  +protected:
  +
  +    /**
  +     * Creates a WhiteSpace object to replace whitespace
  +     * @return WhiteSpace object set to replace whitespace
  +     */
  +    WhiteSpace* getWhiteSpace();
       
   private:
       AxisChar* m_AnyURI;
  
  
  
  1.5       +1 -7      ws-axis/c/src/soap/xsd/Base64Binary.cpp
  
  Index: Base64Binary.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/Base64Binary.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Base64Binary.cpp	20 Jan 2005 04:18:59 -0000	1.4
  +++ Base64Binary.cpp	20 Jan 2005 09:51:23 -0000	1.5
  @@ -32,13 +32,7 @@
   	    len = apr_base64_encode_binary (serializedValue, value->__ptr, value->__size);
   	    serializedValue[len] = 0;
   	    	    
  -        if (m_Buf)
  -        {
  -            delete [] m_Buf;
  -            m_Buf = NULL;
  -        }
  -	    m_Buf = new char[strlen (serializedValue) + 1];
  -		strcpy (m_Buf, serializedValue);
  +        IAnySimpleType::serialize(serializedValue);
           delete [] serializedValue;        
   		return m_Buf;
       }
  
  
  
  1.3       +6 -7      ws-axis/c/src/soap/xsd/Boolean.cpp
  
  Index: Boolean.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/Boolean.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Boolean.cpp	19 Jan 2005 15:22:33 -0000	1.2
  +++ Boolean.cpp	20 Jan 2005 09:51:23 -0000	1.3
  @@ -33,13 +33,7 @@
   	AxisSprintf (serializedValue, 6, "%s",
               (*((int *) (value)) == false_) ? "false" : "true");
       
  -    if (m_Buf)
  -    {
  -        delete [] m_Buf;
  -        m_Buf = NULL;
  -    }
  -    m_Buf = new char[strlen (serializedValue) + 1];
  -    strcpy (m_Buf, serializedValue);
  +    IAnySimpleType::serialize(serializedValue);
       delete [] serializedValue;        
       return m_Buf;
   }
  @@ -59,6 +53,11 @@
   	{
   		return false_;
   	}
  +}
  +
  +WhiteSpace* Boolean::getWhiteSpace()
  +{
  +    return new WhiteSpace(COLLAPSE);
   }
   
   AXIS_CPP_NAMESPACE_END
  
  
  
  1.3       +8 -0      ws-axis/c/src/soap/xsd/Boolean.hpp
  
  Index: Boolean.hpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/Boolean.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Boolean.hpp	19 Jan 2005 15:22:33 -0000	1.2
  +++ Boolean.hpp	20 Jan 2005 09:51:23 -0000	1.3
  @@ -59,6 +59,14 @@
   	 * @return Deserialized boolean value.
   	 */
       xsd__boolean deserializeBoolean(const AxisChar* valueAsChar) throw (AxisSoapException);
  +
  +protected:
  +
  +    /**
  +     * Creates a WhiteSpace object to collapse whitespace
  +     * @return WhiteSpace object set to collapse whitespace
  +     */
  +    WhiteSpace* getWhiteSpace();
   };
   
   AXIS_CPP_NAMESPACE_END
  
  
  
  1.3       +6 -7      ws-axis/c/src/soap/xsd/Date.cpp
  
  Index: Date.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/Date.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Date.cpp	19 Jan 2005 15:22:33 -0000	1.2
  +++ Date.cpp	20 Jan 2005 09:51:23 -0000	1.3
  @@ -21,13 +21,7 @@
       	AxisChar* serializedValue = new AxisChar[80];
       	strftime (serializedValue, 80, "%Y-%m-%dZ", value);
           
  -        if(m_Buf)
  -        {
  -            delete [] m_Buf;
  -            m_Buf = NULL;
  -        }
  -        m_Buf = new char[strlen (serializedValue) + 1];
  -		strcpy (m_Buf, serializedValue);
  +        IAnySimpleType::serialize(serializedValue);
           delete [] serializedValue;
   		return m_Buf;
       }
  @@ -151,5 +145,10 @@
           memcpy (m_Date, pTm, sizeof (tm));
           return m_Date;
   	}
  +
  +    WhiteSpace* Date::getWhiteSpace()
  +    {
  +        return new WhiteSpace(COLLAPSE);
  +    }
   	
   AXIS_CPP_NAMESPACE_END
  
  
  
  1.3       +8 -0      ws-axis/c/src/soap/xsd/Date.hpp
  
  Index: Date.hpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/Date.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Date.hpp	19 Jan 2005 15:22:33 -0000	1.2
  +++ Date.hpp	20 Jan 2005 09:51:23 -0000	1.3
  @@ -65,6 +65,14 @@
   	 */
       struct tm* deserializeDate(const AxisChar* valueAsChar) throw (AxisSoapException);
   
  +protected:
  +
  +    /**
  +     * Creates a WhiteSpace object to collapse whitespace
  +     * @return WhiteSpace object set to collapse whitespace
  +     */
  +    WhiteSpace* getWhiteSpace();
  +
   private:
   	struct tm* m_Date;
   };
  
  
  
  1.5       +6 -7      ws-axis/c/src/soap/xsd/DateTime.cpp
  
  Index: DateTime.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/DateTime.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DateTime.cpp	20 Jan 2005 04:30:07 -0000	1.4
  +++ DateTime.cpp	20 Jan 2005 09:51:23 -0000	1.5
  @@ -30,13 +30,7 @@
       	AxisChar* serializedValue = new AxisChar[80];
       	strftime (serializedValue, 80, "%Y-%m-%dT%H:%M:%SZ", value);
           
  -        if(m_Buf)
  -        {
  -            delete [] m_Buf;
  -            m_Buf = NULL;
  -        }
  -        m_Buf = new char[strlen (serializedValue) + 1];
  -		strcpy (m_Buf, serializedValue);
  +        IAnySimpleType::serialize(serializedValue);
           delete [] serializedValue;
   		return m_Buf;
       }
  @@ -170,6 +164,11 @@
           memcpy (m_DateTime, pTm, sizeof (tm));
           
           return m_DateTime;
  +    }
  +
  +    WhiteSpace* DateTime::getWhiteSpace()
  +    {
  +        return new WhiteSpace(COLLAPSE);
       }
   
   AXIS_CPP_NAMESPACE_END
  
  
  
  1.4       +8 -0      ws-axis/c/src/soap/xsd/DateTime.hpp
  
  Index: DateTime.hpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/DateTime.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DateTime.hpp	20 Jan 2005 04:30:07 -0000	1.3
  +++ DateTime.hpp	20 Jan 2005 09:51:23 -0000	1.4
  @@ -70,6 +70,14 @@
   	 */
       struct tm* deserializeDateTime(const AxisChar* valueAsChar) throw (AxisSoapException);
   
  +protected:
  +
  +    /**
  +     * Creates a WhiteSpace object to collapse whitespace
  +     * @return WhiteSpace object set to collapse whitespace
  +     */
  +    WhiteSpace* getWhiteSpace();
  +
   private:
   	struct tm* m_DateTime;
   };
  
  
  
  1.5       +6 -7      ws-axis/c/src/soap/xsd/Decimal.cpp
  
  Index: Decimal.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/Decimal.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Decimal.cpp	20 Jan 2005 04:49:28 -0000	1.4
  +++ Decimal.cpp	20 Jan 2005 09:51:23 -0000	1.5
  @@ -31,13 +31,7 @@
       AxisChar* serializedValue = new char[80];
   	AxisSprintf (serializedValue, 80, "%f", *value);
   	
  -    if (m_Buf)
  -    {
  -        delete [] m_Buf;
  -        m_Buf = NULL;
  -    }
  -    m_Buf = new char[strlen (serializedValue) + 1];
  -    strcpy (m_Buf, serializedValue);
  +    IAnySimpleType::serialize(serializedValue);
       delete [] serializedValue;        
       return m_Buf;
   }
  @@ -55,6 +49,11 @@
   	*m_Decimal = strtod (valueAsChar, &end);
   	
   	return m_Decimal;
  +}
  +
  +WhiteSpace* Decimal::getWhiteSpace()
  +{
  +    return new WhiteSpace(COLLAPSE);
   }
   
   AXIS_CPP_NAMESPACE_END
  
  
  
  1.4       +8 -0      ws-axis/c/src/soap/xsd/Decimal.hpp
  
  Index: Decimal.hpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/Decimal.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Decimal.hpp	20 Jan 2005 04:39:44 -0000	1.3
  +++ Decimal.hpp	20 Jan 2005 09:51:23 -0000	1.4
  @@ -69,6 +69,14 @@
   	 */
       double* deserializeDecimal(const AxisChar* valueAsChar) throw (AxisSoapException);
   
  +protected:
  +
  +    /**
  +     * Creates a WhiteSpace object to collapse whitespace
  +     * @return WhiteSpace object set to collapse whitespace
  +     */
  +    WhiteSpace* getWhiteSpace();
  +
   private:
   	double* m_Decimal;
   };
  
  
  
  1.3       +7 -8      ws-axis/c/src/soap/xsd/Double.cpp
  
  Index: Double.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/Double.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Double.cpp	19 Jan 2005 15:22:33 -0000	1.2
  +++ Double.cpp	20 Jan 2005 09:51:23 -0000	1.3
  @@ -22,14 +22,8 @@
       AxisChar* serializedValue = new char[80];
       AxisSprintf (serializedValue, 80, "%f", *value);
   	
  -	if (m_Buf)
  -    {
  -        delete [] m_Buf;
  -        m_Buf = NULL;
  -    }
  -    m_Buf = new char[strlen (serializedValue) + 1];
  -    strcpy (m_Buf, serializedValue);
  -    delete serializedValue;        
  +	IAnySimpleType::serialize(serializedValue);
  +    delete [] serializedValue;        
       return m_Buf;
   }
   
  @@ -46,6 +40,11 @@
   	*m_Double = strtod (valueAsChar, &end);
   	
   	return m_Double;
  +}
  +
  +WhiteSpace* Double::getWhiteSpace()
  +{
  +    return new WhiteSpace(COLLAPSE);
   }
   
   AXIS_CPP_NAMESPACE_END
  
  
  
  1.3       +8 -0      ws-axis/c/src/soap/xsd/Double.hpp
  
  Index: Double.hpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/Double.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Double.hpp	19 Jan 2005 15:22:33 -0000	1.2
  +++ Double.hpp	20 Jan 2005 09:51:23 -0000	1.3
  @@ -64,6 +64,14 @@
   	 */
       double* deserializeDouble(const AxisChar* valueAsChar) throw (AxisSoapException);
   
  +protected:
  +
  +    /**
  +     * Creates a WhiteSpace object to collapse whitespace
  +     * @return WhiteSpace object set to collapse whitespace
  +     */
  +    WhiteSpace* getWhiteSpace();
  +
   private:
   	double* m_Double;
   };
  
  
  
  1.3       +6 -7      ws-axis/c/src/soap/xsd/Duration.cpp
  
  Index: Duration.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/Duration.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Duration.cpp	19 Jan 2005 15:22:33 -0000	1.2
  +++ Duration.cpp	20 Jan 2005 09:51:23 -0000	1.3
  @@ -77,13 +77,7 @@
   		// Convert from String to Char[]	
   		AxisChar* returnValue = (AxisChar*) serializedValue.c_str ();
          
  -        if(m_Buf)
  -        {
  -            delete [] m_Buf;
  -            m_Buf = NULL;
  -        }
  -		m_Buf = new char[strlen (returnValue) + 1];
  -		strcpy (m_Buf, returnValue);
  +        IAnySimpleType::serialize(returnValue);
   		return m_Buf;
       }
   	
  @@ -139,6 +133,11 @@
   	    *m_Duration += secs;
   	    
   	    return m_Duration;
  +    }
  +
  +    WhiteSpace* Duration::getWhiteSpace()
  +    {
  +        return new WhiteSpace(COLLAPSE);
       }
       
   AXIS_CPP_NAMESPACE_END
  
  
  
  1.3       +8 -0      ws-axis/c/src/soap/xsd/Duration.hpp
  
  Index: Duration.hpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/Duration.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Duration.hpp	19 Jan 2005 15:22:33 -0000	1.2
  +++ Duration.hpp	20 Jan 2005 09:51:23 -0000	1.3
  @@ -65,6 +65,14 @@
   	 */
       long* deserializeDuration(const AxisChar* valueAsChar) throw (AxisSoapException);
   
  +protected:
  +
  +    /**
  +     * Creates a WhiteSpace object to collapse whitespace
  +     * @return WhiteSpace object set to collapse whitespace
  +     */
  +    WhiteSpace* getWhiteSpace();
  +
   private:
   	long* m_Duration;
   };
  
  
  
  1.4       +6 -7      ws-axis/c/src/soap/xsd/Float.cpp
  
  Index: Float.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/Float.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Float.cpp	20 Jan 2005 03:55:43 -0000	1.3
  +++ Float.cpp	20 Jan 2005 09:51:23 -0000	1.4
  @@ -28,13 +28,7 @@
       AxisChar* serializedValue = new char[80];
       AxisSprintf (serializedValue, 80, "%f", *value);
     
  -    if (m_Buf)
  -    {
  -        delete [] m_Buf;
  -        m_Buf = NULL;
  -    }
  -    m_Buf = new char[strlen (serializedValue) + 1];
  -    strcpy (m_Buf, serializedValue);
  +    IAnySimpleType::serialize(serializedValue);
       delete [] serializedValue;        
       return m_Buf;
   }
  @@ -51,6 +45,11 @@
   	*m_Float = (float) strtod (valueAsChar, &end);
   	
   	return m_Float;
  +}
  +
  +WhiteSpace* Float::getWhiteSpace()
  +{
  +    return new WhiteSpace(COLLAPSE);
   }
   
   AXIS_CPP_NAMESPACE_END
  
  
  
  1.4       +8 -0      ws-axis/c/src/soap/xsd/Float.hpp
  
  Index: Float.hpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/Float.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Float.hpp	20 Jan 2005 03:55:43 -0000	1.3
  +++ Float.hpp	20 Jan 2005 09:51:23 -0000	1.4
  @@ -69,6 +69,14 @@
   	 */
       float* deserializeFloat(const AxisChar* valueAsChar) throw (AxisSoapException);
   
  +protected:
  +
  +    /**
  +     * Creates a WhiteSpace object to collapse whitespace
  +     * @return WhiteSpace object set to collapse whitespace
  +     */
  +    WhiteSpace* getWhiteSpace();
  +
   private:
   	float* m_Float;
   };
  
  
  
  1.7       +1 -9      ws-axis/c/src/soap/xsd/HexBinary.cpp
  
  Index: HexBinary.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/HexBinary.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- HexBinary.cpp	20 Jan 2005 04:49:29 -0000	1.6
  +++ HexBinary.cpp	20 Jan 2005 09:51:23 -0000	1.7
  @@ -31,15 +31,7 @@
   	    Hex_Encode (serializedValue, value->__ptr, value->__size);
   	    serializedValue[value->__size * 2] = 0;
   	    
  -        if (m_Buf) // Samisa : memory management BP
  -        {
  -            delete [] m_Buf;
  -            m_Buf = NULL;
  -        }
  -
  -	    m_Buf = new char[strlen (serializedValue) + 1];
  -	    strcpy (m_Buf, serializedValue);
  -        // Samisa: serializedValue no more required, hence clean
  +        IAnySimpleType::serialize(serializedValue);
           delete [] serializedValue;
   	    return m_Buf;
       }
  
  
  
  1.3       +33 -0     ws-axis/c/src/soap/xsd/IAnySimpleType.cpp
  
  Index: IAnySimpleType.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/IAnySimpleType.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- IAnySimpleType.cpp	19 Jan 2005 15:22:33 -0000	1.2
  +++ IAnySimpleType.cpp	20 Jan 2005 09:51:23 -0000	1.3
  @@ -15,6 +15,29 @@
       }
   }
   
  +AxisChar* IAnySimpleType::serialize(const AxisChar* value) throw (AxisSoapException)
  +{
  +    WhiteSpace* whiteSpace = getWhiteSpace();
  +    const AxisChar* serializedValue = whiteSpace->processWhiteSpace(value);
  +
  +    Pattern* pattern = getPattern();
  +    if(pattern->isSet())
  +    {
  +        pattern->validatePattern(serializedValue);
  +    }
  +    delete pattern;
  +
  +    if (m_Buf)
  +    {
  +        delete [] m_Buf;
  +        m_Buf = NULL;
  +    } 
  +    m_Buf = new char[strlen (serializedValue) + 1];
  +    strcpy (m_Buf, serializedValue);
  +    delete whiteSpace;
  +    return m_Buf;
  +}
  +
   const AxisString& IAnySimpleType::replaceReservedCharacters(AxisString &value)
   {
       m_strReturnVal = "";
  @@ -76,6 +99,16 @@
   							  */ 
       }
       return m_strReturnVal;
  +}
  +
  +WhiteSpace* IAnySimpleType::getWhiteSpace()
  +{
  +    return new WhiteSpace(PRESERVE);
  +}
  +
  +Pattern* IAnySimpleType::getPattern()
  +{
  +    return new Pattern();
   }
   
   AXIS_CPP_NAMESPACE_END
  
  
  
  1.3       +22 -1     ws-axis/c/src/soap/xsd/IAnySimpleType.hpp
  
  Index: IAnySimpleType.hpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/IAnySimpleType.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- IAnySimpleType.hpp	19 Jan 2005 15:22:33 -0000	1.2
  +++ IAnySimpleType.hpp	20 Jan 2005 09:51:23 -0000	1.3
  @@ -24,6 +24,8 @@
   #include <axis/GDefine.hpp>
   #include <string>
   #include "../AxisSoapException.h"
  +#include "constraints/WhiteSpace.hpp"
  +#include "constraints/Pattern.hpp"
   
   AXIS_CPP_NAMESPACE_START
   
  @@ -80,7 +82,14 @@
   	 * @return Deserialized value.
   	 */
       virtual void* deserialize(const AxisChar* valueAsChar) throw (AxisSoapException) =
0;
  -    
  +
  +    /**
  +     * Take partially serialized value, process WhiteSpace and validate Pattern.
  +     * @param value
  +     * @return Serialized form of value
  +     */
  +    AxisChar* serialize(const AxisChar* value) throw (AxisSoapException);
  +
   protected:
   
       /**
  @@ -89,6 +98,18 @@
        * @return String with all reserved characters replaced
        */
       const AxisString& replaceReservedCharacters(AxisString& value);
  +
  +    /**
  +     * Creates a WhiteSpace object which preserve original string form
  +     * @return WhiteSpace object
  +     */
  +    virtual WhiteSpace* getWhiteSpace();
  +   
  +    /**
  +     * Create a Pattern object with no rules
  +     * @return Pattern object
  +     */
  +    Pattern* getPattern();
   
       /**
        * Reserved Characters
  
  
  
  1.4       +1 -7      ws-axis/c/src/soap/xsd/Integer.cpp
  
  Index: Integer.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/Integer.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Integer.cpp	20 Jan 2005 03:47:42 -0000	1.3
  +++ Integer.cpp	20 Jan 2005 09:51:23 -0000	1.4
  @@ -28,13 +28,7 @@
       AxisChar* serializedValue = new char[80];
       AxisSprintf (serializedValue, 80, "%lld", *value);
     
  -    if (m_Buf)
  -    {
  -        delete [] m_Buf;
  -        m_Buf = NULL;
  -    }
  -    m_Buf = new char[strlen (serializedValue) + 1];
  -    strcpy (m_Buf, serializedValue);
  +    IAnySimpleType::serialize(serializedValue);
       delete [] serializedValue;        
       return m_Buf;
   }
  
  
  
  1.3       +7 -8      ws-axis/c/src/soap/xsd/NOTATION.cpp
  
  Index: NOTATION.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/NOTATION.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- NOTATION.cpp	19 Jan 2005 15:22:33 -0000	1.2
  +++ NOTATION.cpp	20 Jan 2005 09:51:23 -0000	1.3
  @@ -19,15 +19,9 @@
   AxisChar* NOTATION::serialize(const AxisChar* value) throw (AxisSoapException)
   {
   	AxisString valueAsString = value;
  -	AxisChar* returnValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
  +	AxisChar* serializedValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
   
  -    if(m_Buf)
  -    {
  -        delete [] m_Buf;
  -        m_Buf = NULL;
  -    }	
  -	m_Buf = new char[strlen (returnValue) + 1];
  -	strcpy (m_Buf, returnValue);
  +    IAnySimpleType::serialize(serializedValue);
   	return m_Buf;
   }
   
  @@ -41,6 +35,11 @@
   	m_NOTATION = new char[strlen (valueAsChar) + 1];
   	strcpy (m_NOTATION, valueAsChar);
   	return m_NOTATION;
  +}
  +
  +WhiteSpace* NOTATION::getWhiteSpace()
  +{
  +    return new WhiteSpace(REPLACE);
   }
   
   AXIS_CPP_NAMESPACE_END
  
  
  
  1.3       +8 -0      ws-axis/c/src/soap/xsd/NOTATION.hpp
  
  Index: NOTATION.hpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/NOTATION.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- NOTATION.hpp	19 Jan 2005 15:22:33 -0000	1.2
  +++ NOTATION.hpp	20 Jan 2005 09:51:23 -0000	1.3
  @@ -64,6 +64,14 @@
        */
   	AxisChar* deserializeNOTATION(const AxisChar* valueAsChar) throw (AxisSoapException);
   
  +protected:
  +
  +    /**
  +     * Creates a WhiteSpace object to replace whitespace
  +     * @return WhiteSpace object set to replace whitespace
  +     */
  +    WhiteSpace* getWhiteSpace();
  +
   private:
       AxisChar* m_NOTATION;
   };
  
  
  
  1.3       +3 -9      ws-axis/c/src/soap/xsd/String.cpp
  
  Index: String.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/String.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- String.cpp	19 Jan 2005 15:22:33 -0000	1.2
  +++ String.cpp	20 Jan 2005 09:51:23 -0000	1.3
  @@ -19,16 +19,10 @@
   AxisChar* String::serialize(const AxisChar* value) throw (AxisSoapException)
   {
   	AxisString valueAsString = value;
  -	AxisChar* returnValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
  +	AxisChar* serializedValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
   
  -    if (m_Buf)
  -    {
  -        delete [] m_Buf;
  -        m_Buf = NULL;
  -    }	
  -	m_Buf = new char[strlen (returnValue) + 1];
  -	strcpy (m_Buf, returnValue);
  -	return m_Buf;
  +    IAnySimpleType::serialize(serializedValue);
  +    return m_Buf;
   }
   
   AxisChar* String::deserializeString(const AxisChar* valueAsChar) throw (AxisSoapException)
  
  
  
  1.3       +1 -1      ws-axis/c/src/soap/xsd/String.hpp
  
  Index: String.hpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/String.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- String.hpp	19 Jan 2005 15:22:33 -0000	1.2
  +++ String.hpp	20 Jan 2005 09:51:23 -0000	1.3
  @@ -63,7 +63,7 @@
        * @return Deserialized String value.
        */
   	AxisChar* deserializeString(const AxisChar* valueAsChar) throw (AxisSoapException);
  -  
  +
   private:
       AxisChar* m_String;
   };
  
  
  
  1.3       +7 -7      ws-axis/c/src/soap/xsd/Time.cpp
  
  Index: Time.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/Time.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Time.cpp	19 Jan 2005 15:22:33 -0000	1.2
  +++ Time.cpp	20 Jan 2005 09:51:23 -0000	1.3
  @@ -21,13 +21,8 @@
       	AxisChar* serializedValue = new AxisChar[80];
       	strftime (serializedValue, 80, "%H:%M:%SZ", value);
        
  -        if (m_Buf)
  -        {   
  -            delete [] m_Buf;
  -            m_Buf = NULL;
  -        }
  -        m_Buf = new char[strlen (serializedValue) + 1];
  -		strcpy (m_Buf, serializedValue);
  +        IAnySimpleType::serialize(serializedValue);
  +        delete [] serializedValue;
   		return m_Buf;
       }
   	
  @@ -160,6 +155,11 @@
       	m_Time = new struct tm;
   		memcpy (m_Time, pTm, sizeof (tm));
       	return m_Time;
  +    }
  +
  +    WhiteSpace* Time::getWhiteSpace()
  +    {
  +        return new WhiteSpace(COLLAPSE);
       }
   
   AXIS_CPP_NAMESPACE_END
  
  
  
  1.3       +8 -0      ws-axis/c/src/soap/xsd/Time.hpp
  
  Index: Time.hpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/Time.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Time.hpp	19 Jan 2005 15:22:33 -0000	1.2
  +++ Time.hpp	20 Jan 2005 09:51:23 -0000	1.3
  @@ -65,6 +65,14 @@
   	 */
       struct tm* deserializeTime(const AxisChar* valueAsChar) throw (AxisSoapException);
   
  +protected:
  +
  +    /**
  +     * Creates a WhiteSpace object to collapse whitespace
  +     * @return WhiteSpace object set to collapse whitespace
  +     */
  +    WhiteSpace* getWhiteSpace();
  +
   private:
   	struct tm* m_Time;
   };
  
  
  
  1.3       +7 -3      ws-axis/c/src/soap/xsd/XSD_QName.cpp
  
  Index: XSD_QName.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/XSD_QName.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XSD_QName.cpp	19 Jan 2005 15:22:33 -0000	1.2
  +++ XSD_QName.cpp	20 Jan 2005 09:51:23 -0000	1.3
  @@ -19,10 +19,9 @@
       AxisChar* XSD_QName::serialize(const AxisChar* value) throw (AxisSoapException)
       {
   		AxisString valueAsString = value;
  -		AxisChar* returnValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
  +		AxisChar* serializedValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
   		
  -		m_Buf = new char[strlen (returnValue) + 1];
  -		strcpy (m_Buf, returnValue);
  +		IAnySimpleType::serialize(serializedValue);
   		return m_Buf;
       }
   	
  @@ -31,6 +30,11 @@
   		m_QName = new char[strlen (valueAsChar) + 1];
   		strcpy (m_QName, valueAsChar);
   		return m_QName;
  +    }
  +
  +    WhiteSpace* XSD_QName::getWhiteSpace()
  +    {
  +        return new WhiteSpace(COLLAPSE);
       }
   
   AXIS_CPP_NAMESPACE_END
  
  
  
  1.3       +8 -0      ws-axis/c/src/soap/xsd/XSD_QName.hpp
  
  Index: XSD_QName.hpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/XSD_QName.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XSD_QName.hpp	19 Jan 2005 15:22:33 -0000	1.2
  +++ XSD_QName.hpp	20 Jan 2005 09:51:23 -0000	1.3
  @@ -64,6 +64,14 @@
   	 */
       AxisChar* deserializeQName(const AxisChar* valueAsChar) throw (AxisSoapException);
   
  +protected:
  +
  +    /**
  +     * Creates a WhiteSpace object to collapse whitespace
  +     * @return WhiteSpace object set to collapse whitespace
  +     */
  +    WhiteSpace* getWhiteSpace();
  +
   private:
       AxisChar* m_QName;
   
  
  
  
  1.27      +20 -0     ws-axis/c/vc/AxisClientDLL.dsp
  
  Index: AxisClientDLL.dsp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/vc/AxisClientDLL.dsp,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- AxisClientDLL.dsp	12 Jan 2005 14:06:17 -0000	1.26
  +++ AxisClientDLL.dsp	20 Jan 2005 09:51:27 -0000	1.27
  @@ -274,6 +274,18 @@
   # End Source File
   # Begin Source File
   
  +SOURCE=..\src\soap\xsd\Int.cpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\src\soap\xsd\Integer.cpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\src\soap\xsd\Long.cpp
  +# End Source File
  +# Begin Source File
  +
   SOURCE=..\src\common\MessageData.cpp
   # End Source File
   # Begin Source File
  @@ -290,6 +302,10 @@
   # End Source File
   # Begin Source File
   
  +SOURCE=..\src\soap\xsd\constraints\Pattern.cpp
  +# End Source File
  +# Begin Source File
  +
   SOURCE=..\src\xml\QName.cpp
   # End Source File
   # Begin Source File
  @@ -383,6 +399,10 @@
   # Begin Source File
   
   SOURCE=..\src\soap\URIMapping.cpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\src\soap\xsd\constraints\WhiteSpace.cpp
   # End Source File
   # Begin Source File
   
  
  
  
  1.25      +20 -0     ws-axis/c/vc/AxisServerDLL.dsp
  
  Index: AxisServerDLL.dsp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/vc/AxisServerDLL.dsp,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- AxisServerDLL.dsp	19 Jan 2005 08:51:50 -0000	1.24
  +++ AxisServerDLL.dsp	20 Jan 2005 09:51:27 -0000	1.25
  @@ -270,6 +270,18 @@
   # End Source File
   # Begin Source File
   
  +SOURCE=..\src\soap\xsd\Int.cpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\src\soap\xsd\Integer.cpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\src\soap\xsd\Long.cpp
  +# End Source File
  +# Begin Source File
  +
   SOURCE=..\src\common\MessageData.cpp
   # End Source File
   # Begin Source File
  @@ -286,6 +298,10 @@
   # End Source File
   # Begin Source File
   
  +SOURCE=..\src\soap\xsd\constraints\Pattern.cpp
  +# End Source File
  +# Begin Source File
  +
   SOURCE=..\src\xml\QName.cpp
   # End Source File
   # Begin Source File
  @@ -379,6 +395,10 @@
   # Begin Source File
   
   SOURCE=..\src\soap\URIMapping.cpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\src\soap\xsd\constraints\WhiteSpace.cpp
   # End Source File
   # Begin Source File
   
  
  
  
  1.13      +12 -0     ws-axis/c/vc/Distribution.dsw
  
  Index: Distribution.dsw
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/vc/Distribution.dsw,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Distribution.dsw	17 Dec 2004 10:54:14 -0000	1.12
  +++ Distribution.dsw	20 Jan 2005 09:51:27 -0000	1.13
  @@ -99,6 +99,18 @@
   
   ###############################################################################
   
  +Project: "AxisXMLParserXml4c"=".\xml\xerces\AxisXMLParserXml4c.dsp" - Package Owner=<4>
  +
  +Package=<5>
  +{{{
  +}}}
  +
  +Package=<4>
  +{{{
  +}}}
  +
  +###############################################################################
  +
   Project: "SimpleAxisServer"=".\server\simple_axis_server\SimpleAxisServer.dsp" - Package
Owner=<4>
   
   Package=<5>
  
  
  
  1.1                  ws-axis/c/src/soap/xsd/constraints/IConstrainingFacet.hpp
  
  Index: IConstrainingFacet.hpp
  ===================================================================
  /*
   *   Copyright 2003-2004 The Apache Software Foundation.
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *   limitations under the License.
   */
   
   /*
    * @file IConstrainingFacet.hpp
    */
    
  #if !defined(_CONSTRAININGFACET_HPP____OF_AXIS_INCLUDED_)
  #define _CONSTRAININGFACET_HPP____OF_AXIS_INCLUDED_
  
  #include "../../AxisSoapException.h"
  
  AXIS_CPP_NAMESPACE_START
  
  /**
   *   @class IConstrainingFacet
   *   @brief Interface for all XSD constraining facets
   *
   *   @author Adrian Dick (adrian.dick@uk.ibm.com)
   *
   */
  class IConstrainingFacet {
  
  public:
      virtual ~IConstrainingFacet () {};
  
      /**
       * To allow checking if a value has been set on this constraining facet.
       */    
      virtual bool isSet() = 0;
      
  protected:
      bool m_isSet;
  
  };
  
  AXIS_CPP_NAMESPACE_END
  
  #endif
  
  
  
  1.1                  ws-axis/c/src/soap/xsd/constraints/Pattern.cpp
  
  Index: Pattern.cpp
  ===================================================================
  #include "Pattern.hpp"
  
  AXIS_CPP_NAMESPACE_START
  
      Pattern::Pattern():m_Pattern(NULL)
      {
          m_isSet = false;
      }
  
      Pattern::Pattern(AxisChar* pattern)
      {
          if(m_Pattern)
          {
              delete [] m_Pattern;
              m_Pattern = NULL;
          }
          m_Pattern = pattern;
          m_isSet = true;
      }
      
      Pattern::~Pattern()
      {
          if(m_Pattern)
          {
              delete [] m_Pattern;
              m_Pattern = NULL;
          }
      }
  
      void Pattern::validatePattern(const AxisChar* value) throw (AxisSoapException)
      {
       /*
        * Currently has no effect.
        * Needs to validate the given string matches the regular expression
        * provided to the constructor.
        */
      }
      
      bool Pattern::isSet()
      {
          return m_isSet;
      }
  
  AXIS_CPP_NAMESPACE_END
  
  
  
  1.1                  ws-axis/c/src/soap/xsd/constraints/Pattern.hpp
  
  Index: Pattern.hpp
  ===================================================================
  /*
   *   Copyright 2003-2004 The Apache Software Foundation.
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *   limitations under the License.
   */
   
   /*
    * @file Pattern.hpp
    */
    
  #if !defined(_PATTERN_HPP____OF_AXIS_INCLUDED_)
  #define _PATTERN_HPP____OF_AXIS_INCLUDED_
  
  #include "IConstrainingFacet.hpp"
  #include "../../AxisSoapException.h"
  
  AXIS_CPP_NAMESPACE_START
  
  /**
   *   @class Pattern
   *
   *   @author Adrian Dick (adrian.dick@uk.ibm.com)
   *
   */
  class Pattern : IConstrainingFacet {
  
  public:
  
      Pattern();
      
      Pattern(AxisChar* pattern);
      
      ~Pattern();
  
      void validatePattern(const AxisChar* value) throw (AxisSoapException);
      
      bool isSet();
  
  private:
      AxisChar* m_Pattern;
  
  };
  
  AXIS_CPP_NAMESPACE_END
  
  #endif
  
  
  
  1.1                  ws-axis/c/src/soap/xsd/constraints/WhiteSpace.cpp
  
  Index: WhiteSpace.cpp
  ===================================================================
  #include "WhiteSpace.hpp"
  
  AXIS_CPP_NAMESPACE_START
  
      WhiteSpace::WhiteSpace():m_WhiteSpace(PRESERVE), m_Buf(NULL)
      {
          m_isSet = true;
      }
  
      WhiteSpace::WhiteSpace(whiteSpaceValue whiteSpace):m_Buf(NULL)
      {
          m_isSet = true;
          m_WhiteSpace = whiteSpace;
      }
      
      const AxisChar* WhiteSpace::processWhiteSpace(const AxisChar* valueToProcess)
      {
          AxisString valueAsString = valueToProcess;
          AxisChar* returnValue = NULL;
       
          switch (m_WhiteSpace)
          {
              case PRESERVE:
                  return valueToProcess;
              case REPLACE:
                  {
                      returnValue = (AxisChar*) replaceWhiteSpace(valueAsString).c_str();
                  }
                  break;
              case COLLAPSE:
                  {
                      returnValue = (AxisChar*) collapseWhiteSpace(valueAsString).c_str();
              
                  }
                  break;
          }
          
          if (m_Buf)
          {
              delete [] m_Buf;
              m_Buf = NULL;
          }
          m_Buf = new char[strlen (returnValue) + 1];
          strcpy (m_Buf, returnValue);
          delete returnValue;
          return m_Buf;
      }
      
      bool WhiteSpace::isSet()
      {
          return m_isSet;
      }
      
  
      /**
       * Replaces all occurances of tab, line feed and carriage return with space
       * 
       * @param value The string to have white space characters replaced.
       * @return AxisString The string with all white space characters replaced.
       */
      const AxisString& WhiteSpace::replaceWhiteSpace(AxisString& value)
      {     
          m_strReturnVal = "";
  
          if (value.empty ())
          {
              return value;
          }
  
          /* Find white space characters and returns the first any of chars find
           * position
           */ 
          unsigned int nPos = value.find_first_of (WHITE_SPACE_CHARS);
      
          /* Check for position validity */
          if (AxisString::npos == nPos)
          {
              return value;
          }
      
          int nOldIdx = 0;            // Counter value
          while (AxisString::npos != nPos)
          {                         // Get pointered character
              m_strReturnVal.append (value.substr (nOldIdx, nPos - nOldIdx));
              m_strReturnVal.append (" ");
  
              nOldIdx = ++nPos;     // Get old position
  
              /* 
               * Find the next white space characters from previous found 
               * position,
               */ 
              nPos = value.find_first_of (WHITE_SPACE_CHARS, nPos);
          }
      
          int nDataLen = value.length ();    // Get the length of the field value
          int nLen = nDataLen - nOldIdx;      // Get remaining number of characters   
          if (nLen > 0)
          {
              /*
               * Append the remaining data
               */
              m_strReturnVal += value.substr (nOldIdx, nLen); 
          }
  
          return m_strReturnVal;
       
      }
  
  
      /**
       * Collapses all white space in a string.
       * All occurances of tab, line feed and carriage return are replaced with
       * space, after which all sequences of spaces are collapsed to a single space.
       * 
       * @param value The string to have all white space collapsed
       * @return AxisString The string with all white space collapsed.
       */
      const AxisString& WhiteSpace::collapseWhiteSpace(AxisString& value)
      {
          m_strReturnVal = "";
  
          if (value.empty ())
          {
              return value;
          }
  
          AxisString replacedValue = replaceWhiteSpace(value);
  
          /* Find space character and returns the first any of chars find
           * position
           */ 
          unsigned int nPos = replacedValue.find_first_of (' ');
      
          /* Check for position validity */
          if (AxisString::npos == nPos)
          {
              m_strReturnVal.assign (replacedValue);
              return m_strReturnVal;
          }
      
          int nOldIdx = 0;            // Counter value
          while (AxisString::npos != nPos)
          {
              m_strReturnVal.append (replacedValue.substr (nOldIdx, nPos - nOldIdx));
  
              /**
               * Only copy space character across if it's NOT followed by             
               * another space character
               */
              if ( replacedValue.at(nPos+1) != ' ')
              {
                 m_strReturnVal.append (" ");
              }
  
              nOldIdx = ++nPos;     // Get old position
  
              /* 
               * Find the next entity reference characters from previous found 
               * position,
               */ 
              nPos = replacedValue.find_first_of (' ', nPos);
          }
      
          int nDataLen = replacedValue.length ();    // Get the length of the field value
          int nLen = nDataLen - nOldIdx;      // Get remaining number of characters   
          if (nLen > 0)
          {
              /*
               * Append the remaining data
               */
              m_strReturnVal += replacedValue.substr (nOldIdx, nLen); 
          }
  
          return m_strReturnVal;
  
          
      }
  
  AXIS_CPP_NAMESPACE_END
  
  
  
  1.1                  ws-axis/c/src/soap/xsd/constraints/WhiteSpace.hpp
  
  Index: WhiteSpace.hpp
  ===================================================================
  /*
   *   Copyright 2003-2004 The Apache Software Foundation.
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *   limitations under the License.
   */
   
   /*
    * @file WhiteSpace.hpp
    */
    
  #if !defined(_WHITESPACE_HPP____OF_AXIS_INCLUDED_)
  #define _WHITESPACE_HPP____OF_AXIS_INCLUDED_
  
  #include "IConstrainingFacet.hpp"
  
  AXIS_CPP_NAMESPACE_START
  
  const AxisChar WHITE_SPACE_CHARS[]    = "\t\r\n";
  
  typedef enum
  {
      PRESERVE, REPLACE, COLLAPSE
  } whiteSpaceValue;
  
  /**
   *   @class WhiteSpace
   *
   *   @author Adrian Dick (adrian.dick@uk.ibm.com)
   *
   */
  class WhiteSpace : IConstrainingFacet {
  
  public:
  
  
  
  
      WhiteSpace();
      
      WhiteSpace(whiteSpaceValue whiteSpace);
      
      bool isSet();
  
      const AxisChar* processWhiteSpace(const AxisChar* valueToProcess);
  
  
  private:
      const AxisString& replaceWhiteSpace(AxisString& value);
  
      const AxisString& collapseWhiteSpace(AxisString& value);
  
      enum
      {
          TAB_CHARACTER = '\t',
          LINE_FEED_CHARACTER = '\r',
          CARRIAGE_RETURN_CHARACTER = '\n'
      };
  
      whiteSpaceValue m_WhiteSpace;
  
      AxisChar* m_Buf;
  
      AxisString m_strReturnVal;
  };
  
  AXIS_CPP_NAMESPACE_END
  
  #endif
  
  
  

Mime
View raw message