roshan      2003/07/15 00:09:02

  Modified:    c/src/soap ComplexElement.h ComplexElement.cpp
                        CharacterElement.h CharacterElement.cpp BasicNode.h
  Log:
  added code
  
  Revision  Changes    Path
  1.2       +4 -3      xml-axis/c/src/soap/ComplexElement.h
  
  Index: ComplexElement.h
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/soap/ComplexElement.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ComplexElement.h  27 Jun 2003 04:39:26 -0000      1.1
  +++ ComplexElement.h  15 Jul 2003 07:09:01 -0000      1.2
  @@ -82,15 +82,16 @@
   {
   public:
        int setURI(const string& sURI);
  -     int serialize(string& sSerialized);
  +     int serialize(SoapSerializer& pSZ);
        int addChild(BasicNode* pBasicNode);
        int setLocalName(const string& sLocalName);
        int setPrefix(const string& sPrefix);
        ComplexElement();
        virtual ~ComplexElement();
   
  -private:
  -     int serializeChildren(string& sSerialized);
  +private:     
  +     int serializeChildren(SoapSerializer& pSZ);
  +     //int serializeChildren(string& sSerialized);
        bool isSerializable();
        list<BasicNode*> m_children;
        string m_sPrefix;
  
  
  
  1.2       +63 -0     xml-axis/c/src/soap/ComplexElement.cpp
  
  Index: ComplexElement.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/soap/ComplexElement.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ComplexElement.cpp        27 Jun 2003 04:39:26 -0000      1.1
  +++ ComplexElement.cpp        15 Jul 2003 07:09:01 -0000      1.2
  @@ -66,6 +66,7 @@
   //////////////////////////////////////////////////////////////////////
   
   #include "ComplexElement.h"
  +#include "SoapSerializer.h"
   #include "../common/GDefine.h"
   
   //////////////////////////////////////////////////////////////////////
  @@ -103,6 +104,51 @@
        return SUCCESS;
   }
   
  +int ComplexElement::serialize(SoapSerializer& pSZ)
  +{
  +     int iStatus= SUCCESS;
  +
  +     do {
  +             if(isSerializable()) {
  +                     
  +                     pSZ << "<";
  +                     
  +                     if(m_sPrefix.length() != 0) {                           
  +                             pSZ<< m_sPrefix.c_str() << ":";
  +                     }
  +                     
  +                     pSZ<< m_sLocalName.c_str();
  +
  +                     if((m_sPrefix.length() != 0) && (m_sURI.length() != 0)) {
  +                             pSZ<< " xmlns:" << m_sPrefix.c_str() << "=\"" << 
m_sURI.c_str() << "\"";
  +                     }
  +                     
  +                     pSZ<< ">";
  +
  +                     iStatus= serializeChildren(pSZ);
  +                     if(iStatus==FAIL) {
  +                             break;
  +                     }
  +                     
  +                     pSZ<< "</";
  +
  +                     if(m_sPrefix.length() != 0) {                           
  +                             pSZ<< m_sPrefix.c_str() << ":";
  +                     }
  +                     
  +                     pSZ<< m_sLocalName.c_str() << ">";
  +
  +                     iStatus= SUCCESS;
  +             } else {
  +                     iStatus= FAIL;
  +             }
  +     } while(0);
  +                     
  +     return iStatus;
  +}
  +
  +/*
  +comm on 10/7/2003 6.20pm
   int ComplexElement::serialize(string &sSerialized)
   {
        int iStatus= SUCCESS;
  @@ -145,6 +191,7 @@
                        
        return iStatus;
   }
  +*/
   
   bool ComplexElement::isSerializable()
   {
  @@ -174,6 +221,21 @@
        return SUCCESS;
   }
   
  +int ComplexElement::serializeChildren(SoapSerializer& pSZ)
  +{
  +
  +     list<BasicNode*>::iterator itCurrBasicNode= m_children.begin();
  +
  +     while(itCurrBasicNode != m_children.end()) {            
  +             (*itCurrBasicNode)->serialize(pSZ);
  +             itCurrBasicNode++;              
  +     }       
  +
  +     return SUCCESS;
  +}
  +
  +/*
  +comm on 10/7/2003 6.20pm
   int ComplexElement::serializeChildren(string &sSerialized)
   {
   
  @@ -186,3 +248,4 @@
   
        return SUCCESS;
   }
  +*/
  \ No newline at end of file
  
  
  
  1.2       +1 -1      xml-axis/c/src/soap/CharacterElement.h
  
  Index: CharacterElement.h
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/soap/CharacterElement.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CharacterElement.h        27 Jun 2003 04:46:03 -0000      1.1
  +++ CharacterElement.h        15 Jul 2003 07:09:01 -0000      1.2
  @@ -77,7 +77,7 @@
   class CharacterElement : public BasicNode
   {
   public:
  -     int serialize(string& sSerialized);
  +     int serialize(SoapSerializer& pSZ);
        NODE_TYPE getNodeType();
        CharacterElement(const string& sValue);
        virtual ~CharacterElement();
  
  
  
  1.2       +13 -0     xml-axis/c/src/soap/CharacterElement.cpp
  
  Index: CharacterElement.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/soap/CharacterElement.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CharacterElement.cpp      27 Jun 2003 04:46:03 -0000      1.1
  +++ CharacterElement.cpp      15 Jul 2003 07:09:01 -0000      1.2
  @@ -66,6 +66,7 @@
   //////////////////////////////////////////////////////////////////////
   
   #include "CharacterElement.h"
  +#include "SoapSerializer.h"
   #include "../common/GDefine.h"
   
   //////////////////////////////////////////////////////////////////////
  @@ -88,6 +89,17 @@
        return m_iNodeType;
   }
   
  +int CharacterElement::serialize(SoapSerializer& pSZ)
  +{
  +
  +     //the serialization code should come here       
  +     pSZ<< m_sValue.c_str();
  +     
  +     return SUCCESS;
  +}
  +
  +/*
  +comm on 10/7/2003 6.10pm
   int CharacterElement::serialize(string &sSerialized)
   {
   
  @@ -96,3 +108,4 @@
        
        return SUCCESS;
   }
  +*/
  
  
  
  1.2       +3 -1      xml-axis/c/src/soap/BasicNode.h
  
  Index: BasicNode.h
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/soap/BasicNode.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BasicNode.h       27 Jun 2003 04:47:21 -0000      1.1
  +++ BasicNode.h       15 Jul 2003 07:09:01 -0000      1.2
  @@ -74,6 +74,8 @@
   
   #include <string>
   
  +class SoapSerializer;
  +
   using namespace std;
   
   enum NODE_TYPE { ELEMENT_NODE=1, CHARACTER_NODE};
  @@ -81,7 +83,7 @@
   class BasicNode
   {
   public:
  -     virtual int serialize(string&) =0;
  +     virtual int serialize(SoapSerializer& pSZ) =0;
        BasicNode();
        virtual ~BasicNode();
   
  
  
  

Reply via email to