wsdlpull 1.23
Loading...
Searching...
No Matches
TypesTable.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 */
21#ifndef _TYPESTABLEH
22#define _TYPESTABLEH
23
24#include <string>
25#include <vector>
26#include <map>
27#include <sstream>
29#include "xmlpull/XmlUtils.h"
32
33namespace Schema {
34//List of all XSD types
36{
37 public:
38
39 TypesTable();
41
42 //Realease all the memory
43 void clean();
44
45 //add a new type and returns its id
46 int addType(XSDType * type);
47 int addExtType(XSDType * type, int id);
48
49 //get the type id of a type
50 int getTypeId(const Qname & name, bool create = false);
51 std::string getAtomicTypeName(Schema::Type t)const;
52
53 //store an external reference to another schema
54 int addExternalTypeId(const Qname & type, const XSDType * pType);
56 return extRefs_.size();
57 }
58
59 Qname & getExtRefName(int index) {
60 return extRefs_[index].qname;
61 }
62
63 int getExtRefType(int index){
64
65 return extRefs_[index].localTypeId;
66 }
67
68 void resolveForwardElementRefs(const std::string & name, Element & e);
69 void resolveForwardAttributeRefs(const std::string & name, Attribute & a);
70
71 //get the path to the descendant element
72 int getCompleteXpath(int elemId, std::string & childName, int *xPath,
73 int limits, int &offset);
74
75 //returns the pointer to a type whose id is given
76 XSDType *getTypePtr(int id) const;
77 int getNumTypes(void) const
78 {
79 return numTypes;
80 }
81 bool detectUndefinedTypes(void);
82 void setTargetNamespace(std::string Uri)
83 {
84 m_tnsUri = Uri;
85 }
86 std::string getTargetNamespace(void)
87 {
88 return m_tnsUri;
89 }
90 void printUndefinedTypes(std::ostream & out);
91
92#ifdef LOGGING
93 //for logging purposes
94 void printTypes(std::ostream & out);
95#endif
96 private:
97 //contains a pointer to the actual type
98 XSDType ** typesArray;
99
100 //maintains a std::map of all user defined type names and their ids
101 std::map < std::string, int >Id;
102
103 //This is a std::map of all types defined in XML Schema
104 std::map < std::string, int >basicTypes;
105 int currentId;
106 int numTypes, nSize;
107 std::string m_tnsUri;
108
109 typedef struct
110 {
111 int localTypeId;
112 Qname qname;
113 }extRefs;
114 std::vector<extRefs> extRefs_;
115 void ensureCapacity();
116};
117}
118#endif /* */
Definition Qname.h:31
int getCompleteXpath(int elemId, std::string &childName, int *xPath, int limits, int &offset)
int getNumTypes(void) const
Definition TypesTable.h:77
void setTargetNamespace(std::string Uri)
Definition TypesTable.h:82
std::string getTargetNamespace(void)
Definition TypesTable.h:86
Qname & getExtRefName(int index)
Definition TypesTable.h:59
int getExtRefType(int index)
Definition TypesTable.h:63
#define WSDLPULL_EXPORT