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:07 UTC

cvs commit: xml-axis/c/src/wcg Variable.h Variable.cpp Method.h

susantha    2003/07/18 06:33:07

  Modified:    c/src/wcg Variable.h Variable.cpp Method.h
  Log:
  added more functionality
  
  Revision  Changes    Path
  1.3       +30 -12    xml-axis/c/src/wcg/Variable.h
  
  Index: Variable.h
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/wcg/Variable.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Variable.h	1 Jul 2003 10:50:11 -0000	1.2
  +++ Variable.h	18 Jul 2003 13:33:07 -0000	1.3
  @@ -24,6 +24,8 @@
    *       "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
  @@ -72,33 +74,49 @@
   #endif // _MSC_VER > 1000
   
   #include <string>
  +#include <list>
  +#include <map>
  +
   using namespace std;
   
  -enum VARTYPE { VAR_INT=1, VAR_FLOAT, VAR_STRING, VAR_LONG, VAR_SHORT, VAR_BYTE, VAR_UNSIGNEDLONG, \
  -				VAR_BOOLEAN, VAR_UNSIGNEDINT, VAR_UNSIGNEDSHORT, VAR_UNSIGNEDBYTE, \
  -				VAR_DOUBLE, VAR_USER};
  -
  -//Variable Qualifiers
  -const unsigned char VQ_PRIVATE = 0x01;
  -const unsigned char VQ_PROTECTED = 0x02;
  -const unsigned char VQ_STATIC = 0x04;
  -const unsigned char VQ_CONST = 0x08;
  -const unsigned char VQ_REFTYPE = 0x10;
  -const unsigned char VQ_PTRTYPE = 0x20;
  -const unsigned char VQ_PTRPTRTYPE = 0x40;
  +enum VARTYPE { VAR_INT=1, VAR_FLOAT, VAR_STRING, VAR_LONG, VAR_SHORT, \
  +			   VAR_CHAR, VAR_DOUBLE, VAR_BOOL, VAR_UNSIGNEDLONG, VAR_UNSIGNEDINT,\
  +			   VAR_UNSIGNEDSHORT, VAR_UNSIGNED_CHAR, VAR_USER};
  +
  +//Qualifiers
  +const unsigned char Q_PRIVATE = 0x01;
  +const unsigned char Q_PROTECTED = 0x02;
  +const unsigned char Q_STATIC = 0x04;
  +const unsigned char Q_CONST = 0x08;
  +const unsigned char Q_VIRTUAL = 0x10;
  +const unsigned char Q_REFTYPE = 0x20;
  +const unsigned char Q_PTRTYPE = 0x40;
  +const unsigned char Q_PTRPTRTYPE = 0x80;
   
   class Variable  
   {
   public:
  +	void Reset();
  +	int GetType();
  +	bool IsArrayType();
  +	bool IsComplexType();
  +	string& GetVarName();
  +	string& GetTypeName();
   	void SetVarName(string& sVarName);
   	void SetType(int nType, string sType="");
  +	void SetQualification(unsigned char cQualifier);
   	Variable();
  +	Variable(Variable& Var);
   	virtual ~Variable();
   private:
  +	void SetBasicTypeName();
   	int m_Type;
   	string m_TypeName; //if m_Type is user type
   	string m_VarName;
  +	list<int> m_ArrayIndexes;
   	unsigned char m_Qualifier; //private=1/protected=2/public=0/static=4/const=8/reference type=16/pointer type=32/pointer to pointer type=64
   };
  +
  +extern map<string, string> g_ClassNamespaces;
   
   #endif // !defined(AFX_VARIABLE_H__F9272406_BB8F_4151_8346_E033DDDDA468__INCLUDED_)
  
  
  
  1.3       +70 -0     xml-axis/c/src/wcg/Variable.cpp
  
  Index: Variable.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/wcg/Variable.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Variable.cpp	1 Jul 2003 10:50:11 -0000	1.2
  +++ Variable.cpp	18 Jul 2003 13:33:07 -0000	1.3
  @@ -24,6 +24,9 @@
    *       "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
  @@ -63,6 +66,7 @@
   // Variable.cpp: implementation of the Variable class.
   //
   //////////////////////////////////////////////////////////////////////
  +#pragma warning (disable : 4786)
   
   #include "Variable.h"
   
  @@ -78,6 +82,14 @@
   	m_VarName = "";
   }
   
  +Variable::Variable(Variable& Var)
  +{
  +	m_Qualifier = Var.m_Qualifier;
  +	m_Type = Var.m_Type;
  +	m_TypeName = Var.m_TypeName;
  +	m_VarName = Var.m_VarName;
  +}
  +
   Variable::~Variable()
   {
   
  @@ -87,9 +99,67 @@
   {
   	m_Type = nType;
   	if (nType == VAR_USER) m_TypeName = sType;
  +	else SetBasicTypeName();
   }
   
   void Variable::SetVarName(string &sVarName)
   {
   	m_VarName = sVarName;
  +}
  +
  +void Variable::SetQualification(unsigned char cQualifier)
  +{
  + 	m_Qualifier |= cQualifier;
  +}
  +
  +string& Variable::GetTypeName()
  +{
  +	return m_TypeName;
  +}
  +
  +string& Variable::GetVarName()
  +{
  +	return m_VarName;
  +}
  +
  +void Variable::SetBasicTypeName()
  +{	
  +	switch (m_Type)
  +	{
  +		case VAR_INT: m_TypeName = "int"; break;
  +		case VAR_FLOAT: m_TypeName = "float"; break;
  +		case VAR_STRING: m_TypeName = "string"; break; //note that string too is taken as a basic type
  +		case VAR_LONG: m_TypeName = "long"; break;
  +		case VAR_SHORT: m_TypeName = "short"; break;
  +		case VAR_CHAR: m_TypeName = "char"; break;
  +		case VAR_DOUBLE: m_TypeName = "double"; break;
  +		case VAR_BOOL: m_TypeName = "bool"; break;
  +		case VAR_UNSIGNEDLONG: m_TypeName = "unsigned long"; break;
  +		case VAR_UNSIGNEDINT: m_TypeName = "unsigned int"; break;
  +		case VAR_UNSIGNEDSHORT: m_TypeName = "unsigned short"; break;
  +		case VAR_UNSIGNED_CHAR: m_TypeName = "unsigned char"; break;
  +	}
  +}
  +
  +bool Variable::IsComplexType()
  +{
  +	return false;
  +}
  +
  +bool Variable::IsArrayType()
  +{
  +	return false;
  +}
  +
  +int Variable::GetType()
  +{
  +	return m_Type;
  +}
  +
  +void Variable::Reset()
  +{
  +	m_Qualifier = 0;
  +	m_Type = 0;
  +	m_TypeName = "";
  +	m_VarName = "";
   }
  
  
  
  1.3       +7 -8      xml-axis/c/src/wcg/Method.h
  
  Index: Method.h
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/wcg/Method.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Method.h	1 Jul 2003 10:50:11 -0000	1.2
  +++ Method.h	18 Jul 2003 13:33:07 -0000	1.3
  @@ -24,6 +24,7 @@
    *       "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
  @@ -72,22 +73,19 @@
   #endif // _MSC_VER > 1000
   
   #include "Variable.h"
  -
  +#include "File.h"
   #include <list>
   #include <string>
   
   using namespace std;
   
  -//Method Qualifiers
  -const unsigned char MQ_PRIVATE = 0x01;
  -const unsigned char MQ_PROTECTED = 0x02;
  -const unsigned char MQ_STATIC = 0x04;
  -const unsigned char MQ_CONST = 0x08;
  -const unsigned char MQ_VIRTUAL = 0x10;
  -
   class Method  
   {
   public:
  +	string& GetParamGetMethod(int nType);
  +	int GenerateMethodImpl(string& sClassName, File& file);
  +	string& GetName();
  +	int GenerateMethodDef(File &file);
   	void SetQualification(unsigned char sQualifier);
   	void SetMethodName(string& sName);
   	void AddParameter(Variable* pVar);
  @@ -95,6 +93,7 @@
   	Method();
   	virtual ~Method();
   private:
  +	string m_AuxStr;
   	Variable* m_pReturnType;
   	string m_Name;
   	list<Variable*> m_Params;