wsdlpull
1.23
Toggle main menu visibility
Loading...
Searching...
No Matches
src
schemaparser
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>
28
#include "
xmlpull/wsdlpull_export.h
"
29
#include "
xmlpull/XmlUtils.h
"
30
#include "
schemaparser/SimpleType.h
"
31
#include "
schemaparser/ComplexType.h
"
32
33
namespace
Schema
{
34
//List of all XSD types
35
class
WSDLPULL_EXPORT
TypesTable
36
{
37
public
:
38
39
TypesTable
();
40
~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);
55
int
getNumExtRefs
() {
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
/* */
ComplexType.h
SimpleType.h
XmlUtils.h
Qname
Definition
Qname.h:31
Schema::Attribute
Definition
Attribute.h:28
Schema::Element
Definition
Element.h:31
Schema::TypesTable::TypesTable
TypesTable()
Definition
TypesTable.cpp:29
Schema::TypesTable::getCompleteXpath
int getCompleteXpath(int elemId, std::string &childName, int *xPath, int limits, int &offset)
Schema::TypesTable::getAtomicTypeName
std::string getAtomicTypeName(Schema::Type t) const
Definition
TypesTable.cpp:73
Schema::TypesTable::getNumTypes
int getNumTypes(void) const
Definition
TypesTable.h:77
Schema::TypesTable::setTargetNamespace
void setTargetNamespace(std::string Uri)
Definition
TypesTable.h:82
Schema::TypesTable::getTargetNamespace
std::string getTargetNamespace(void)
Definition
TypesTable.h:86
Schema::TypesTable::addExtType
int addExtType(XSDType *type, int id)
Definition
TypesTable.cpp:215
Schema::TypesTable::getNumExtRefs
int getNumExtRefs()
Definition
TypesTable.h:55
Schema::TypesTable::clean
void clean()
Definition
TypesTable.cpp:89
Schema::TypesTable::getTypePtr
XSDType * getTypePtr(int id) const
Definition
TypesTable.cpp:350
Schema::TypesTable::getExtRefName
Qname & getExtRefName(int index)
Definition
TypesTable.h:59
Schema::TypesTable::addExternalTypeId
int addExternalTypeId(const Qname &type, const XSDType *pType)
Definition
TypesTable.cpp:196
Schema::TypesTable::getExtRefType
int getExtRefType(int index)
Definition
TypesTable.h:63
Schema::TypesTable::addType
int addType(XSDType *type)
Definition
TypesTable.cpp:103
Schema::TypesTable::getTypeId
int getTypeId(const Qname &name, bool create=false)
Definition
TypesTable.cpp:151
Schema::XSDType
Definition
XSDType.h:38
Schema
Definition
Annotation.h:27
Schema::Type
Type
Definition
Schema.h:60
wsdlpull_export.h
WSDLPULL_EXPORT
#define WSDLPULL_EXPORT
Definition
wsdlpull_export.h:30
Generated by
1.17.0