CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
xml_node_reader.h
1
2
3#pragma once
4
5#include <xml/xml_space.h>
6#include <xml/xml_reader.h>
7#include <xml/xml_node_type.h>
8#include <xml/read_state.h>
9#include <xml/ixml_namespace_resolver.h>
10#include <system/array.h>
11#include <cstdint>
12
13
15namespace System
16{
17namespace Collections
18{
19namespace Generic
20{
21template <typename, typename> class IDictionary;
22} // namespace Generic
23} // namespace Collections
24namespace Xml
25{
26class IDtdInfo;
27class ReadContentAsBinaryHelper;
28namespace Schema
29{
30class IXmlSchemaInfo;
31} // namespace Schema
32enum class XmlNamespaceScope;
33class XmlNameTable;
34class XmlNode;
35class XmlNodeReaderNavigator;
36} // namespace Xml
37} // namespace System
39
40namespace System {
41
42namespace Xml {
43
48class ASPOSECPP_SHARED_CLASS XmlNodeReader : public XmlReader, public IXmlNamespaceResolver
49{
50 typedef XmlNodeReader ThisType;
51 typedef XmlReader BaseType;
53
54 typedef ::System::BaseTypesInfo<BaseType, BaseType1> ThisTypeBaseTypesInfo;
55 ASPOSECPP_SHARED_RTTI_INFO_DECL();
56
57public:
58
61
62public:
63
66 ASPOSECPP_SHARED_API XmlNodeType get_NodeType() override;
82 ASPOSECPP_SHARED_API String get_Name() override;
87 ASPOSECPP_SHARED_API String get_LocalName() override;
90 ASPOSECPP_SHARED_API String get_NamespaceURI() override;
93 ASPOSECPP_SHARED_API String get_Prefix() override;
96 ASPOSECPP_SHARED_API bool get_HasValue() override;
113 ASPOSECPP_SHARED_API String get_Value() override;
116 ASPOSECPP_SHARED_API int32_t get_Depth() override;
119 ASPOSECPP_SHARED_API String get_BaseURI() override;
123 ASPOSECPP_SHARED_API bool get_CanResolveEntity() override;
127 ASPOSECPP_SHARED_API bool get_IsEmptyElement() override;
132 ASPOSECPP_SHARED_API bool get_IsDefault() override;
135 ASPOSECPP_SHARED_API System::Xml::XmlSpace get_XmlSpace() override;
138 ASPOSECPP_SHARED_API String get_XmlLang() override;
141 ASPOSECPP_SHARED_API SharedPtr<Schema::IXmlSchemaInfo> get_SchemaInfo() override;
144 ASPOSECPP_SHARED_API int32_t get_AttributeCount() override;
147 ASPOSECPP_SHARED_API bool get_EOF() override;
150 ASPOSECPP_SHARED_API System::Xml::ReadState get_ReadState() override;
153 ASPOSECPP_SHARED_API bool get_HasAttributes() override;
156 ASPOSECPP_SHARED_API SharedPtr<XmlNameTable> get_NameTable() override;
160 ASPOSECPP_SHARED_API bool get_CanReadBinaryContent() override;
161
164 ASPOSECPP_SHARED_API XmlNodeReader(const SharedPtr<XmlNode>& node);
165
169 ASPOSECPP_SHARED_API String GetAttribute(String name) override;
174 ASPOSECPP_SHARED_API String GetAttribute(String name, String namespaceURI) override;
180 ASPOSECPP_SHARED_API String GetAttribute(int32_t attributeIndex) override;
185 ASPOSECPP_SHARED_API bool MoveToAttribute(String name) override;
191 ASPOSECPP_SHARED_API bool MoveToAttribute(String name, String namespaceURI) override;
196 ASPOSECPP_SHARED_API void MoveToAttribute(int32_t attributeIndex) override;
200 ASPOSECPP_SHARED_API bool MoveToFirstAttribute() override;
203 ASPOSECPP_SHARED_API bool MoveToNextAttribute() override;
207 ASPOSECPP_SHARED_API bool MoveToElement() override;
210 ASPOSECPP_SHARED_API bool Read() override;
212 ASPOSECPP_SHARED_API void Close() override;
214 ASPOSECPP_SHARED_API void Skip() override;
220 ASPOSECPP_SHARED_API String ReadString() override;
225 ASPOSECPP_SHARED_API String LookupNamespace(const String& prefix) override;
228 ASPOSECPP_SHARED_API void ResolveEntity() override;
234 ASPOSECPP_SHARED_API bool ReadAttributeValue() override;
244 ASPOSECPP_SHARED_API int32_t ReadContentAsBase64(ArrayPtr<uint8_t> buffer, int32_t index, int32_t count) override;
254 ASPOSECPP_SHARED_API int32_t ReadContentAsBinHex(ArrayPtr<uint8_t> buffer, int32_t index, int32_t count) override;
266 ASPOSECPP_SHARED_API int32_t ReadElementContentAsBase64(ArrayPtr<uint8_t> buffer, int32_t index, int32_t count) override;
278 ASPOSECPP_SHARED_API int32_t ReadElementContentAsBinHex(ArrayPtr<uint8_t> buffer, int32_t index, int32_t count) override;
279
280protected:
281
283 ASPOSECPP_SHARED_API SharedPtr<IDtdInfo> get_DtdInfo() override;
284
285 bool IsInReadingStates();
287
288 virtual ASPOSECPP_SHARED_API ~XmlNodeReader();
289
291 #ifdef ASPOSE_GET_SHARED_MEMBERS
292 ASPOSECPP_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
293 #endif
295
296private:
297
299 XmlNodeType _nodeType;
300 int32_t _curDepth;
301 System::Xml::ReadState _readState;
302 bool _fEOF;
303 bool _bResolveEntity;
304 bool _bStartFromDocument;
305 bool _bInReadBinary;
306 SharedPtr<ReadContentAsBinaryHelper> _readBinaryHelper;
307
308 bool Read(bool fSkipChildren);
309 bool ReadNextNode(bool fSkipChildren);
310 void SetEndOfFile();
311 bool ReadAtZeroLevel(bool fSkipChildren);
312 bool ReadForward(bool fSkipChildren);
313 void ReSetReadingMarks();
314 void FinishReadBinary();
315 ASPOSECPP_SHARED_API SharedPtr<Collections::Generic::IDictionary<String, String>> GetNamespacesInScope(XmlNamespaceScope scope) override;
316 ASPOSECPP_SHARED_API String LookupPrefix(const String& namespaceName) override;
317
318};
319
320} // namespace Xml
321} // namespace System
322
323
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
Represents a reader that provides fast, non-cached forward only access to XML data in an XmlNode.
Definition: xml_node_reader.h:49
int32_t ReadElementContentAsBase64(ArrayPtr< uint8_t > buffer, int32_t index, int32_t count) override
Reads the element and decodes the Base64 content.
int32_t ReadElementContentAsBinHex(ArrayPtr< uint8_t > buffer, int32_t index, int32_t count) override
Reads the element and decodes the BinHex content.
void Close() override
Changes the XmlNodeReader::get_ReadState to ReadState::Closed.
int32_t ReadContentAsBase64(ArrayPtr< uint8_t > buffer, int32_t index, int32_t count) override
Reads the content and returns the Base64 decoded binary bytes.
String ReadString() override
Reads the contents of an element or text node as a string.
String get_NamespaceURI() override
Returns the namespace URI (as defined in the W3C Namespace specification) of the node on which the re...
String get_Value() override
Returns the text value of the current node.
bool get_CanResolveEntity() override
Returns a value indicating whether this reader can parse and resolve entities.
String get_BaseURI() override
Returns the base URI of the current node.
String get_Prefix() override
Returns the namespace prefix associated with the current node.
int32_t get_AttributeCount() override
Returns the number of attributes on the current node.
SharedPtr< XmlNameTable > get_NameTable() override
Returns the XmlNameTable associated with this implementation.
bool get_EOF() override
Returns a value indicating whether the reader is positioned at the end of the stream.
bool get_IsEmptyElement() override
Returns a value indicating whether the current node is an empty element (for example,...
bool MoveToNextAttribute() override
Moves to the next attribute.
bool get_CanReadBinaryContent() override
Returns a value indicating whether the XmlNodeReader implements the binary content read methods.
System::Xml::ReadState get_ReadState() override
Returns the state of the reader.
XmlNodeType get_NodeType() override
Returns the type of the current node.
SharedPtr< Schema::IXmlSchemaInfo > get_SchemaInfo() override
Returns the schema information that has been assigned to the current node.
int32_t ReadContentAsBinHex(ArrayPtr< uint8_t > buffer, int32_t index, int32_t count) override
Reads the content and returns the BinHex decoded binary bytes.
void ResolveEntity() override
Resolves the entity reference for EntityReference nodes.
bool get_IsDefault() override
Returns a value indicating whether the current node is an attribute that was generated from the defau...
bool MoveToAttribute(String name) override
Moves to the attribute with the specified name.
int32_t get_Depth() override
Returns the depth of the current node in the XML document.
bool MoveToAttribute(String name, String namespaceURI) override
Moves to the attribute with the specified local name and namespace URI.
void Skip() override
Skips the children of the current node.
bool MoveToElement() override
Moves to the element that contains the current attribute node.
bool get_HasValue() override
Returns a value indicating whether the current node can have a XmlNodeReader::get_Value value.
bool get_HasAttributes() override
Returns a value indicating whether the current node has any attributes.
String get_LocalName() override
Returns the local name of the current node.
String GetAttribute(String name) override
Returns the value of the attribute with the specified name.
void MoveToAttribute(int32_t attributeIndex) override
Moves to the attribute with the specified index.
System::Xml::XmlSpace get_XmlSpace() override
Returns the current xml:space scope.
XmlNodeReader(const SharedPtr< XmlNode > &node)
Creates an instance of the XmlNodeReader class using the specified XmlNode.
String GetAttribute(int32_t attributeIndex) override
Returns the value of the attribute with the specified index.
bool MoveToFirstAttribute() override
Moves to the first attribute.
String GetAttribute(String name, String namespaceURI) override
Returns the value of the attribute with the specified local name and namespace URI.
String get_Name() override
Returns the qualified name of the current node.
bool ReadAttributeValue() override
Parses the attribute value into one or more Text, EntityReference, or EndEntity nodes.
bool Read() override
Reads the next node from the stream.
String get_XmlLang() override
Returns the current xml:lang scope.
String LookupNamespace(const String &prefix) override
Resolves a namespace prefix in the current element's scope.
Represents a reader that provides fast, noncached, forward-only access to XML data.
Definition: xml_reader.h:73
XmlSpace
Specifies the current xml:space scope.
Definition: xml_space.h:15
@ Schema
Validate according to XML Schema definition language (XSD) schemas, including inline XML Schemas....
@ Xml
Serialize according to the XML 1.0 rules.
ReadState
Specifies the state of the reader.
Definition: read_state.h:15
XmlNodeType
Specifies the type of node.
Definition: xml_node_type.h:15
XmlNamespaceScope
Defines the namespace scope.
Definition: xml_namespace_scope.h:15
Definition: db_command.h:9