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 da...@apache.org on 2003/07/14 06:36:39 UTC

cvs commit: xml-axis/c/src/common AxisException.cpp AxisException.h Makefile Test.cpp

damitha     2003/07/13 21:36:38

  Modified:    c/src/common Makefile Test.cpp
  Added:       c/src/common AxisException.cpp AxisException.h
  Log:
  initial C++ codebase
  
  Revision  Changes    Path
  1.4       +3 -1      xml-axis/c/src/common/Makefile
  
  Index: Makefile
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/common/Makefile,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Makefile	1 Jul 2003 05:30:27 -0000	1.3
  +++ Makefile	14 Jul 2003 04:36:38 -0000	1.4
  @@ -10,10 +10,12 @@
   
   
   PACKAGE_SRCS = AccessBean.cpp \
  +	AxisException.cpp \
   	Debug.cpp \
   	BasicTypeSerializer.cpp \
   	MessageData.cpp \
  -	Param.cpp
  +	Param.cpp \
  +	Test.cpp
   
   
   PACKAGE_OBJS = $(PACKAGE_SRCS:%.cpp=$(AX_OBJ_DIR_COMMON)/%.o)
  
  
  
  1.2       +12 -10    xml-axis/c/src/common/Test.cpp
  
  Index: Test.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/common/Test.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Test.cpp	25 Jun 2003 07:11:19 -0000	1.1
  +++ Test.cpp	14 Jul 2003 04:36:38 -0000	1.2
  @@ -1,18 +1,20 @@
  -#include "HandlerLoader.h"
   #include <stdio.h>
   #include <string>
   
   using namespace std;
  +class Test
  +{
  +  public:
  +  Test(){}
  +  virtual ~Test(){}
  +  void testMethod()
  +  {
  +  }
  +};
   
  -int main(int argc, char *argv[])
  +int main()
   {
  -	string sLib = "E:/axiscpp/release/win32/WsService.dll";
  -	HandlerLoader* pDL = new HandlerLoader(sLib);
  -	if (SUCCESS == pDL->Initialize())
  -	{	
  -		printf("Loaded Library %s\n", sLib.c_str());
  -		pDL->Finalize();
  -		printf("Unloaded Library %s\n", sLib.c_str());
  -	}
  +	
  +	
   	return 0;
   }
  
  
  
  1.1                  xml-axis/c/src/common/AxisException.cpp
  
  Index: AxisException.cpp
  ===================================================================
  #include "AxisException.h"
  
  AxisException::AxisException(int exceptionCode)
  {
    processException(exceptionCode);
  }
  
  AxisException::AxisException(exception* e)
  {
    processException(e);
  }
  
  AxisException::AxisException(exception* e, int exceptionCode)
  {
    processException(e);
  }
  
  void AxisException::processException(exception* e, int exceptionCode)
  {
    m_sMessage = getMessage(e) + getMessage(exceptionCode);
  }
  
  void AxisException::processException(exception* e)
  {
    m_sMessage = getMessage(e);
  }
  
  void AxisException::processException(int exceptionCode)
  {
    m_sMessage = getMessage(exceptionCode);
  }
  
  string AxisException::getMessage(exception* e)
  {
    string sMessage;
    exception *objType = dynamic_cast<bad_alloc*> (e);
    if(objType != NULL)
    {
      //cout << "bad_alloc" << endl;
      sMessage = "thrown by new";
    }
  
    objType = dynamic_cast<bad_cast*> (e);
    if(objType != NULL)
    {
      //cout << "bad_cast" << endl;
      sMessage = "thrown by dynamic_cast when fails with a referenced type";
    }
  
    objType = dynamic_cast<bad_exception*> (e);
    if(objType != NULL)
    {
      //cout << "bad_exception" << endl;
      sMessage = "thrown when an exception doesn't match any catch";
    }
  
    objType = dynamic_cast<bad_typeid*> (e);
    if(objType != NULL)
    {
      //cout << "bad_typeid" << endl;
      sMessage = "thrown by typeid";
    }
  
     return sMessage;
  }
  
  string AxisException::getMessage(int e)
  {
    string sMessage;
    if(e == 11)
    sMessage = "AXIS_CUSTOM_ERROR";
    //cout <<  "AXIS_CUSTOM_ERROR" << endl;
  
    return sMessage;
  
  }
  
  AxisException::~AxisException() throw()
  {
  
  }
  
  const char* AxisException::what() const throw()
  {
    return m_sMessage.c_str();
  }
  
  
  
  
  1.1                  xml-axis/c/src/common/AxisException.h
  
  Index: AxisException.h
  ===================================================================
  #include <string>
  #include <iostream>
  #include <exception>
  using namespace std;
  
  class AxisException :public exception
  {
  
    public:
    AxisException(int exceptionCode);
    AxisException(exception* e);
    AxisException(exception* e, int exceptionCode);
    virtual ~AxisException() throw();
    const char* what() const throw();
  
    private:
      void processException(exception* e);
      void processException(exception* e, int e);
      void processException(int e);
      string getMessage(exception* e);
      string getMessage(int e);
      string m_sMessage;
  };