wsdlpull  1.23
SchemaDebug.cpp
Go to the documentation of this file.
1 /*
2  * wsdlpull - A C++ parser for WSDL (Web services description language)
3  * Copyright (C) 2005-2007 Vivek Krishna
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the Free
17  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19 
21 
22 #ifdef LOGGING
23 using namespace std;
24 namespace Schema {
25 void SchemaParser::print(ostream & out)
26 {
27  typesTable_.printTypes(out);
28 }
29 
30 
31 void TypesTable::printTypes(ostream & out)
32 {
33  out << numTypes << endl;
34  for (int i = 0; i < numTypes; i++)
35  {
36  typesArray[i]->print(out);
37  out << XmlUtils::blk;
38  }
39 }
40 
41 void
42 ComplexType::print (ostream & out)
43 {
44  out << getName() << XmlUtils::dbsp << getTypeId() << XmlUtils::dbsp << isSimple () << endl;
45  out << getContentModel() << XmlUtils::dbsp;
46  if (getContentModel() == Schema::Simple)
47  out << simpleContentTypeId_;
48  out << endl;
49 
50  out << attList_.size()<< endl;
51  list < Attribute >::iterator pAttr = attList_.begin ();
52  while (pAttr != attList_.end ()){
53  out << *pAttr;
54  pAttr++;
55  }
56 
57  if(getContentModel() != Schema::Simple && cm_ ){
58 
59  out << cm_->getNumParticles()<< endl;
60  ContentModel::ContentsIterator cit_b=cm_->begin();
61  ContentModel::ContentsIterator cit_e=cm_->end();
62  ContentModel::ContentsIterator ci=cit_b;
63 
64  for (ci=cit_b;ci!=cit_e;ci++){
65  if(ci->second==ContentModel::Particle){
66  out<<*(ci->first.e);
67  }
68  }
69  }
70 }
71 
72 
73 ostream & operator << (ostream & stream, Attribute & a)
74 {
75  stream << "@" << a.getName () << XmlUtils::dbsp << a.getType () << XmlUtils::dbsp << XmlUtils::dbsp;
76  stream << a.isRequired () << XmlUtils::dbsp;
77 
78  if (!(a.defaultVal ()).empty ())
79  {
80  stream << 1 << XmlUtils::dbsp << a.defaultVal ();
81  } else
82  stream << 0 << XmlUtils::dbsp;
83  if (!(a.fixedVal ()).empty ())
84  {
85  stream << 1 << XmlUtils::dbsp << a.fixedVal ();
86  } else
87  stream << 0 << XmlUtils::dbsp;
88  stream << endl;
89 
90  return stream;
91 
92 }
93 
94 
95 ostream & operator << (ostream & stream, Element & e)
96 {
97  stream << e.getName () << XmlUtils::dbsp << e.getType () << XmlUtils::dbsp << XmlUtils::dbsp;
98  stream << e.getMin () << XmlUtils::dbsp << e.getMax () << XmlUtils::dbsp;
99  if (!(e.defaultVal ()).empty ())
100  {
101  stream << 1 << XmlUtils::dbsp << e.defaultVal ();
102  } else
103  stream << 0 << XmlUtils::dbsp;
104  if (!(e.fixedVal ()).empty ())
105  {
106  stream << 1 << XmlUtils::dbsp << e.fixedVal ();
107  } else
108  stream << 0 << XmlUtils::dbsp;
109 
110  stream << endl;
111 
112  return stream;
113 }
114 
115 void
116 SimpleType::print (ostream & out)
117 {
118 
119  out << getName() << XmlUtils::dbsp << getTypeId() << XmlUtils::dbsp << isSimple () << endl;
120  out << getBaseTypeId() << endl;
121  out << getBaseDerivation() << XmlUtils::dbsp;
122  out << facetId_.size() << endl;
123  for (size_t j = 0; j < facetId_.size(); j++)
124  {
125  out << facetId_[j] << XmlUtils::dbsp;
126  if (facetId_[j] == ENUM)
127  {
128  out << facetValue_.numEnums << XmlUtils::dbsp;
129  for (list < string >::iterator pEnums = enumValues_.begin ();
130  pEnums != enumValues_.end (); pEnums++)
131  out << *pEnums << XmlUtils::dbsp;
132  }
133  out << endl;
134  }
135  out << endl;
136  //TODO need to o/p other facets
137 }
138 }
139 #endif
std::ostream & blk(std::ostream &str)
Definition: XmlUtils.cpp:97
std::ostream & operator<<(std::ostream &os, TypeContainer &tc)
std::ostream & dbsp(std::ostream &str)
Definition: XmlUtils.cpp:90