CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
aggregate_exception.h
1
7#pragma once
8
9#include <system/exception.h>
10#include <system/func.h>
11
12namespace System {
13namespace Collections { namespace ObjectModel {
14template<typename>
15class ReadOnlyCollection;
16}}
17
21
27class ASPOSECPP_SHARED_CLASS Details_AggregateException : public Details_Exception
28{
31
32 typedef BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
33 RTTI_INFO_DECL();
34
35 friend class ExceptionWrapperHelper;
36 template <typename T>
37 friend class ExceptionWrapper;
38
39public:
45 ASPOSECPP_SHARED_API String get_Message() const override;
48 ASPOSECPP_SHARED_API int32_t get_InnerExceptionCount();
51 const ArrayPtr<Exception>& get_InternalInnerExceptions() { return _innerExceptions; }
52
55 ASPOSECPP_SHARED_API Exception GetBaseException() const override;
60 ASPOSECPP_SHARED_API void Handle(const Func<Exception, bool>& predicate);
63 ASPOSECPP_SHARED_API AggregateException Flatten();
66 ASPOSECPP_SHARED_API String ToString() const override;
67
68protected:
72 [[noreturn]] ASPOSECPP_SHARED_API void DoThrow(const ExceptionPtr& self) const override;
73
75 ASPOSECPP_SHARED_API Details_AggregateException();
77
80 ASPOSECPP_SHARED_API Details_AggregateException(const String& message);
81 ASPOSECPP_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_AggregateException, CODEPORTING_ARGS(const String& message));
82
86 ASPOSECPP_SHARED_API Details_AggregateException(const String& message, Exception innerException);
87 ASPOSECPP_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_AggregateException, CODEPORTING_ARGS(const String& message,
88 const Exception& innerException));
89
94 CODEPORTING_ARGS(const SharedPtr<Collections::Generic::IEnumerable<Exception>>& innerExceptions));
95
98 ASPOSECPP_SHARED_API Details_AggregateException(const ArrayPtr<Exception>& innerExceptions);
100 CODEPORTING_ARGS(const ArrayPtr<Exception>& innerExceptions));
101
105 ASPOSECPP_SHARED_API Details_AggregateException(const String& message,
107 ASPOSECPP_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_AggregateException, CODEPORTING_ARGS(const String& message,
109
113 ASPOSECPP_SHARED_API Details_AggregateException(const String& message, const ArrayPtr<Exception>& innerExceptions);
114 ASPOSECPP_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_AggregateException, CODEPORTING_ARGS(const String& message,
115 const ArrayPtr<Exception>& innerExceptions));
116
122 ASPOSECPP_SHARED_API Details_AggregateException(const String& message, const ArrayPtr<Exception>& innerExceptions, bool cloneExceptions);
124 CODEPORTING_ARGS(const String& message, const ArrayPtr<Exception>& innerExceptions, bool cloneExceptions));
125
127 ASPOSECPP_SHARED_API virtual ~Details_AggregateException();
128
129#ifdef ASPOSE_GET_SHARED_MEMBERS
130 ASPOSECPP_SHARED_API void GetSharedMembers(Object::shared_members_type& result) const override;
131#endif
132
133private:
134 ArrayPtr<Exception> _innerExceptions;
136
139 ASPOSECPP_SHARED_API String ToString_NonConst();
140};
141
142} // namespace System
Interface of object providing enumerator on contained elements.
Definition: ienumerable.h:25
Represents an exception that contains multiple inner exceptions.
Definition: aggregate_exception.h:28
Details_AggregateException(const String &message, const SharedPtr< Collections::Generic::IEnumerable< Exception > > &innerExceptions)
Constructs an aggregate exception with a message and a collection of inner exceptions.
MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_AggregateException, CODEPORTING_ARGS())
Exception GetBaseException() const override
Returns the root cause exception by recursively unwrapping inner exceptions.
Details_AggregateException(const String &message, Exception innerException)
Constructs an aggregate exception with a message and a single inner exception.
SharedPtr< Collections::ObjectModel::ReadOnlyCollection< Exception > > get_InnerExceptions()
Gets a read-only collection of the inner exceptions.
const ArrayPtr< Exception > & get_InternalInnerExceptions()
Returns the internal array of inner exceptions.
Definition: aggregate_exception.h:51
String get_Message() const override
Overrides the base message to include aggregated information from all inner exceptions.
Details_AggregateException(const String &message, const ArrayPtr< Exception > &innerExceptions, bool cloneExceptions)
Constructs an aggregate exception with options to clone inner exceptions.
MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_AggregateException, CODEPORTING_ARGS(const ArrayPtr< Exception > &innerExceptions))
MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_AggregateException, CODEPORTING_ARGS(const String &message, const ArrayPtr< Exception > &innerExceptions, bool cloneExceptions))
MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_AggregateException, CODEPORTING_ARGS(const String &message, const Exception &innerException))
int32_t get_InnerExceptionCount()
Gets the number of inner exceptions contained in this aggregate exception.
Details_AggregateException(const String &message)
Constructs an aggregate exception with a custom message.
virtual ~Details_AggregateException()
Virtual destructor.
Details_AggregateException(const ArrayPtr< Exception > &innerExceptions)
Constructs an aggregate exception from an array of inner exceptions.
MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_AggregateException, CODEPORTING_ARGS(const String &message, const SharedPtr< Collections::Generic::IEnumerable< Exception > > &innerExceptions))
void DoThrow(const ExceptionPtr &self) const override
Throws this exception instance.
MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_AggregateException, CODEPORTING_ARGS(const SharedPtr< Collections::Generic::IEnumerable< Exception > > &innerExceptions))
MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_AggregateException, CODEPORTING_ARGS(const String &message, const ArrayPtr< Exception > &innerExceptions))
MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_AggregateException, CODEPORTING_ARGS(const String &message))
AggregateException Flatten()
Flattens the aggregate exception by unwrapping all nested AggregateExceptions into a single-level lis...
Details_AggregateException(const String &message, const ArrayPtr< Exception > &innerExceptions)
Constructs an aggregate exception with a message and an array of inner exceptions.
String ToString() const override
Returns a string representation of the exception, including all inner exceptions.
Details_AggregateException()
Default constructor.
Details_AggregateException(const SharedPtr< Collections::Generic::IEnumerable< Exception > > &innerExceptions)
Constructs an aggregate exception from a collection of inner exceptions.
void Handle(const Func< Exception, bool > &predicate)
Invokes a handler function on each inner exception and rethrows any unhandled exceptions.
Represents an exception. Never create instances of this class manually. Use the Exception class inste...
Definition: exception.h:277
Template that represents wrapper of exceptions that are derived from Exception class.
Definition: exception.h:113
Function delegate. This type should be allocated on stack and passed to functions by value or by refe...
Definition: func.h:82
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
Definition: db_command.h:9