00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _TYPESTABLEH
00022 #define _TYPESTABLEH
00023
00024 #include <string>
00025 #include <vector>
00026 #include <map>
00027 #include <sstream>
00028 #include "xmlpull/wsdlpull_export.h"
00029 #include "xmlpull/XmlUtils.h"
00030 #include "schemaparser/SimpleType.h"
00031 #include "schemaparser/ComplexType.h"
00032
00033 namespace Schema {
00034
00035 class WSDLPULL_EXPORT TypesTable
00036 {
00037 public:
00038
00039 TypesTable();
00040 ~TypesTable();
00041
00042
00043 void clean();
00044
00045
00046 int addType(XSDType * type);
00047 int addExtType(XSDType * type, int id);
00048
00049
00050 int getTypeId(const Qname & name, bool create = false);
00051 std::string getAtomicTypeName(Schema::Type t)const;
00052
00053
00054 int addExternalTypeId(const Qname & type, XSDType * pType);
00055 int getNumExtRefs()
00056 {
00057 return extRefs_.size();
00058 }
00059 Qname & getExtRefName(int index)
00060 {
00061 return extRefs_[index].qname;
00062 }
00063 int getExtRefType(int index)
00064 {
00065 return extRefs_[index].localTypeId;
00066 }
00067 void resolveForwardElementRefs(const std::string & name, Element & e);
00068 void resolveForwardAttributeRefs(const std::string & name, Attribute & a);
00069
00070
00071 int getCompleteXpath(int elemId, std::string & childName, int *xPath,
00072 int limits, int &offset);
00073
00074
00075 XSDType *getTypePtr(int id) const;
00076 int getNumTypes(void) const
00077 {
00078 return numTypes;
00079 }
00080 bool detectUndefinedTypes(void);
00081 void setTargetNamespace(std::string Uri)
00082 {
00083 m_tnsUri = Uri;
00084 }
00085 std::string getTargetNamespace(void)
00086 {
00087 return m_tnsUri;
00088 }
00089 void printUndefinedTypes(std::ostream & out);
00090
00091 #ifdef LOGGING
00092
00093 void printTypes(std::ostream & out);
00094 #endif
00095 private:
00096
00097 XSDType ** typesArray;
00098
00099
00100 std::map < std::string, int >Id;
00101
00102
00103 std::map < std::string, int >basicTypes;
00104 int currentId;
00105 int numTypes, nSize;
00106 std::string m_tnsUri;
00107
00108 typedef struct
00109 {
00110 int localTypeId;
00111 Qname qname;
00112 }extRefs;
00113 std::vector<extRefs> extRefs_;
00114 void ensureCapacity();
00115 };
00116 }
00117 #endif