CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
infer.h
1
2
3#pragma once
4
5#include <system/object_ext.h>
6#include <system/enum.h>
7#include <system/array.h>
8#include <cstdint>
9
10
12namespace System
13{
14namespace Collections
15{
16namespace Generic
17{
18template <typename> class IEnumerable;
19} // namespace Generic
20} // namespace Collections
21namespace Xml
22{
23class NameTable;
24namespace Schema
25{
26class XmlSchema;
27class XmlSchemaAttribute;
28class XmlSchemaComplexType;
29class XmlSchemaElement;
30class XmlSchemaObject;
31class XmlSchemaObjectCollection;
32class XmlSchemaObjectTable;
33class XmlSchemaSet;
34class XmlSchemaSimpleContentExtension;
35class XmlSchemaType;
36} // namespace Schema
37class XmlNamespaceManager;
38class XmlQualifiedName;
39class XmlReader;
40} // namespace Xml
41} // namespace System
43
44namespace System {
45
46namespace Xml {
47
48namespace Schema {
49
55class ASPOSECPP_SHARED_CLASS XmlSchemaInference final : public System::Object
56{
59
60 typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
61 ASPOSECPP_SHARED_RTTI_INFO_DECL();
62
63public:
64
67
68public:
69
71 enum class InferenceOption
72 {
74 Restricted,
76 Relaxed
77 };
78
79
80public:
81
87 ASPOSECPP_SHARED_API void set_Occurrence(XmlSchemaInference::InferenceOption value);
94
96 ASPOSECPP_SHARED_API XmlSchemaInference();
97
104 ASPOSECPP_SHARED_API SharedPtr<XmlSchemaSet> InferSchema(const SharedPtr<XmlReader>& instanceDocument);
113 ASPOSECPP_SHARED_API SharedPtr<XmlSchemaSet> InferSchema(const SharedPtr<XmlReader>& instanceDocument, SharedPtr<XmlSchemaSet> schemas);
114
115protected:
116
118 static SharedPtr<XmlQualifiedName>& ST_boolean();
119 static SharedPtr<XmlQualifiedName>& ST_byte();
120 static SharedPtr<XmlQualifiedName>& ST_unsignedByte();
121 static SharedPtr<XmlQualifiedName>& ST_short();
122 static SharedPtr<XmlQualifiedName>& ST_unsignedShort();
123 static SharedPtr<XmlQualifiedName>& ST_int();
124 static SharedPtr<XmlQualifiedName>& ST_unsignedInt();
125 static SharedPtr<XmlQualifiedName>& ST_long();
126 static SharedPtr<XmlQualifiedName>& ST_unsignedLong();
127 static SharedPtr<XmlQualifiedName>& ST_integer();
128 static SharedPtr<XmlQualifiedName>& ST_decimal();
129 static SharedPtr<XmlQualifiedName>& ST_float();
130 static SharedPtr<XmlQualifiedName>& ST_double();
131 static SharedPtr<XmlQualifiedName>& ST_duration();
132 static SharedPtr<XmlQualifiedName>& ST_dateTime();
133 static SharedPtr<XmlQualifiedName>& ST_time();
134 static SharedPtr<XmlQualifiedName>& ST_date();
135 static SharedPtr<XmlQualifiedName>& ST_gYearMonth();
136 static SharedPtr<XmlQualifiedName>& ST_string();
137 static SharedPtr<XmlQualifiedName>& ST_anySimpleType();
138 static ArrayPtr<SharedPtr<XmlQualifiedName>>& SimpleTypes();
139
140 static const int16_t HC_ST_boolean;
141 static const int16_t HC_ST_byte;
142 static const int16_t HC_ST_unsignedByte;
143 static const int16_t HC_ST_short;
144 static const int16_t HC_ST_unsignedShort;
145 static const int16_t HC_ST_int;
146 static const int16_t HC_ST_unsignedInt;
147 static const int16_t HC_ST_long;
148 static const int16_t HC_ST_unsignedLong;
149 static const int16_t HC_ST_integer;
150 static const int16_t HC_ST_decimal;
151 static const int16_t HC_ST_float;
152 static const int16_t HC_ST_double;
153 static const int16_t HC_ST_duration;
154 static const int16_t HC_ST_dateTime;
155 static const int16_t HC_ST_time;
156 static const int16_t HC_ST_date;
157 static const int16_t HC_ST_gYearMonth;
158 static const int16_t HC_ST_string;
159 static const int16_t HC_ST_Count;
160 static const int32_t TF_boolean;
161 static const int32_t TF_byte;
162 static const int32_t TF_unsignedByte;
163 static const int32_t TF_short;
164 static const int32_t TF_unsignedShort;
165 static const int32_t TF_int;
166 static const int32_t TF_unsignedInt;
167 static const int32_t TF_long;
168 static const int32_t TF_unsignedLong;
169 static const int32_t TF_integer;
170 static const int32_t TF_decimal;
171 static const int32_t TF_float;
172 static const int32_t TF_double;
173 static const int32_t TF_duration;
174 static const int32_t TF_dateTime;
175 static const int32_t TF_time;
176 static const int32_t TF_date;
177 static const int32_t TF_gYearMonth;
178 static const int32_t TF_string;
179
180 SharedPtr<XmlSchemaSet> InferSchema1(const SharedPtr<XmlReader>& instanceDocument, const SharedPtr<XmlSchemaSet>& schemas);
181 void InferElement(SharedPtr<XmlSchemaElement> xse, bool bCreatingNewType, const SharedPtr<XmlSchema>& parentSchema);
182 SharedPtr<XmlSchemaElement> FindMatchingElement(bool bCreatingNewType, const SharedPtr<XmlReader>& xtr, const SharedPtr<XmlSchemaComplexType>& ct, int32_t& lastUsedSeqItem, bool& bParticleChanged, SharedPtr<XmlSchema> parentSchema, bool setMaxoccurs);
183 void ProcessAttributes(SharedPtr<XmlSchemaElement>& xse, const SharedPtr<XmlSchemaType>& effectiveSchemaType, bool bCreatingNewType, const SharedPtr<XmlSchema>& parentSchema);
185 SharedPtr<XmlSchemaElement> FindGlobalElement(const String& namespaceURI, const String& localName, SharedPtr<XmlSchema>& parentSchema);
186 SharedPtr<XmlSchemaElement> FindElement(const SharedPtr<XmlSchemaObjectCollection>& elements, const String& elementName);
187 SharedPtr<XmlSchemaAttribute> FindAttributeRef(const SharedPtr<Collections::Generic::IEnumerable<SharedPtr<XmlSchemaObject>>>& attributes, const String& attributeName, const String& nsURI);
188 SharedPtr<XmlSchemaElement> FindElementRef(const SharedPtr<XmlSchemaObjectCollection>& elements, const String& elementName, const String& nsURI);
189 void MakeExistingAttributesOptional(const SharedPtr<XmlSchemaComplexType>& ct, const SharedPtr<XmlSchemaObjectCollection>& attributesInInstance);
190 SharedPtr<XmlQualifiedName> RefineSimpleType(String s, int32_t& iTypeFlags);
191 static int32_t InferSimpleType(const String& s, bool& bNeedsRangeCheck);
192 static int32_t DateTime(const String& s, bool bDate, bool bTime);
193 void SetMinMaxOccurs(const SharedPtr<XmlSchemaElement>& el, bool setMaxOccurs);
194
195 #ifdef ASPOSE_GET_SHARED_MEMBERS
196 ASPOSECPP_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
197 #endif
199
200private:
201
202 SharedPtr<XmlSchema> _rootSchema;
203 SharedPtr<XmlSchemaSet> _schemaSet;
205 SharedPtr<NameTable> _nametable;
206 String _targetNamespace;
207 SharedPtr<XmlNamespaceManager> _namespaceManager;
210
211 SharedPtr<XmlSchemaAttribute> AddAttribute(const String& localName, const String& prefix, const String& childURI, const String& attrValue, bool bCreatingNewType, const SharedPtr<XmlSchema>& parentSchema, const SharedPtr<XmlSchemaObjectCollection>& addLocation, const SharedPtr<XmlSchemaObjectTable>& compiledAttributes);
212 SharedPtr<XmlSchema> CreateXmlSchema(const String& targetNS);
213 SharedPtr<XmlSchemaElement> AddElement(const String& localName, const String& prefix, String childURI, SharedPtr<XmlSchema> parentSchema, const SharedPtr<XmlSchemaObjectCollection>& addLocation, int32_t positionWithinCollection);
215 SharedPtr<XmlSchemaType> GetEffectiveSchemaType(const SharedPtr<XmlSchemaElement>& elem, bool bCreatingNewType);
216 void MoveAttributes(const SharedPtr<XmlSchemaSimpleContentExtension>& scExtension, const SharedPtr<XmlSchemaComplexType>& ct);
217 void MoveAttributes(const SharedPtr<XmlSchemaComplexType>& ct, const SharedPtr<XmlSchemaSimpleContentExtension>& simpleContentExtension, bool bCreatingNewType);
218 void SwitchUseToOptional(const SharedPtr<XmlSchemaObjectCollection>& attributes, const SharedPtr<XmlSchemaObjectCollection>& attributesInInstance);
219 SharedPtr<XmlSchemaElement> CreateNewElementforChoice(const SharedPtr<XmlSchemaElement>& copyElement);
220 static int32_t GetSchemaType(const SharedPtr<XmlQualifiedName>& qname);
221
222};
223
224} // namespace Schema
225} // namespace Xml
226} // namespace System
227
228template<>
229struct EnumMetaInfo<System::Xml::Schema::XmlSchemaInference::InferenceOption>
230{
231 static const ASPOSECPP_SHARED_API std::array<std::pair<System::Xml::Schema::XmlSchemaInference::InferenceOption, const char_t*>, 2>& values();
232};
233
234
235
Interface of object providing enumerator on contained elements.
Definition: ienumerable.h:25
Represents a specific date and time value on the time continuum. This type should be allocated on sta...
Definition: date_time.h:50
Base class that enables using methods available for System.Object class in C#. All non-trivial classe...
Definition: object.h:62
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
String class used across the library. Is a substitute for C# System.String when translating code....
Definition: string.h:122
Infers an XML Schema Definition Language (XSD) schema from an XML document. The XmlSchemaInference cl...
Definition: infer.h:56
SharedPtr< XmlSchemaSet > InferSchema(const SharedPtr< XmlReader > &instanceDocument, SharedPtr< XmlSchemaSet > schemas)
Infers an XML Schema Definition Language (XSD) schema from the XML document contained in the XmlReade...
void set_Occurrence(XmlSchemaInference::InferenceOption value)
Sets the XmlSchemaInference::InferenceOption value that affects schema occurrence declarations inferr...
XmlSchemaInference::InferenceOption get_TypeInference()
Returns the XmlSchemaInference::InferenceOption value that affects types inferred from the XML docume...
XmlSchemaInference()
Initializes a new instance of the XmlSchemaInference class.
SharedPtr< XmlSchemaSet > InferSchema(const SharedPtr< XmlReader > &instanceDocument)
Infers an XML Schema Definition Language (XSD) schema from the XML document contained in the XmlReade...
InferenceOption
Affects occurrence and type information inferred by the XmlSchemaInference class for elements and att...
Definition: infer.h:72
void set_TypeInference(XmlSchemaInference::InferenceOption value)
Sets the XmlSchemaInference::InferenceOption value that affects types inferred from the XML document.
XmlSchemaInference::InferenceOption get_Occurrence()
Returns the XmlSchemaInference::InferenceOption value that affects schema occurrence declarations inf...
@ Schema
Validate according to XML Schema definition language (XSD) schemas, including inline XML Schemas....
@ Xml
Serialize according to the XML 1.0 rules.
Definition: db_command.h:9