00001 /* -*- C++ -*- */ 00002 00003 /* 00004 * The Apache Software License, Version 1.1 00005 * 00006 * 00007 * Copyright (c) 2002 The Apache Software Foundation. All rights 00008 * reserved. 00009 * 00010 * Redistribution and use in source and binary forms, with or without 00011 * modification, are permitted provided that the following conditions 00012 * are met: 00013 * 00014 * 1. Redistributions of source code must retain the above copyright 00015 * notice, this list of conditions and the following disclaimer. 00016 * 00017 * 2. Redistributions in binary form must reproduce the above copyright 00018 * notice, this list of conditions and the following disclaimer in 00019 * the documentation and/or other materials provided with the 00020 * distribution. 00021 * 00022 * 3. The end-user documentation included with the redistribution, 00023 * if any, must include the following acknowledgment: 00024 * "This product includes software developed by the 00025 * Apache Software Foundation (http://www.apache.org/)." 00026 * Alternately, this acknowledgment may appear in the software itself, 00027 00028 00029 * if and wherever such third-party acknowledgments normally appear. 00030 * 00031 * 4. The names "SOAP" and "Apache Software Foundation" must 00032 * not be used to endorse or promote products derived from this 00033 * software without prior written permission. For written 00034 * permission, please contact apache@apache.org. 00035 * 00036 * 5. Products derived from this software may not be called "Apache", 00037 * nor may "Apache" appear in their name, without prior written 00038 * permission of the Apache Software Foundation. 00039 * 00040 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 00041 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00042 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00043 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR 00044 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00045 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00046 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 00047 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00048 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00049 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00050 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00051 * SUCH DAMAGE. 00052 * ==================================================================== 00053 * 00054 * This software consists of voluntary contributions made by many 00055 * individuals on behalf of the Apache Software Foundation. For more 00056 * information on the Apache Software Foundation, please see 00057 * <http://www.apache.org/>. 00058 * 00059 * 00060 * 00061 * 00062 * @author Susantha Kumara (skumara@virtusa.com) 00063 * 00064 */ 00065 // Variable.h: interface for the Variable class. 00066 // 00068 #ifdef WIN32 00069 #pragma warning (disable : 4786) 00070 #endif 00071 00072 #if !defined(AFX_VARIABLE_H__F9272406_BB8F_4151_8346_E033DDDDA468__INCLUDED_) 00073 #define AFX_VARIABLE_H__F9272406_BB8F_4151_8346_E033DDDDA468__INCLUDED_ 00074 00075 #include "File.h" 00076 00077 #include <string> 00078 #include <list> 00079 #include <map> 00080 00081 using namespace std; 00082 00083 enum VARTYPE { VAR_UNKNOWN=0, VAR_INT=1, VAR_FLOAT, VAR_STRING, VAR_LONG, VAR_SHORT, \ 00084 VAR_CHAR, VAR_DOUBLE, VAR_BOOL, VAR_UNSIGNEDLONG, VAR_UNSIGNEDINT,\ 00085 VAR_UNSIGNEDSHORT, VAR_UNSIGNED_CHAR, VAR_USER}; 00086 enum WSDL_BINDINGS { SOAP_BINDING=1, HTTP_BINDING }; 00087 enum BINDING_STYLES { SOAP_RPC=1, SOAP_DOCUMENT, HTTP_GET, HTTP_POST}; 00088 enum WSDL_TRANSPORT { HTTP_TRANSPORT=1 }; 00089 00090 //Qualifiers 00091 const unsigned char Q_PRIVATE = 0x01; 00092 const unsigned char Q_PROTECTED = 0x02; 00093 const unsigned char Q_STATIC = 0x04; 00094 const unsigned char Q_CONST = 0x08; 00095 const unsigned char Q_VIRTUAL = 0x10; 00096 const unsigned char Q_REFTYPE = 0x20; 00097 const unsigned char Q_PTRTYPE = 0x40; 00098 const unsigned char Q_PTRPTRTYPE = 0x80; 00099 00100 class Variable 00101 { 00102 public: 00103 int GenerateWSDLPartInMessage(File& file, bool bInput); 00104 int GenerateWSDLSchema(File &file); 00105 static string& GetParamGetMethod(int nType); 00106 int GenerateDeserializerImpl(File& file); 00107 int GenerateSerializerImpl(File& file); 00108 string& GetTypeEnumStr(); 00109 string& GetCorrespondingUnionMemberName(); 00110 void Reset(); 00111 int GetType(); 00112 bool IsArrayType(); 00113 bool IsComplexType(); 00114 string& GetVarName(); 00115 string& GetTypeName(); 00116 void SetVarName(string& sVarName); 00117 void SetType(int nType, string sType=""); 00118 void SetQualification(unsigned char cQualifier); 00119 Variable(); 00120 Variable(Variable& Var); 00121 virtual ~Variable(); 00122 private: 00123 static string m_sAuxStr; 00124 void SetBasicTypeName(); 00125 int m_Type; 00126 string m_TypeName; //if m_Type is user type 00127 string m_VarName; 00128 list<int> m_ArrayIndexes; 00129 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 00130 }; 00131 00132 extern map<string, string> g_ClassNamespaces; 00133 00134 #endif // !defined(AFX_VARIABLE_H__F9272406_BB8F_4151_8346_E033DDDDA468__INCLUDED_)