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 su...@apache.org on 2003/07/23 11:30:48 UTC

cvs commit: xml-axis/c/src/common TypeMapping.h TypeMapping.cpp Param.cpp ISoapSerializer.h IParam.h Handler.h BasicTypeSerializer.h BasicHandler.h AccessBean.h

susantha    2003/07/23 02:30:47

  Modified:    c/src/common Param.cpp ISoapSerializer.h IParam.h Handler.h
                        BasicTypeSerializer.h BasicHandler.h AccessBean.h
  Added:       c/src/common TypeMapping.h TypeMapping.cpp
  Log:
  Changes due to moving TypeMapping.* files from src/soap to src/common
  Also added few functions to ISoapSerializer to avoid the need of the BasicTypeSerializer code for the Wrapper Classes
  
  Revision  Changes    Path
  1.8       +1 -1      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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Param.cpp	21 Jul 2003 14:10:33 -0000	1.7
  +++ Param.cpp	23 Jul 2003 09:30:47 -0000	1.8
  @@ -357,7 +357,7 @@
   	case XSD_STRING:
   	case XSD_HEXBINARY:
   	case XSD_BASE64BINARY:
  -		m_sValue = Value.pStrValue->c_str();
  +		m_sValue = Value.pStrValue;
   		break;
   	//Continue this for all basic types
   	case XSD_ARRAY:
  
  
  
  1.4       +6 -1      xml-axis/c/src/common/ISoapSerializer.h
  
  Index: ISoapSerializer.h
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/common/ISoapSerializer.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ISoapSerializer.h	21 Jul 2003 14:10:34 -0000	1.3
  +++ ISoapSerializer.h	23 Jul 2003 09:30:47 -0000	1.4
  @@ -71,7 +71,7 @@
   class IArrayBean;
   class IParam;
   union uParamValue;
  -#include "../soap/TypeMapping.h"
  +#include "TypeMapping.h"
   
   class ISoapSerializer
   {
  @@ -81,6 +81,11 @@
   	virtual ISoapSerializer& operator<<(const char *cSerialized)=0;
   	virtual const char* getNewNamespacePrefix()=0;
   	virtual IArrayBean* makeArrayBean(XSDTYPE nType, void* pArray)=0;
  +public: //Basic Type Serializing methods
  +	virtual string& SerializeBasicType(const string& sName, string& sValue, XSDTYPE type=XSD_STRING)=0;
  +	virtual string& SerializeBasicType(const string& sName, float fValue)=0;
  +	virtual string& SerializeBasicType(const string& sName, int nValue)=0;
  +
   };
   
   #endif // !defined(AFX_ISOAPSERIALIZER_H__4F8E4E72_56C8_4F1C_A488_350FDEFF9028__INCLUDED_)
  
  
  
  1.2       +3 -2      xml-axis/c/src/common/IParam.h
  
  Index: IParam.h
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/common/IParam.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- IParam.h	21 Jul 2003 14:10:34 -0000	1.1
  +++ IParam.h	23 Jul 2003 09:30:47 -0000	1.2
  @@ -10,7 +10,7 @@
   #endif // _MSC_VER > 1000
   
   #include "IAccessBean.h"
  -#include "../soap/TypeMapping.h"
  +#include "TypeMapping.h"
   #include <string>
   using namespace std;
   
  @@ -19,12 +19,13 @@
   	int nValue;
   	float fValue;
   	double dValue;
  -	string* pStrValue;
   	//all basic types should come here
   	class ArrayBean* pArray; //this is used to hold arrays
   	class IArrayBean* pIArray; //used by wrapper classes
   	class AccessBean* pBean; //this is used to hold user types
   	class IAccessBean* pIBean; //used by wrapper classes
  +	//following is used by the wrapper class to set return value in case of strings	
  +	const char* pStrValue; 
   } uParamValue;
   
   class IParam  
  
  
  
  1.2       +2 -0      xml-axis/c/src/common/Handler.h
  
  Index: Handler.h
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/common/Handler.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Handler.h	1 Jul 2003 04:51:51 -0000	1.1
  +++ Handler.h	23 Jul 2003 09:30:47 -0000	1.2
  @@ -2,6 +2,8 @@
   #define __HANDLER_INCLUDED__
   
   #include "BasicHandler.h"
  +#include <map>
  +using namespace std;
   
   class Handler : public BasicHandler
   {
  
  
  
  1.8       +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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- BasicTypeSerializer.h	22 Jul 2003 06:03:00 -0000	1.7
  +++ BasicTypeSerializer.h	23 Jul 2003 09:30:47 -0000	1.8
  @@ -71,7 +71,7 @@
   #pragma once
   #endif // _MSC_VER > 1000
   
  -#include "../soap/TypeMapping.h"
  +#include "TypeMapping.h"
   
   #include <string>
   using namespace std;
  
  
  
  1.3       +1 -4      xml-axis/c/src/common/BasicHandler.h
  
  Index: BasicHandler.h
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/common/BasicHandler.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BasicHandler.h	15 Jul 2003 05:18:56 -0000	1.2
  +++ BasicHandler.h	23 Jul 2003 09:30:47 -0000	1.3
  @@ -72,10 +72,7 @@
   #pragma once
   #endif // _MSC_VER > 1000
   
  -#include "MessageData.h"
  -#include <map>
  -
  -using namespace std;
  +#include "IMessageData.h"
   
   class BasicHandler  
   {
  
  
  
  1.5       +1 -1      xml-axis/c/src/common/AccessBean.h
  
  Index: AccessBean.h
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/common/AccessBean.h,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AccessBean.h	21 Jul 2003 14:10:35 -0000	1.4
  +++ AccessBean.h	23 Jul 2003 09:30:47 -0000	1.5
  @@ -74,7 +74,7 @@
   
   #include "GDefine.h"
   #include "IAccessBean.h"
  -#include "../soap/TypeMapping.h"
  +#include "TypeMapping.h"
   
   #include <string>
   using namespace std;
  
  
  
  1.1                  xml-axis/c/src/common/TypeMapping.h
  
  Index: TypeMapping.h
  ===================================================================
  /* -*- C++ -*- */
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "SOAP" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   *
   *
   *
   * @author Susantha Kumara (skumara@virtusa.com)
   *
   */
  // TypeMapping.h: interface for the TypeMapping class.
  //
  //////////////////////////////////////////////////////////////////////
  #pragma warning (disable : 4786)
  
  #if !defined(AFX_TYPEMAPPING_H__B09703CE_154D_400E_A4E6_ED01901B33A0__INCLUDED_)
  #define AFX_TYPEMAPPING_H__B09703CE_154D_400E_A4E6_ED01901B33A0__INCLUDED_
  
  #if _MSC_VER > 1000
  #pragma once
  #endif // _MSC_VER > 1000
  
  #include <map>
  #include <string>
  
  using namespace std;
  
  enum XSDTYPE { XSD_UNKNOWN=1, XSD_INT, XSD_FLOAT, XSD_STRING, XSD_LONG, XSD_SHORT, XSD_BYTE, XSD_UNSIGNEDLONG, \
  				XSD_BOOLEAN, XSD_UNSIGNEDINT, XSD_UNSIGNEDSHORT, XSD_UNSIGNEDBYTE, \
  				XSD_DOUBLE, XSD_DECIMAL, XSD_DURATION, XSD_DATETIME, XSD_TIME, XSD_DATE, \
  				XSD_YEARMONTH, XSD_YEAR, XSD_MONTHDAY, XSD_DAY, XSD_MONTH, XSD_HEXBINARY, \
  				XSD_BASE64BINARY, XSD_ANYURI, XSD_QNAME, XSD_NOTATION, XSD_INTEGER, \
  				XSD_ARRAY, USER_TYPE, ACCESSOR };
  
  class TypeMapping  
  {
  public:
  	static XSDTYPE Map(string& sType);
  	static void Initialize();
  	static map<string, XSDTYPE> m_sTypeMap;
  	static bool m_bInit;
  	TypeMapping();
  	virtual ~TypeMapping();
  
  };
  
  #endif // !defined(AFX_TYPEMAPPING_H__B09703CE_154D_400E_A4E6_ED01901B33A0__INCLUDED_)
  
  
  
  1.1                  xml-axis/c/src/common/TypeMapping.cpp
  
  Index: TypeMapping.cpp
  ===================================================================
  /* -*- C++ -*- */
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "SOAP" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   *
   *
   *
   * @author Susantha Kumara (skumara@virtusa.com)
   *
   */
  
  // TypeMapping.cpp: implementation of the TypeMapping class.
  //
  //////////////////////////////////////////////////////////////////////
  
  #include "TypeMapping.h"
  
  //////////////////////////////////////////////////////////////////////
  // Construction/Destruction
  //////////////////////////////////////////////////////////////////////
  map<string, XSDTYPE> TypeMapping::m_sTypeMap;
  bool TypeMapping::m_bInit = false;
  //map<string, XSDTYPE> TypeMapping::m_sTypeMap["xsd:int"] = XSD_INT;
  //map<string, XSDTYPE> TypeMapping::m_sTypeMap["xsd:string"] = XSD_STRING;
  
  
  TypeMapping::TypeMapping()
  {
  
  }
  
  TypeMapping::~TypeMapping()
  {
  
  }
  
  void TypeMapping::Initialize()
  {
  	if (!m_bInit)
  	{
  		m_sTypeMap["int"] = XSD_INT;
  		m_sTypeMap["string"] = XSD_STRING;
  		m_bInit = true;
  	}
  }
  
  XSDTYPE TypeMapping::Map(string &sType)
  {
  	if (m_sTypeMap.find(sType) != m_sTypeMap.end())
  	{
  		return m_sTypeMap[sType];
  	}
  	return XSD_UNKNOWN;
  }