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/18 15:33:51 UTC
cvs commit: xml-axis/c/src/wcg Method.cpp File.cpp BeanClass.h BeanClass.cpp
susantha 2003/07/18 06:33:51
Modified: c/src/wcg Method.cpp File.cpp BeanClass.h BeanClass.cpp
Log:
added more functionality
Revision Changes Path
1.3 +80 -0 xml-axis/c/src/wcg/Method.cpp
Index: Method.cpp
===================================================================
RCS file: /home/cvs/xml-axis/c/src/wcg/Method.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Method.cpp 1 Jul 2003 10:50:11 -0000 1.2
+++ Method.cpp 18 Jul 2003 13:33:51 -0000 1.3
@@ -63,6 +63,7 @@
// Method.cpp: implementation of the Method class.
//
//////////////////////////////////////////////////////////////////////
+#pragma warning (disable : 4786)
#include "Method.h"
@@ -104,4 +105,83 @@
void Method::SetQualification(unsigned char sQualifier)
{
m_Qualifier|=sQualifier;
+}
+
+//generates wrapper method declaration
+int Method::GenerateMethodDef(File &file)
+{
+ try
+ {
+ file << "\tint" << " " << m_Name << "(IMessageData* mc);" << endl;
+ }
+ catch(...) //any exception
+ {
+ return 1;
+ }
+ return 0; //success
+}
+
+string& Method::GetName()
+{
+ return m_Name;
+}
+
+int Method::GenerateMethodImpl(string& sClassName, File &file)
+{
+ file << "int " << sClassName << "::" << m_Name << "(IMessageData* mc)" << endl;
+ file << "{" << endl;
+ file << "\tSetResponseMethod(mc, " << m_Name << "\");" << endl;
+ int nParam = 0;
+ for (list<Variable*>::iterator it = m_Params.begin(); it != m_Params.end(); it++)
+ {
+ file << "\tParam *param" << nParam << " = mc->getSoapDeserializer()->GetParam();" << endl;
+ if ((*it)->IsComplexType())
+ {
+
+ }
+ else if ((*it)->IsArrayType())
+ {
+
+ }
+ else //basic types
+ {
+ file << "\t" << (*it)->GetTypeName() << " v" << nParam << " = " << "param" << nParam << "->" << GetParamGetMethod((*it)->GetType()) << "();" << endl;
+ }
+ nParam++;
+ }
+ file << "\t//Call actual web service method with appropriate parameters" << endl;
+ file << "\tParam ret(pWs->" << m_Name << "(";
+ for (int n=0; n<nParam;)
+ {
+ file << "v" << n++;
+ if (n<nParam) file << ", ";
+ }
+ file << "));" << endl;
+ file << "\tret.m_sName = \"" << m_Name << "Return\";" << endl;
+ file << "\tmc->getSoapSerializer()->setResponseParam(&ret);" << endl;
+ file << "\treturn SUCCESS;" << endl;
+ file << "}" << endl;
+ file << endl;
+ return 0;
+}
+
+string& Method::GetParamGetMethod(int nType)
+{
+ //All get methods of Param class should be listed here
+ switch(nType)
+ {
+ case VAR_INT: m_AuxStr = "GetInt"; break;
+ case VAR_FLOAT: m_AuxStr = "GetFloat"; break;
+ case VAR_STRING: m_AuxStr = "GetString"; break;
+ case VAR_LONG: m_AuxStr = "GetLong"; break;
+ case VAR_SHORT: m_AuxStr = "GetShort"; break;
+ case VAR_CHAR: m_AuxStr = "GetChar"; break;
+ case VAR_DOUBLE: m_AuxStr = "GetDouble"; break;
+ case VAR_BOOL: m_AuxStr = "GetBool"; break;
+ case VAR_UNSIGNEDLONG: m_AuxStr = "GetUnsignedLong"; break;
+ case VAR_UNSIGNEDINT: m_AuxStr = "GetUnsignedInt"; break;
+ case VAR_UNSIGNEDSHORT: m_AuxStr = "GetUnsignedShort"; break;
+ case VAR_UNSIGNED_CHAR: m_AuxStr = "GetUnsignedChar"; break;
+ }
+ return m_AuxStr;
}
1.2 +1 -0 xml-axis/c/src/wcg/File.cpp
Index: File.cpp
===================================================================
RCS file: /home/cvs/xml-axis/c/src/wcg/File.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- File.cpp 1 Jul 2003 10:50:11 -0000 1.1
+++ File.cpp 18 Jul 2003 13:33:51 -0000 1.2
@@ -1,6 +1,7 @@
// File.cpp: implementation of the File class.
//
//////////////////////////////////////////////////////////////////////
+#pragma warning (disable : 4786)
#include "File.h"
1.3 +2 -0 xml-axis/c/src/wcg/BeanClass.h
Index: BeanClass.h
===================================================================
RCS file: /home/cvs/xml-axis/c/src/wcg/BeanClass.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BeanClass.h 1 Jul 2003 10:50:11 -0000 1.2
+++ BeanClass.h 18 Jul 2003 13:33:51 -0000 1.3
@@ -79,10 +79,12 @@
class BeanClass
{
public:
+ void SetClassName(string &sName);
void AddVariable(Variable* pVar);
BeanClass();
virtual ~BeanClass();
private:
+ string m_Name;
list<Variable*> m_Variables;
};
1.3 +6 -0 xml-axis/c/src/wcg/BeanClass.cpp
Index: BeanClass.cpp
===================================================================
RCS file: /home/cvs/xml-axis/c/src/wcg/BeanClass.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BeanClass.cpp 1 Jul 2003 10:50:11 -0000 1.2
+++ BeanClass.cpp 18 Jul 2003 13:33:51 -0000 1.3
@@ -64,6 +64,7 @@
// BeanClass.cpp: implementation of the BeanClass class.
//
//////////////////////////////////////////////////////////////////////
+#pragma warning (disable : 4786)
#include "BeanClass.h"
@@ -87,4 +88,9 @@
void BeanClass::AddVariable(Variable *pVar)
{
m_Variables.push_back(pVar);
+}
+
+void BeanClass::SetClassName(string &sName)
+{
+ m_Name = sName;
}