00001 /* 00002 * Copyright 2003-2004 The Apache Software Foundation. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 /* 00018 * This software consists of voluntary contributions made by many 00019 * individuals on behalf of the Apache Software Foundation. For more 00020 * information on the Apache Software Foundation, please see 00021 * <http://www.apache.org/>. 00022 * 00023 * 00024 */ 00025 00026 #if !defined(AXIS_COMPLEXELEMENT_H__INCLUDED_) 00027 #define AXIS_COMPLEXELEMENT_H__INCLUDED_ 00028 00029 #ifdef WIN32 00030 #pragma warning (disable : 4786) 00031 #endif 00032 00033 #include <list> 00034 #include <axis/server/BasicNode.h> 00035 00036 using namespace std; 00037 /* 00038 * @class ComplexElement 00039 * @brief interface for the ComplexElement class. 00040 * 00041 * @author Roshan Weerasuriya (roshan@jkcs.slt.lk, roshan@opensource.lk) 00042 */ 00043 class ComplexElement : public BasicNode 00044 { 00045 public: 00046 ComplexElement(AxisChar* pachLocalName, AxisChar* pachPrefix, AxisChar* pachUri); 00047 /* 00048 * Returns the number of child elements of this ComplexElement. 00049 * @return The number of child elements of this ComplexElement. 00050 */ 00051 int getNoOfChildren(); 00052 const BasicNode* getChild(int iChildPosition) const; 00053 const BasicNode* getLastChild() const; 00054 const BasicNode* getFirstChild() const; 00055 NODE_TYPE getNodeType() const; 00056 int setURI(const AxisChar* pachURI); 00057 int addChild(BasicNode* pBasicNode); 00058 int setLocalName(const AxisChar* pachLocalName); 00059 int setPrefix(const AxisChar* pachPrefix); 00060 int serialize(SoapSerializer& pSZ); 00061 int serialize(SoapSerializer& pSZ, list<AxisChar*>& lstTmpNameSpaceStack); 00062 ComplexElement(); 00063 virtual ~ComplexElement(); 00064 00065 /* 00066 * This method is overridden to do nothing always because this is 00067 * a Complex Element. Instead of using this method, a user of a 00068 * ComplexElement must get the childeren of this ComplexElement and 00069 * has to traverse through the childrean in a appropriate manner 00070 * in order to set there values. 00071 * A user of a ComplexElement should not use this method. 00072 * @param 00073 * @return Always return fail (AXIS_FAIL). 00074 */ 00075 int setValue(const AxisChar* pachValue) {return AXIS_FAIL;} 00076 00077 /* 00078 * This method is overridden to return NULL always because this is 00079 * a Complex Element. Instead of using this method, a user of a 00080 * ComplexElement must get the childeren of this ComplexElement and 00081 * has to traverse through the childrean in a appropriate manner 00082 * in order to get there values. 00083 * A user of a ComplexElement should not use this method. 00084 * @param 00085 * @return Always return NULL to indicate unsuccessful. 00086 */ 00087 const AxisChar* getValue() const {return NULL;} 00088 00089 private: 00090 int iNoOfChildren; 00091 int serializeChildren(SoapSerializer& pSZ); 00092 int serializeChildren(SoapSerializer& pSZ, list<AxisChar*>& lstTmpNameSpaceStack); 00093 bool isSerializable(); 00094 list<BasicNode*> m_children; 00095 AxisChar* m_pachPrefix; 00096 AxisChar* m_pachLocalName; 00097 AxisChar* m_pachURI; 00098 }; 00099 00100 #endif