CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
xml_schema_collection.h
1
2
3#pragma once
4
5#include <xml/schema/validation_event_handler.h>
6#include <system/exceptions.h>
7#include <system/collections/keyvalue_pair.h>
8#include <system/collections/ienumerator.h>
9#include <system/collections/ienumerable.h>
10#include <system/array.h>
11#include <cstdint>
12
13
15namespace System
16{
17namespace Collections
18{
19namespace Generic
20{
21template <typename, typename> class Dictionary;
22} // namespace Generic
23} // namespace Collections
24namespace Xml
25{
26namespace Schema
27{
28class AutoValidator;
29class BaseValidator;
30class SchemaInfo;
31class SchemaNames;
32class XdrValidator;
33class XmlSchema;
34class XmlSchemaCollectionNode;
35class Details_XmlSchemaException; using XmlSchemaException = System::ExceptionWrapper<Details_XmlSchemaException>;
36class XsdValidator;
37} // namespace Schema
38class XmlNameTable;
39class XmlReader;
40class XmlResolver;
41class XmlValidatingReaderImpl;
42} // namespace Xml
43} // namespace System
45
46namespace System {
47
48namespace Xml {
49
50namespace Schema {
51
57class ASPOSECPP_SHARED_CLASS XmlSchemaCollection final : public Collections::Generic::IEnumerable<SharedPtr<System::Xml::Schema::XmlSchema>>
58{
61
62 typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
63 ASPOSECPP_SHARED_RTTI_INFO_DECL();
64
65public:
66
69
70private:
72 friend class System::Xml::XmlValidatingReaderImpl;
73 friend class BaseValidator;
74 friend class XdrValidator;
75 friend class XsdValidator;
77
78public:
79
82
85 ASPOSECPP_SHARED_API int32_t get_Count();
88 ASPOSECPP_SHARED_API SharedPtr<XmlNameTable> get_NameTable();
89
91 ASPOSECPP_SHARED_API XmlSchemaCollection();
95 ASPOSECPP_SHARED_API XmlSchemaCollection(const SharedPtr<XmlNameTable>& nametable);
96
104 ASPOSECPP_SHARED_API SharedPtr<XmlSchema> Add(const String& ns, const String& uri);
112 ASPOSECPP_SHARED_API SharedPtr<XmlSchema> Add(const String& ns, const SharedPtr<XmlReader>& reader);
124 ASPOSECPP_SHARED_API SharedPtr<XmlSchema> Add(const String& ns, const SharedPtr<XmlReader>& reader, const SharedPtr<System::Xml::XmlResolver>& resolver);
128 ASPOSECPP_SHARED_API SharedPtr<XmlSchema> Add(const SharedPtr<XmlSchema>& schema);
135 ASPOSECPP_SHARED_API SharedPtr<XmlSchema> Add(const SharedPtr<XmlSchema>& schema, const SharedPtr<System::Xml::XmlResolver>& resolver);
138 ASPOSECPP_SHARED_API void Add(const SharedPtr<XmlSchemaCollection>& schema);
139
146 ASPOSECPP_SHARED_API SharedPtr<XmlSchema> idx_get(const String& ns);
147
151 ASPOSECPP_SHARED_API bool Contains(const SharedPtr<XmlSchema>& schema);
156 ASPOSECPP_SHARED_API bool Contains(const String& ns);
163 ASPOSECPP_SHARED_API void CopyTo(const ArrayPtr<SharedPtr<XmlSchema>>& array, int32_t index);
164
165protected:
166
168 void set_XmlResolver(const SharedPtr<System::Xml::XmlResolver>& value);
170 void set_EventHandler(System::Xml::Schema::ValidationEventHandler value);
171
172 SharedPtr<SchemaInfo> GetSchemaInfo(const String& ns);
173 SharedPtr<SchemaNames> GetSchemaNames(const SharedPtr<XmlNameTable>& nt);
174 SharedPtr<XmlSchema> Add(const String& ns, const SharedPtr<SchemaInfo>& schemaInfo, const SharedPtr<XmlSchema>& schema, bool compile);
176
177 virtual ASPOSECPP_SHARED_API ~XmlSchemaCollection();
178
180 #ifdef ASPOSE_GET_SHARED_MEMBERS
181 ASPOSECPP_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
182 #endif
184
185private:
186
188 SharedPtr<XmlNameTable> _nameTable;
189 SharedPtr<SchemaNames> _schemaNames;
190 SharedPtr<Object> _wLock;
191 bool _isThreadSafe;
193
194 SharedPtr<XmlSchema> Add(String ns, const SharedPtr<SchemaInfo>& schemaInfo, const SharedPtr<XmlSchema>& schema, bool compile, const SharedPtr<System::Xml::XmlResolver>& resolver);
195 void AddNonThreadSafe(const String& ns, const SharedPtr<XmlSchemaCollectionNode>& node);
196 void Add(const String& ns, const SharedPtr<XmlSchemaCollectionNode>& node);
197 void SendValidationEvent(XmlSchemaException e);
198
199};
200
205class ASPOSECPP_SHARED_CLASS XmlSchemaCollectionEnumerator final : public Collections::Generic::IEnumerator<SharedPtr<System::Xml::Schema::XmlSchema>>
206{
209
210 typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
211 ASPOSECPP_SHARED_RTTI_INFO_DECL();
212
213public:
214
217
218private:
220 friend class AutoValidator;
221 friend class XmlSchemaCollection;
223
224public:
225
228 ASPOSECPP_SHARED_API const SharedPtr<XmlSchema>& get_Current() const override;
229
232 ASPOSECPP_SHARED_API bool MoveNext() override;
233 ASPOSECPP_SHARED_API void Dispose() override;
234
237 ASPOSECPP_SHARED_API System::Details::VirtualizedIteratorBase<SharedPtr<System::Xml::Schema::XmlSchema>>* CloneIterator() const override;
238
239protected:
240
242 SharedPtr<XmlSchemaCollectionNode> get_CurrentNode();
243
245 MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(XmlSchemaCollectionEnumerator, CODEPORTING_ARGS(SharedPtr<Collections::Generic::Dictionary<String, SharedPtr<XmlSchemaCollectionNode>>> collection));
246
247 #ifdef ASPOSE_GET_SHARED_MEMBERS
248 ASPOSECPP_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
249 #endif
251
252private:
253
255 mutable SharedPtr<XmlSchema> m_CurrentHolder;
256
257 ASPOSECPP_SHARED_API void Reset() override;
258
259};
260
261} // namespace Schema
262} // namespace Xml
263} // namespace System
264
265
Forward declaration of Dictionary class.
Definition: dictionary.h:96
Interface of object providing enumerator on contained elements.
Definition: ienumerable.h:25
Interface of enumerator which can be used to iterate through some elements. Objects of this class sho...
Definition: ienumerator.h:63
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
Supports a simple iteration over a collection. This class cannot be inherited.
Definition: xml_schema_collection.h:206
bool MoveNext() override
Advances the enumerator to the next schema in the collection.
const SharedPtr< XmlSchema > & get_Current() const override
Returns the current XmlSchema in the collection.
System::Details::VirtualizedIteratorBase< SharedPtr< System::Xml::Schema::XmlSchema > > * CloneIterator() const override
Clones current iterator.
Contains a cache of XML Schema definition language (XSD) and XML-Data Reduced (XDR) schemas.
Definition: xml_schema_collection.h:58
SharedPtr< XmlSchema > Add(const String &ns, const String &uri)
Adds the schema located by the given URL into the schema collection.
void Add(const SharedPtr< XmlSchemaCollection > &schema)
Adds all the namespaces defined in the given collection (including their associated schemas) to this ...
void CopyTo(const ArrayPtr< SharedPtr< XmlSchema > > &array, int32_t index)
Copies all the XmlSchema objects from this collection into the given array starting at the given inde...
SharedPtr< XmlSchema > Add(const SharedPtr< XmlSchema > &schema, const SharedPtr< System::Xml::XmlResolver > &resolver)
Adds the XmlSchema to the collection. The specified XmlResolver is used to resolve any external refer...
SharedPtr< XmlNameTable > get_NameTable()
Returns the default XmlNameTable used by the XmlSchemaCollection when loading new schemas.
bool Contains(const SharedPtr< XmlSchema > &schema)
Returns a value indicating whether the targetNamespace of the specified XmlSchema is in the collectio...
int32_t get_Count()
Returns the number of namespaces defined in this collection.
System::Xml::Schema::ValidationEventHandler ValidationEventHandler
Sets an event handler for receiving information about the XDR and XML schema validation errors.
Definition: xml_schema_collection.h:81
SharedPtr< XmlSchema > idx_get(const String &ns)
Returns the XmlSchema associated with the given namespace URI.
SharedPtr< XmlSchema > Add(const SharedPtr< XmlSchema > &schema)
Adds the XmlSchema to the collection.
bool Contains(const String &ns)
Returns a value indicating whether a schema with the specified namespace is in the collection.
XmlSchemaCollection()
Initializes a new instance of the XmlSchemaCollection class.
SharedPtr< Collections::Generic::IEnumerator< SharedPtr< XmlSchema > > > GetEnumerator() override
Provides support for iteration over the collection of schemas.
XmlSchemaCollection(const SharedPtr< XmlNameTable > &nametable)
Initializes a new instance of the XmlSchemaCollection class with the specified XmlNameTable....
SharedPtr< XmlSchema > Add(const String &ns, const SharedPtr< XmlReader > &reader)
Adds the schema contained in the XmlReader to the schema collection.
SharedPtr< XmlSchema > Add(const String &ns, const SharedPtr< XmlReader > &reader, const SharedPtr< System::Xml::XmlResolver > &resolver)
Adds the schema contained in the XmlReader to the schema collection. The specified XmlResolver is use...
System::ExceptionWrapper< Details_XmlSchemaException > XmlSchemaException
Definition: xml_schema_exception.h:76
System::MulticastDelegate< void(SharedPtr< Object >, SharedPtr< ValidationEventArgs >)> ValidationEventHandler
Represents the callback method that will handle XML schema validation events and the ValidationEventA...
Definition: validation_event_handler.h:33
@ 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