CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
xml_exception.h
1
2
3#pragma once
4
5#include <system/exceptions.h>
6#include <system/array.h>
7#include <cstdint>
8
9
11namespace System
12{
13namespace Xml
14{
15class Base64Decoder;
16class BinHexDecoder;
17class BinXmlDateTime;
18class BinXmlSqlDecimal;
19class DocumentXmlWriter;
20class DtdParser;
21class HWStack;
22class IXmlLineInfo;
23class QueryOutputWriter;
24class ReadContentAsBinaryHelper;
25namespace Schema
26{
27class BaseValidator;
28class DtdValidator;
29class Preprocessor;
30class SchemaCollectionPreprocessor;
31class XdrBuilder;
32class XdrValidator;
33class XsdValidator;
34} // namespace Schema
35class Ucs4Decoder1234;
36class Ucs4Decoder2143;
37class Ucs4Decoder3412;
38class Ucs4Decoder4321;
39class ValidateNames;
40class XmlCharCheckingReader;
41class XmlCharCheckingWriter;
42class XmlConvert;
43class XmlDocument;
44class XmlEncodedRawTextWriter;
45class XmlLoader;
46class XmlNullResolver;
47class XmlParserContext;
48class XmlQualifiedName;
49class XmlReader;
50class XmlReaderSettings;
51class XmlSqlBinaryReader;
52class XmlSubtreeReader;
53class XmlSystemPathResolver;
54class XmlTextReaderImpl;
55class XmlUrlResolver;
56class XmlUtf8RawTextWriter;
57class XmlValidatingReaderImpl;
58class XmlWellFormedWriter;
59class XmlWriter;
60class XmlWriterSettings;
61class XsdValidatingReader;
62namespace Xsl
63{
64namespace XsltOld
65{
66class XsltCompileContext;
67} // namespace XsltOld
68} // namespace Xsl
69} // namespace Xml
70} // namespace System
72
73namespace System {
74
75namespace Xml {
76
77class Details_XmlException;
79
81class ASPOSECPP_SHARED_CLASS Details_XmlException : public Details_SystemException
82{
85
86 typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
87 ASPOSECPP_SHARED_RTTI_INFO_DECL();
88
89public:
90
93
94private:
96 friend class Base64Decoder;
97 friend class BinXmlSqlDecimal;
98 friend class BinXmlDateTime;
99 friend class XmlSqlBinaryReader;
100 friend class XmlReader;
101 friend class XmlSqlBinaryReader;
102 friend class BinHexDecoder;
103 friend class XmlEncodedRawTextWriter;
104 friend class XmlUtf8RawTextWriter;
105 friend class QueryOutputWriter;
106 friend class XmlWriter;
107 friend class ReadContentAsBinaryHelper;
108 friend class XmlCharCheckingReader;
109 friend class XmlCharCheckingWriter;
110 friend class XmlParserContext;
111 friend class XmlReaderSettings;
112 friend class XmlSubtreeReader;
113 friend class XmlTextReaderImpl;
114 friend class XmlTextReaderImpl;
115 friend class XmlValidatingReaderImpl;
116 friend class XmlWellFormedWriter;
117 friend class XmlWriterSettings;
118 friend class XsdValidatingReader;
119 friend class DocumentXmlWriter;
120 friend class XmlDocument;
121 friend class XmlLoader;
122 friend class HWStack;
123 friend class XmlSystemPathResolver;
124 friend class Schema::BaseValidator;
125 friend class DtdParser;
126 friend class Schema::DtdValidator;
127 friend class Schema::Preprocessor;
128 friend class Schema::SchemaCollectionPreprocessor;
129 friend class Schema::XdrBuilder;
130 friend class Schema::XdrValidator;
131 friend class Schema::XsdValidator;
132 friend class ValidateNames;
133 friend class XmlConvert;
134 friend class Ucs4Decoder4321;
135 friend class Ucs4Decoder1234;
136 friend class Ucs4Decoder2143;
137 friend class Ucs4Decoder3412;
138 friend class XmlNullResolver;
139 friend class XmlQualifiedName;
140 friend class XmlUrlResolver;
141 friend class Xsl::XsltOld::XsltCompileContext;
142 friend class System::ExceptionWrapperHelper;
143 template <typename T> friend class System::ExceptionWrapper;
145
146public:
147
150 ASPOSECPP_SHARED_API int32_t get_LineNumber();
153 ASPOSECPP_SHARED_API int32_t get_LinePosition();
156 ASPOSECPP_SHARED_API String get_SourceUri();
159 ASPOSECPP_SHARED_API String get_Message() const override;
160
161protected:
162
164 [[noreturn]] void DoThrow(const System::ExceptionPtr& self) const override;
165
167 String get_ResString();
169
171 ASPOSECPP_SHARED_API Details_XmlException();
172 ASPOSECPP_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_XmlException, CODEPORTING_ARGS());
173
176 ASPOSECPP_SHARED_API Details_XmlException(const String& message);
177 ASPOSECPP_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_XmlException, CODEPORTING_ARGS(String message));
178
182 ASPOSECPP_SHARED_API Details_XmlException(const String& message, Exception innerException);
183 ASPOSECPP_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_XmlException, CODEPORTING_ARGS(String message, Exception innerException));
184
190 ASPOSECPP_SHARED_API Details_XmlException(const String& message, Exception innerException, int32_t lineNumber, int32_t linePosition);
191 ASPOSECPP_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_XmlException, CODEPORTING_ARGS(String message, Exception innerException, int32_t lineNumber, int32_t linePosition));
192
194 Details_XmlException(const String& message, Exception innerException, int32_t lineNumber, int32_t linePosition, const String& sourceUri);
195 MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_XmlException, CODEPORTING_ARGS(String message, Exception innerException, int32_t lineNumber, int32_t linePosition, String sourceUri));
196
197 Details_XmlException(const String& res, const ArrayPtr<String>& args);
198 MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_XmlException, CODEPORTING_ARGS(String res, ArrayPtr<String> args));
199
200 Details_XmlException(const String& res, const String& arg);
201 MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_XmlException, CODEPORTING_ARGS(String res, String arg));
202
203 Details_XmlException(const String& res, const String& arg, const String& sourceUri);
204 MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_XmlException, CODEPORTING_ARGS(String res, String arg, String sourceUri));
205
206 Details_XmlException(const String& res, const String& arg, const SharedPtr<IXmlLineInfo>& lineInfo);
207 MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_XmlException, CODEPORTING_ARGS(String res, String arg, SharedPtr<IXmlLineInfo> lineInfo));
208
209 Details_XmlException(const String& res, const String& arg, Exception innerException, const SharedPtr<IXmlLineInfo>& lineInfo);
210 MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_XmlException, CODEPORTING_ARGS(String res, String arg, Exception innerException, SharedPtr<IXmlLineInfo> lineInfo));
211
212 Details_XmlException(const String& res, const ArrayPtr<String>& args, const SharedPtr<IXmlLineInfo>& lineInfo);
213 MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_XmlException, CODEPORTING_ARGS(String res, ArrayPtr<String> args, SharedPtr<IXmlLineInfo> lineInfo));
214
215 Details_XmlException(const String& res, const ArrayPtr<String>& args, const SharedPtr<IXmlLineInfo>& lineInfo, const String& sourceUri);
216 MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_XmlException, CODEPORTING_ARGS(String res, ArrayPtr<String> args, SharedPtr<IXmlLineInfo> lineInfo, String sourceUri));
217
218 Details_XmlException(const String& res, const String& arg, int32_t lineNumber, int32_t linePosition);
219 MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_XmlException, CODEPORTING_ARGS(String res, String arg, int32_t lineNumber, int32_t linePosition));
220
221 Details_XmlException(const String& res, const String& arg, int32_t lineNumber, int32_t linePosition, const String& sourceUri);
222 MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_XmlException, CODEPORTING_ARGS(String res, String arg, int32_t lineNumber, int32_t linePosition, String sourceUri));
223
224 Details_XmlException(const String& res, const ArrayPtr<String>& args, int32_t lineNumber, int32_t linePosition);
225 MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_XmlException, CODEPORTING_ARGS(String res, ArrayPtr<String> args, int32_t lineNumber, int32_t linePosition));
226
227 Details_XmlException(const String& res, const ArrayPtr<String>& args, int32_t lineNumber, int32_t linePosition, const String& sourceUri);
228 MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_XmlException, CODEPORTING_ARGS(String res, ArrayPtr<String> args, int32_t lineNumber, int32_t linePosition, String sourceUri));
229
230 Details_XmlException(const String& res, const ArrayPtr<String>& args, Exception innerException, int32_t lineNumber, int32_t linePosition);
231 MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_XmlException, CODEPORTING_ARGS(String res, ArrayPtr<String> args, Exception innerException, int32_t lineNumber, int32_t linePosition));
232
233 Details_XmlException(const String& res, const ArrayPtr<String>& args, Exception innerException, int32_t lineNumber, int32_t linePosition, const String& sourceUri);
234 MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_XmlException, CODEPORTING_ARGS(String res, ArrayPtr<String> args, Exception innerException, int32_t lineNumber, int32_t linePosition, String sourceUri));
235
236 static ArrayPtr<String> BuildCharExceptionArgs(const String& data, int32_t invCharIndex);
237 static ArrayPtr<String> BuildCharExceptionArgs(const ArrayPtr<char16_t>& data, int32_t length, int32_t invCharIndex);
238 static ArrayPtr<String> BuildCharExceptionArgs(char16_t invChar, char16_t nextChar);
239 static bool IsCatchableException(Exception e);
240
241 #ifdef ASPOSE_GET_SHARED_MEMBERS
242 ASPOSECPP_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
243 #endif
245
246private:
247
248 String _res;
249 ArrayPtr<String> _args;
250 int32_t _lineNumber;
251 int32_t _linePosition;
252 String _sourceUri;
253 String _message;
254
255 static String FormatUserMessage(const String& message, int32_t lineNumber, int32_t linePosition);
256 static String CreateMessage(const String& res, const ArrayPtr<String>& args, int32_t lineNumber, int32_t linePosition);
257
258};
259
260} // namespace Xml
261} // namespace System
262
263
A base class for classes that represent system (rather than application) exceptions....
Template that represents wrapper of exceptions that are derived from Exception class.
Definition: exception.h:113
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
Returns detailed information about the last exception.
Definition: xml_exception.h:82
void DoThrow(const System::ExceptionPtr &self) const override
Throws exception instance wrapped by exception wrapper.
Details_XmlException(const String &message, Exception innerException, int32_t lineNumber, int32_t linePosition)
Initializes a new instance of the XmlException class with the specified message, inner exception,...
Details_XmlException(const String &message)
Initializes a new instance of the XmlException class with a specified error message.
int32_t get_LineNumber()
Returns the line number indicating where the error occurred. Line numbers start at 1.
Details_XmlException(const String &message, Exception innerException)
Initializes a new instance of the XmlException class.
MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_XmlException, CODEPORTING_ARGS())
String get_SourceUri()
Returns the location of the XML file.
MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_XmlException, CODEPORTING_ARGS(String message))
MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_XmlException, CODEPORTING_ARGS(String message, Exception innerException))
String get_Message() const override
Returns a message describing the current exception.
Details_XmlException()
Initializes a new instance of the XmlException class.
MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_XmlException, CODEPORTING_ARGS(String message, Exception innerException, int32_t lineNumber, int32_t linePosition))
int32_t get_LinePosition()
Returns the line position indicating where the error occurred. Line position starts at 1.
Encodes and decodes XML names, and provides methods for converting between runtime types and XML Sche...
Definition: xml_convert.h:141
Represents an XML document. You can use this class to load, validate, edit, add, and position XML in ...
Definition: xml_document.h:100
Provides all the context information required by the XmlReader to parse an XML fragment.
Definition: xml_parser_context.h:34
Represents an XML qualified name.
Definition: xml_qualified_name.h:55
Represents a reader that provides fast, noncached, forward-only access to XML data.
Definition: xml_reader.h:73
Specifies a set of features to support on the XmlReader object created by the XmlReader::Create metho...
Definition: xml_reader_settings.h:57
Resolves external XML resources named by a Uniform Resource Identifier (URI).
Definition: xml_url_resolver.h:40
Represents a writer that provides a fast, non-cached, forward-only way to generate streams or files t...
Definition: xml_writer.h:45
Specifies a set of features to support on the XmlWriter object created by the XmlWriter::Create metho...
Definition: xml_writer_settings.h:85
@ 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