CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
xml_namespace_manager.h
1
2
3#pragma once
4
5#include <xml/xml_namespace_scope.h>
6#include <xml/ixml_namespace_resolver.h>
7#include <system/collections/ienumerable.h>
8#include <system/array.h>
9#include <cstdint>
10
11
13namespace System
14{
15namespace Collections
16{
17namespace Generic
18{
19template <typename, typename> class Dictionary;
20template <typename, typename> class IDictionary;
21template <typename> class IEnumerator;
22} // namespace Generic
23} // namespace Collections
24namespace Xml
25{
26class XmlNameTable;
27namespace Xsl
28{
29class XsltContext;
30} // namespace Xsl
31} // namespace Xml
32} // namespace System
34
35namespace System {
36
37namespace Xml {
38
43class ASPOSECPP_SHARED_CLASS XmlNamespaceManager : public IXmlNamespaceResolver, public Collections::Generic::IEnumerable<String>
44{
48
49 typedef ::System::BaseTypesInfo<BaseType, BaseType1> ThisTypeBaseTypesInfo;
50 ASPOSECPP_SHARED_RTTI_INFO_DECL();
51
52public:
53
56
57private:
59 friend class Xsl::XsltContext;
61
62private:
63
64 class NamespaceDeclaration : public System::Object
65 {
66 typedef NamespaceDeclaration ThisType;
68
69 typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
70 RTTI_INFO_DECL();
71
72 public:
73
74 String prefix;
75 String uri;
76 int32_t scopeId;
77 int32_t previousNsIndex;
78
79 void Set(const String& prefix, const String& uri, int32_t scopeId, int32_t previousNsIndex);
80
81 NamespaceDeclaration();
82
83 };
84
85
86public:
87
90 virtual ASPOSECPP_SHARED_API SharedPtr<XmlNameTable> get_NameTable();
93 virtual ASPOSECPP_SHARED_API String get_DefaultNamespace();
94
98 ASPOSECPP_SHARED_API XmlNamespaceManager(const SharedPtr<XmlNameTable>& nameTable);
99
101 virtual ASPOSECPP_SHARED_API void PushScope();
104 virtual ASPOSECPP_SHARED_API bool PopScope();
115 virtual ASPOSECPP_SHARED_API void AddNamespace(String prefix, String uri);
121 virtual ASPOSECPP_SHARED_API void RemoveNamespace(String prefix, String uri);
135 ASPOSECPP_SHARED_API String LookupNamespace(const String& prefix) override;
140 ASPOSECPP_SHARED_API String LookupPrefix(const String& uri) override;
144 virtual ASPOSECPP_SHARED_API bool HasNamespace(String prefix);
145
146protected:
147
150 MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(XmlNamespaceManager, CODEPORTING_ARGS());
151
152 bool GetNamespaceDeclaration(int32_t idx, String& prefix, String& uri);
154
155 virtual ASPOSECPP_SHARED_API ~XmlNamespaceManager();
156
158 #ifdef ASPOSE_GET_SHARED_MEMBERS
159 ASPOSECPP_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
160 #endif
162
163private:
164
166 int32_t _lastDecl;
167 SharedPtr<XmlNameTable> _nameTable;
168 int32_t _scopeId;
170 bool _useHashtable;
171 String _xml;
172 String _xmlNs;
173 static const int32_t MinDeclsCountForHashtable;
174
175 int32_t LookupNamespaceDecl(const String& prefix);
176
177};
178
179} // namespace Xml
180} // namespace System
181
182
Interface of object providing enumerator on contained elements.
Definition: ienumerable.h:25
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
Provides read-only access to a set of prefix and namespace mappings.
Definition: ixml_namespace_resolver.h:29
Resolves, adds, and removes namespaces to a collection and provides scope management for these namesp...
Definition: xml_namespace_manager.h:44
virtual void RemoveNamespace(String prefix, String uri)
Removes the given namespace for the given prefix.
SharedPtr< Collections::Generic::IEnumerator< String > > GetEnumerator() override
Returns an enumerator to use to iterate through the namespaces in the XmlNamespaceManager.
virtual String get_DefaultNamespace()
Returns the namespace URI for the default namespace.
virtual void PushScope()
Pushes a namespace scope onto the stack.
virtual bool HasNamespace(String prefix)
Returns a value indicating whether the supplied prefix has a namespace defined for the current pushed...
String LookupNamespace(const String &prefix) override
Returns the namespace URI for the specified prefix.
virtual void AddNamespace(String prefix, String uri)
Adds the given namespace to the collection.
XmlNamespaceManager(const SharedPtr< XmlNameTable > &nameTable)
Initializes a new instance of the XmlNamespaceManager class with the specified XmlNameTable.
SharedPtr< Collections::Generic::IDictionary< String, String > > GetNamespacesInScope(XmlNamespaceScope scope) override
Returns a collection of namespace names keyed by prefix which can be used to enumerate the namespaces...
virtual bool PopScope()
Pops a namespace scope off the stack.
virtual SharedPtr< XmlNameTable > get_NameTable()
Returns the XmlNameTable associated with this object.
String LookupPrefix(const String &uri) override
Finds the prefix declared for the given namespace URI.
Encapsulates the current execution context of the Extensible Stylesheet Language for Transformations ...
Definition: xslt_context.h:121
@ Xml
Serialize according to the XML 1.0 rules.
XmlNamespaceScope
Defines the namespace scope.
Definition: xml_namespace_scope.h:15
Definition: db_command.h:9