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
183
184 #ifdef __DBG_FOR_EACH_MEMBER
185public:
188 ASPOSECPP_SHARED_API void DBG_for_each_member(DBG::for_each_member_visitor& visitor) const override;
191 const char* DBG_class_name() const override { return "XmlSchemaCollection"; }
192#endif
194
195private:
196
198 SharedPtr<XmlNameTable> _nameTable;
199 SharedPtr<SchemaNames> _schemaNames;
200 SharedPtr<Object> _wLock;
201 bool _isThreadSafe;
203
204 SharedPtr<XmlSchema> Add(String ns, const SharedPtr<SchemaInfo>& schemaInfo, const SharedPtr<XmlSchema>& schema, bool compile, const SharedPtr<System::Xml::XmlResolver>& resolver);
205 void AddNonThreadSafe(const String& ns, const SharedPtr<XmlSchemaCollectionNode>& node);
206 void Add(const String& ns, const SharedPtr<XmlSchemaCollectionNode>& node);
207 void SendValidationEvent(XmlSchemaException e);
208
209};
210
215class ASPOSECPP_SHARED_CLASS XmlSchemaCollectionEnumerator final : public Collections::Generic::IEnumerator<SharedPtr<System::Xml::Schema::XmlSchema>>
216{
219
220 typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
221 ASPOSECPP_SHARED_RTTI_INFO_DECL();
222
223public:
224
227
228private:
230 friend class AutoValidator;
231 friend class XmlSchemaCollection;
233
234public:
235
238 ASPOSECPP_SHARED_API const SharedPtr<XmlSchema>& get_Current() const override;
239
242 ASPOSECPP_SHARED_API bool MoveNext() override;
243 ASPOSECPP_SHARED_API void Dispose() override;
244
247 ASPOSECPP_SHARED_API System::Details::VirtualizedIteratorBase<SharedPtr<System::Xml::Schema::XmlSchema>>* CloneIterator() const override;
248
249protected:
250
252 SharedPtr<XmlSchemaCollectionNode> get_CurrentNode();
253
255 MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(XmlSchemaCollectionEnumerator, CODEPORTING_ARGS(SharedPtr<Collections::Generic::Dictionary<String, SharedPtr<XmlSchemaCollectionNode>>> collection));
256
257 #ifdef ASPOSE_GET_SHARED_MEMBERS
258 ASPOSECPP_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
259 #endif
260
261 #ifdef __DBG_FOR_EACH_MEMBER
262public:
265 ASPOSECPP_SHARED_API void DBG_for_each_member(DBG::for_each_member_visitor& visitor) const override;
268 const char* DBG_class_name() const override { return "XmlSchemaCollectionEnumerator"; }
269#endif
271
272private:
273
275 mutable SharedPtr<XmlSchema> m_CurrentHolder;
276
277 ASPOSECPP_SHARED_API void Reset() override;
278
279};
280
281} // namespace Schema
282} // namespace Xml
283} // namespace System
284
285
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:216
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