wsdlpull  1.23
ContentModel.h
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 
20 #ifndef _CONTENTMODELH
21 #define _CONTENTMODELH
22 
23 #include <list>
24 #include <utility>
26 #include "xmlpull/Qname.h"
27 #include "xmlpull/XmlUtils.h"
28 #include "schemaparser/Schema.h"
30 
31 namespace Schema {
32 
33 class Group;
34 class Element;
35 
37 {
38 public:
39 
40  typedef union
41  {
43  Group * g;
45  }ContentType;
46 
47  typedef enum {
50  Container
52 
53  typedef std::pair<ContentType,ContentDiscriminator> ContentHolder;
54  typedef std::list<ContentHolder> Contents;
55  typedef std::list<ContentHolder>::iterator ContentsIterator;
56 
57 
59  ~ContentModel();
60  Schema::Compositor getCompositor()const;
61  ContentsIterator begin();
62  ContentsIterator end();
63  void addElement(const Element & e);
64  void addGroup(const Group & e ,bool own=false);
65  void addContentModel(const ContentModel* c);
66  void setMin(const int & m);
67  void setMax(const int & m);
68  int getMin()const;
69  int getMax()const;
70  int getNumParticles()const;
71  bool anyContents()const;
72  void matchforwardRef(const std::string &name,Element &e);
73 
74 private:
75  Schema::Compositor m_compositor;
76  Contents contents_;
77  int minOccurs,maxOccurs;
78  int nParticles;
79  bool anyContent_;
80 };
81 
82 inline
85 {
86  return m_compositor;
87 }
88 
89 inline
92 {
93  return contents_.begin();
94 }
95 
96 inline
99 {
100  return contents_.end();
101 }
102 
103 
104 inline
105 int
107 {
108  return minOccurs;
109 
110 }
111 
112 inline
113 int
115 {
116  return maxOccurs;
117 
118 }
119 
120 inline
121 void
122 ContentModel::setMin(const int & m)
123 {
124  minOccurs=m;
125 
126 }
127 
128 inline
129 void
130 ContentModel::setMax(const int & m)
131 {
132  maxOccurs=m;
133 
134 }
135 
136 inline
137 int
139 {
140  return nParticles;
141 }
142 
143 inline
144 bool
146 {
147  return anyContent_;
148 }
149 }
150 #endif /* */
std::pair< ContentType, ContentDiscriminator > ContentHolder
Definition: ContentModel.h:53
bool anyContents() const
Definition: ContentModel.h:145
int getNumParticles() const
Definition: ContentModel.h:138
void setMax(const int &m)
Definition: ContentModel.h:130
std::list< ContentHolder > Contents
Definition: ContentModel.h:54
Compositor
Definition: Schema.h:32
void setMin(const int &m)
Definition: ContentModel.h:122
ContentsIterator begin()
Definition: ContentModel.h:91
#define WSDLPULL_EXPORT
std::list< ContentHolder >::iterator ContentsIterator
Definition: ContentModel.h:55
ContentsIterator end()
Definition: ContentModel.h:98
Schema::Compositor getCompositor() const
Definition: ContentModel.h:84