SchemaDebug.cpp

Go to the documentation of this file.
00001 /* 
00002  * wsdlpull - A C++ parser  for WSDL  (Web services description language)
00003  * Copyright (C) 2005-2007 Vivek Krishna
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Library General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Library General Public
00016  * License along with this library; if not, write to the Free
00017  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018  */
00019 
00020 #include "schemaparser/SchemaParser.h"
00021 
00022 #ifdef LOGGING
00023 using namespace std;
00024 namespace Schema {
00025 void SchemaParser::print(ostream & out) 
00026 {
00027   typesTable_.printTypes(out);
00028 }
00029 
00030 
00031 void TypesTable::printTypes(ostream & out)
00032 {
00033   out << numTypes << endl;
00034   for (int i = 0; i < numTypes; i++)
00035     {
00036       typesArray[i]->print(out);
00037       out << XmlUtils::blk;
00038     }
00039 }
00040 
00041 void
00042 ComplexType::print (ostream & out)
00043 {
00044   out << getName() << XmlUtils::dbsp << getTypeId() << XmlUtils::dbsp << isSimple () << endl;
00045   out << getContentModel() << XmlUtils::dbsp;
00046   if (getContentModel() == Schema::Simple)
00047     out << simpleContentTypeId_;
00048   out << endl;
00049 
00050   out << attList_.size()<< endl;
00051   list < Attribute >::iterator pAttr = attList_.begin ();
00052   while (pAttr != attList_.end ()){
00053     out << *pAttr;
00054     pAttr++;
00055   }
00056 
00057   if(getContentModel() != Schema::Simple && cm_ ){
00058 
00059     out << cm_->getNumParticles()<< endl;
00060     ContentModel::ContentsIterator cit_b=cm_->begin();
00061     ContentModel::ContentsIterator cit_e=cm_->end();
00062     ContentModel::ContentsIterator ci=cit_b;
00063   
00064     for (ci=cit_b;ci!=cit_e;ci++){
00065       if(ci->second==ContentModel::Particle){
00066         out<<*(ci->first.e);
00067       }
00068     }
00069   }
00070 }
00071 
00072 
00073 ostream & operator << (ostream & stream, Attribute & a)
00074 {
00075   stream << "@" << a.getName () << XmlUtils::dbsp << a.getType () << XmlUtils::dbsp << XmlUtils::dbsp;
00076   stream << a.isRequired () << XmlUtils::dbsp;
00077 
00078   if (!(a.defaultVal ()).empty ())
00079     {
00080       stream << 1 << XmlUtils::dbsp << a.defaultVal ();
00081     } else
00082       stream << 0 << XmlUtils::dbsp;
00083   if (!(a.fixedVal ()).empty ())
00084     {
00085       stream << 1 << XmlUtils::dbsp << a.fixedVal ();
00086     } else
00087       stream << 0 << XmlUtils::dbsp;
00088   stream << endl;
00089 
00090   return stream;
00091 
00092 }
00093 
00094 
00095 ostream & operator << (ostream & stream, Element & e)
00096 {
00097   stream << e.getName () << XmlUtils::dbsp << e.getType () << XmlUtils::dbsp << XmlUtils::dbsp;
00098   stream << e.getMin () << XmlUtils::dbsp << e.getMax () << XmlUtils::dbsp;
00099   if (!(e.defaultVal ()).empty ())
00100     {
00101       stream << 1 << XmlUtils::dbsp << e.defaultVal ();
00102     } else
00103       stream << 0 << XmlUtils::dbsp;
00104   if (!(e.fixedVal ()).empty ())
00105     {
00106       stream << 1 << XmlUtils::dbsp << e.fixedVal ();
00107     } else
00108       stream << 0 << XmlUtils::dbsp;
00109 
00110   stream << endl;
00111 
00112   return stream;
00113 }
00114 
00115 void
00116 SimpleType::print (ostream & out)
00117 {
00118 
00119   out << getName() << XmlUtils::dbsp << getTypeId() << XmlUtils::dbsp << isSimple () << endl;
00120   out << getBaseTypeId() << endl;
00121   out << getBaseDerivation() << XmlUtils::dbsp;
00122   out << facetId_.size() << endl;
00123   for (size_t j = 0; j < facetId_.size(); j++)
00124     {
00125       out << facetId_[j] << XmlUtils::dbsp;
00126       if (facetId_[j] == ENUM)
00127         {
00128           out << facetValue_.numEnums << XmlUtils::dbsp;
00129           for (list < string >::iterator pEnums = enumValues_.begin ();
00130                pEnums != enumValues_.end (); pEnums++)
00131             out << *pEnums << XmlUtils::dbsp;
00132         }
00133       out << endl;
00134     }
00135   out << endl;
00136   //TODO need to o/p other facets
00137 }
00138 }
00139 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by  doxygen 1.6.2