axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From susan...@apache.org
Subject cvs commit: xml-axis/c/src/common Param.h Param.cpp BasicTypeSerializer.h BasicTypeSerializer.cpp
Date Tue, 01 Jul 2003 03:44:39 GMT
susantha    2003/06/30 20:44:39

  Modified:    c/src/common Param.h Param.cpp BasicTypeSerializer.h
                        BasicTypeSerializer.cpp
  Log:
  some improvements to handler other basic types
  
  Revision  Changes    Path
  1.3       +2 -1      xml-axis/c/src/common/Param.h
  
  Index: Param.h
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/common/Param.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Param.h	30 Jun 2003 03:59:44 -0000	1.2
  +++ Param.h	1 Jul 2003 03:44:39 -0000	1.3
  @@ -119,13 +119,14 @@
   public: //Conversion functions
   	int SetValue(string& sValue);
   	XSDTYPE GetType() const;
  -	const string& ToString();
   	int serialize(string& sSerialized);
   
   	//Following functions are used by wrapper class methods making sure of the valid type.
   	int GetInt();
   	float GetFloat();
   	const string& GetString();
  +	const string& GetHexString();
  +	const string& GetBase64String();
   	const AccessBean* GetUserType() const;
   	void setPrefix(const string &prefix);
   	void setUri(const string &uri);
  
  
  
  1.3       +36 -19    xml-axis/c/src/common/Param.cpp
  
  Index: Param.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/common/Param.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Param.cpp	30 Jun 2003 03:59:44 -0000	1.2
  +++ Param.cpp	1 Jul 2003 03:44:39 -0000	1.3
  @@ -165,6 +165,34 @@
   	return m_sValue;
   }
   
  +const string& Param::GetHexString()
  +{
  +	if (m_Type == XSD_HEXBINARY){}
  +	else if (m_Type == XSD_UNKNOWN) //see GetInt() to see why we do this
  +	{
  +		m_Type = XSD_HEXBINARY;
  +	}
  +	else 
  +	{
  +		//exception
  +	}
  +	return m_sValue;
  +}
  +
  +const string& Param::GetBase64String()
  +{
  +	if (m_Type == XSD_BASE64BINARY){}
  +	else if (m_Type == XSD_UNKNOWN) //see GetInt() to see why we do this
  +	{
  +		m_Type = XSD_BASE64BINARY;
  +	}
  +	else 
  +	{
  +		//exception
  +	}
  +	return m_sValue;
  +}
  +
   int Param::GetInt()
   {
   	if (m_Type == XSD_INT){}
  @@ -199,25 +227,6 @@
   	return m_Value.f;
   }
   
  -//This function may be called only for basic types
  -const string& Param::ToString()
  -{
  -	if (m_Type == XSD_STRING) return m_sValue; 
  -	switch (m_Type)
  -	{
  -	case XSD_INT:
  -		sprintf(m_Buf,"%d", m_Value.n);
  -		break;
  -	case XSD_FLOAT:
  -		sprintf(m_Buf,"%f", m_Value.f);
  -		break;
  -	//Continue this for all basic types
  -	default:; //this is an unexpected situation
  -	}
  -	m_sValue = m_Buf;
  -	return m_sValue;
  -}
  -
   XSDTYPE Param::GetType() const
   {
   	return m_Type;
  @@ -235,6 +244,12 @@
   	case XSD_STRING:
   		m_sSZ = BasicTypeSerializer::serialize(m_sName, m_sValue);
   		break;
  +	case XSD_HEXBINARY:
  +		m_sSZ = BasicTypeSerializer::serialize(m_sName, m_sValue, XSD_HEXBINARY);
  +		break;
  +	case XSD_BASE64BINARY:
  +		m_sSZ = BasicTypeSerializer::serialize(m_sName, m_sValue, XSD_BASE64BINARY);
  +		break;
   	case XSD_ARRAY:
   		//m_sSZ = "<abc:ArrayOfPhoneNumbers xmlns:abc="http://example.org/2001/06/numbers"
   		//				xmlns:enc="http://www.w3.org/2001/06/soap-encoding" 
  @@ -307,6 +322,8 @@
   		m_Value.f = atof(sValue.c_str());
   		break;
   	case XSD_STRING:
  +	case XSD_HEXBINARY:
  +	case XSD_BASE64BINARY:
   		m_sValue = sValue;
   		break;
   	//Continue this for all basic types
  
  
  
  1.2       +1 -1      xml-axis/c/src/common/BasicTypeSerializer.h
  
  Index: BasicTypeSerializer.h
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/common/BasicTypeSerializer.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BasicTypeSerializer.h	25 Jun 2003 07:11:19 -0000	1.1
  +++ BasicTypeSerializer.h	1 Jul 2003 03:44:39 -0000	1.2
  @@ -79,7 +79,7 @@
   class BasicTypeSerializer  
   {
   public:
  -	static string& serialize(const string& sName, string& sValue);
  +	static string& serialize(const string& sName, string& sValue, XSDTYPE type=XSD_STRING);
   	static string& serialize(const string& sName, float fValue);
   	static string& serialize(const string& sName, int nValue);
   	static const char* BasicTypeStr(XSDTYPE type);
  
  
  
  1.2       +8 -6      xml-axis/c/src/common/BasicTypeSerializer.cpp
  
  Index: BasicTypeSerializer.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/common/BasicTypeSerializer.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BasicTypeSerializer.cpp	25 Jun 2003 07:11:19 -0000	1.1
  +++ BasicTypeSerializer.cpp	1 Jul 2003 03:44:39 -0000	1.2
  @@ -100,9 +100,9 @@
   	return m_sSZ;
   }
   
  -string& BasicTypeSerializer::serialize(const string &sName, string &sValue)
  +string& BasicTypeSerializer::serialize(const string &sName, string &sValue,
XSDTYPE type)
   {
  -	m_Type = XSD_STRING;
  +	m_Type = type;
   	HelpSerialize(sName, sValue);
   	return m_sSZ;
   }
  @@ -114,12 +114,12 @@
   	m_sSZ +=" xsi:type=\"xsd:";
   	m_sSZ += BasicTypeStr(m_Type);
   	m_sSZ += "\">";
  -	if (m_Type == XSD_STRING)
  +	switch (m_Type)
   	{
  +	case XSD_STRING:
   		m_sSZ = sValue.c_str();	
  -	}
  -	else
  -	{
  +		break;
  +	default:
   		m_sSZ += m_Buf;
   	}
   	m_sSZ += "</";
  @@ -134,6 +134,8 @@
   	case XSD_INT: return "int";
   	case XSD_FLOAT: return "float";
   	case XSD_STRING: return "string";
  +	case XSD_HEXBINARY: return "hexBinary";
  +	case XSD_BASE64BINARY: return "base64Binary";
   	default: return " ";
   	}
   }
  
  
  

Mime
View raw message