CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
events.h
1#ifndef _aspose_zip_events_h_
2#define _aspose_zip_events_h_
3
4#include <system/string.h>
5#include <system/shared_ptr.h>
6#include <system/exceptions.h>
7#include <system/eventargs.h>
8#include <functional>
9
10namespace Aspose { namespace Zip {
11
12class ZipEntry;
13class ZipFile;
14
15typedef std::function<bool(int64_t, int64_t, System::String)> ReReadApprovalCallback;
16typedef std::function<bool(System::String, System::String)> WantCompressionCallback;
17
20
21enum class ZipProgressEventType
22{
23 Adding_Started,
24 Adding_AfterAddEntry,
25 Adding_Completed,
26 Reading_Started,
27 Reading_BeforeReadEntry,
28 Reading_AfterReadEntry,
29 Reading_Completed,
30 Reading_ArchiveBytesRead,
31 Saving_Started,
32 Saving_BeforeWriteEntry,
33 Saving_AfterWriteEntry,
34 Saving_Completed,
35 Saving_AfterSaveTempArchive,
36 Saving_BeforeRenameTempArchive,
37 Saving_AfterRenameTempArchive,
38 Saving_AfterCompileSelfExtractor,
39 Saving_EntryBytesRead,
40 Extracting_BeforeExtractEntry,
41 Extracting_AfterExtractEntry,
42 Extracting_ExtractEntryWouldOverwrite,
43 Extracting_EntryBytesWritten,
44 Extracting_BeforeExtractAll,
45 Extracting_AfterExtractAll,
46 Error_Saving
47};
48
51
52class ASPOSECPP_SHARED_CLASS ZipProgressEventArgs : public System::EventArgs
53{
54 typedef ZipProgressEventArgs ThisType;
55 typedef System::EventArgs BaseType;
56
57 ASPOSECPP_SHARED_RTTI_INFO_DECL();
58
59 friend class ZipFile;
60
61public:
62
63 ASPOSECPP_SHARED_API int get_EntriesTotal();
64 ASPOSECPP_SHARED_API void set_EntriesTotal(int value);
65 ASPOSECPP_SHARED_API System::SharedPtr<ZipEntry> get_CurrentEntry();
66 ASPOSECPP_SHARED_API void set_CurrentEntry(const System::SharedPtr<ZipEntry>& value);
67 ASPOSECPP_SHARED_API bool get_Cancel();
68 ASPOSECPP_SHARED_API void set_Cancel(bool value);
69 ASPOSECPP_SHARED_API ZipProgressEventType get_EventType();
70 ASPOSECPP_SHARED_API void set_EventType(ZipProgressEventType value);
71 ASPOSECPP_SHARED_API System::String get_ArchiveName();
72 ASPOSECPP_SHARED_API void set_ArchiveName(const System::String& value);
73 ASPOSECPP_SHARED_API int64_t get_BytesTransferred();
74 ASPOSECPP_SHARED_API void set_BytesTransferred(int64_t value);
75 ASPOSECPP_SHARED_API int64_t get_TotalBytesToTransfer();
76 ASPOSECPP_SHARED_API void set_TotalBytesToTransfer(int64_t value);
77
78protected:
79
80 ASPOSECPP_SHARED_API ZipProgressEventArgs();
81 ASPOSECPP_SHARED_API ZipProgressEventArgs(const System::String& archiveName, ZipProgressEventType flavor);
82 MEMBER_FUNCTION_MAKE_OBJECT(ZipProgressEventArgs, CODEPORTING_ARGS(const System::String& archiveName, ZipProgressEventType flavor), CODEPORTING_ARGS(archiveName, flavor));
83
84#ifdef __DBG_FOR_EACH_MEMBER
85public:
88 ASPOSECPP_SHARED_API void DBG_for_each_member(System::DBG::for_each_member_visitor& visitor) const override;
91 const char* DBG_class_name() const override { return "ZipProgressEventArgs"; }
92#endif
93
94private:
95
96 int _entriesTotal;
97 bool _cancel;
98 System::SharedPtr<ZipEntry> _latestEntry;
99 ZipProgressEventType _flavor;
100 System::String _archiveName;
101 int64_t _bytesTransferred;
102 int64_t _totalBytesToTransfer;
103};
104
106
107class ASPOSECPP_SHARED_CLASS ReadProgressEventArgs : public ZipProgressEventArgs
108{
109 typedef ReadProgressEventArgs ThisType;
110 typedef ZipProgressEventArgs BaseType;
111
112 ASPOSECPP_SHARED_RTTI_INFO_DECL();
113
114 friend class ZipFile;
115
116protected:
117
118 ASPOSECPP_SHARED_API ReadProgressEventArgs();
119
120 static ASPOSECPP_SHARED_API System::SharedPtr<ReadProgressEventArgs> Before(const System::String& archiveName, int entriesTotal);
121 static ASPOSECPP_SHARED_API System::SharedPtr<ReadProgressEventArgs> After(const System::String& archiveName, const System::SharedPtr<ZipEntry>& entry, int entriesTotal);
122 static ASPOSECPP_SHARED_API System::SharedPtr<ReadProgressEventArgs> Started(const System::String& archiveName);
123 static ASPOSECPP_SHARED_API System::SharedPtr<ReadProgressEventArgs> ByteUpdate(const System::String& archiveName, const System::SharedPtr<ZipEntry>& entry, int64_t bytesXferred, int64_t totalBytes);
124 static ASPOSECPP_SHARED_API System::SharedPtr<ReadProgressEventArgs> Completed(const System::String& archiveName);
125
126private:
127
128 ASPOSECPP_SHARED_API ReadProgressEventArgs(System::String archiveName, ZipProgressEventType flavor);
129 MEMBER_FUNCTION_MAKE_OBJECT(ReadProgressEventArgs, CODEPORTING_ARGS(const System::String& archiveName, ZipProgressEventType flavor), CODEPORTING_ARGS(archiveName, flavor));
130};
131
133
134class ASPOSECPP_SHARED_CLASS AddProgressEventArgs : public ZipProgressEventArgs
135{
136 typedef AddProgressEventArgs ThisType;
137 typedef ZipProgressEventArgs BaseType;
138
139 ASPOSECPP_SHARED_RTTI_INFO_DECL();
140
141 friend class ZipFile;
142
143protected:
144
145 ASPOSECPP_SHARED_API AddProgressEventArgs();
146
147 static ASPOSECPP_SHARED_API System::SharedPtr<AddProgressEventArgs> AfterEntry(const System::String& archiveName, const System::SharedPtr<ZipEntry>& entry, int entriesTotal);
148 static ASPOSECPP_SHARED_API System::SharedPtr<AddProgressEventArgs> Started(const System::String& archiveName);
149 static ASPOSECPP_SHARED_API System::SharedPtr<AddProgressEventArgs> Completed(const System::String& archiveName);
150
151private:
152
153 ASPOSECPP_SHARED_API AddProgressEventArgs(System::String archiveName, ZipProgressEventType flavor);
154 MEMBER_FUNCTION_MAKE_OBJECT(AddProgressEventArgs, CODEPORTING_ARGS(const System::String& archiveName, ZipProgressEventType flavor), CODEPORTING_ARGS(archiveName, flavor));
155};
156
158
159class ASPOSECPP_SHARED_CLASS SaveProgressEventArgs : public ZipProgressEventArgs
160{
161 typedef SaveProgressEventArgs ThisType;
162 typedef ZipProgressEventArgs BaseType;
163
164 ASPOSECPP_SHARED_RTTI_INFO_DECL();
165
166 friend class ZipFile;
167
168public:
169
170 ASPOSECPP_SHARED_API int get_EntriesSaved();
171
172protected:
173
174 ASPOSECPP_SHARED_API SaveProgressEventArgs(const System::String& archiveName, bool before, int entriesTotal, int entriesSaved, const System::SharedPtr<ZipEntry>& entry);
175 MEMBER_FUNCTION_MAKE_OBJECT(SaveProgressEventArgs, CODEPORTING_ARGS(const System::String& archiveName, bool before, int entriesTotal, int entriesSaved, const System::SharedPtr<ZipEntry>& entry), CODEPORTING_ARGS(archiveName, before, entriesTotal, entriesSaved, entry));
176 ASPOSECPP_SHARED_API SaveProgressEventArgs();
177 ASPOSECPP_SHARED_API SaveProgressEventArgs(const System::String& archiveName, ZipProgressEventType flavor);
178 MEMBER_FUNCTION_MAKE_OBJECT(SaveProgressEventArgs, CODEPORTING_ARGS(const System::String& archiveName, ZipProgressEventType flavor), CODEPORTING_ARGS(archiveName, flavor));
179
180 static ASPOSECPP_SHARED_API System::SharedPtr<SaveProgressEventArgs> ByteUpdate(const System::String& archiveName, const System::SharedPtr<ZipEntry>& entry, int64_t bytesXferred, int64_t totalBytes);
181 static ASPOSECPP_SHARED_API System::SharedPtr<SaveProgressEventArgs> Started(const System::String& archiveName);
182 static ASPOSECPP_SHARED_API System::SharedPtr<SaveProgressEventArgs> Completed(const System::String& archiveName);
183
184private:
185
186 int _entriesSaved;
187};
188
190
191class ASPOSECPP_SHARED_CLASS ExtractProgressEventArgs : public ZipProgressEventArgs
192{
193 typedef ExtractProgressEventArgs ThisType;
194 typedef ZipProgressEventArgs BaseType;
195
196 ASPOSECPP_SHARED_RTTI_INFO_DECL();
197
198 friend class ZipFile;
199
200public:
201
202 ASPOSECPP_SHARED_API int get_EntriesExtracted();
203 ASPOSECPP_SHARED_API System::String get_ExtractLocation();
204
205protected:
206
207 ASPOSECPP_SHARED_API ExtractProgressEventArgs(const System::String& archiveName, bool before, int entriesTotal, int entriesExtracted, const System::SharedPtr<ZipEntry>& entry, System::String extractLocation);
208 MEMBER_FUNCTION_MAKE_OBJECT(
209 ExtractProgressEventArgs,
210 CODEPORTING_ARGS(
211 const System::String& archiveName,
212 bool before,
213 int entriesTotal,
214 int entriesExtracted,
215 const System::SharedPtr<ZipEntry>& entry, System::String extractLocation
216 ),
217 CODEPORTING_ARGS(
218 archiveName,
219 before,
220 entriesTotal,
221 entriesExtracted,
222 entry,
223 extractLocation
224 )
225 );
226
227 ASPOSECPP_SHARED_API ExtractProgressEventArgs(const System::String& archiveName, ZipProgressEventType flavor);
228 MEMBER_FUNCTION_MAKE_OBJECT(ExtractProgressEventArgs, CODEPORTING_ARGS(const System::String& archiveName, ZipProgressEventType flavor), CODEPORTING_ARGS(archiveName, flavor));
229 ASPOSECPP_SHARED_API ExtractProgressEventArgs();
230
231 static ASPOSECPP_SHARED_API System::SharedPtr<ExtractProgressEventArgs> BeforeExtractEntry(const System::String& archiveName, const System::SharedPtr<ZipEntry>& entry, System::String extractLocation);
232 static ASPOSECPP_SHARED_API System::SharedPtr<ExtractProgressEventArgs> ExtractExisting(const System::String& archiveName, const System::SharedPtr<ZipEntry>& entry, System::String extractLocation);
233 static ASPOSECPP_SHARED_API System::SharedPtr<ExtractProgressEventArgs> AfterExtractEntry(const System::String& archiveName, const System::SharedPtr<ZipEntry>& entry, System::String extractLocation);
234 static ASPOSECPP_SHARED_API System::SharedPtr<ExtractProgressEventArgs> ExtractAllStarted(const System::String& archiveName, System::String extractLocation);
235 static ASPOSECPP_SHARED_API System::SharedPtr<ExtractProgressEventArgs> ExtractAllCompleted(const System::String& archiveName, System::String extractLocation);
236 static ASPOSECPP_SHARED_API System::SharedPtr<ExtractProgressEventArgs> ByteUpdate(const System::String& archiveName, const System::SharedPtr<ZipEntry>& entry, int64_t bytesWritten, int64_t totalBytes);
237
238private:
239
240 int _entriesExtracted;
241 System::String _target;
242};
243
245
246class ASPOSECPP_SHARED_CLASS ZipErrorEventArgs : public ZipProgressEventArgs
247{
248 typedef ZipErrorEventArgs ThisType;
249 typedef ZipProgressEventArgs BaseType;
250
251 ASPOSECPP_SHARED_RTTI_INFO_DECL();
252
253 friend class ZipFile;
254
255public:
256
257 ASPOSECPP_SHARED_API System::Exception get_Exception();
258 ASPOSECPP_SHARED_API System::String get_FileName();
259
260 static ASPOSECPP_SHARED_API System::SharedPtr<ZipErrorEventArgs> Saving(System::String archiveName, const System::SharedPtr<ZipEntry>& entry, System::Exception exception);
261
262private:
263
265
266 ASPOSECPP_SHARED_API ZipErrorEventArgs();
267 MEMBER_FUNCTION_MAKE_OBJECT(ZipErrorEventArgs, CODEPORTING_ARGS(), CODEPORTING_ARGS());
268};
269
270}} // namespace Aspose::Zip
271
272#endif // _aspose_zip_events_h_
273
The base class for classes that represent a context that is passed to the event subscribers when an e...
Definition: eventargs.h:19
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
@ After
The current node of this navigator is after the current node of the supplied navigator.
@ Before
The current node of this navigator is before the current node of the supplied navigator.