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
84private:
85
86 int _entriesTotal;
87 bool _cancel;
88 System::SharedPtr<ZipEntry> _latestEntry;
89 ZipProgressEventType _flavor;
90 System::String _archiveName;
91 int64_t _bytesTransferred;
92 int64_t _totalBytesToTransfer;
93};
94
96
97class ASPOSECPP_SHARED_CLASS ReadProgressEventArgs : public ZipProgressEventArgs
98{
99 typedef ReadProgressEventArgs ThisType;
100 typedef ZipProgressEventArgs BaseType;
101
102 ASPOSECPP_SHARED_RTTI_INFO_DECL();
103
104 friend class ZipFile;
105
106protected:
107
108 ASPOSECPP_SHARED_API ReadProgressEventArgs();
109
110 static ASPOSECPP_SHARED_API System::SharedPtr<ReadProgressEventArgs> Before(const System::String& archiveName, int entriesTotal);
111 static ASPOSECPP_SHARED_API System::SharedPtr<ReadProgressEventArgs> After(const System::String& archiveName, const System::SharedPtr<ZipEntry>& entry, int entriesTotal);
112 static ASPOSECPP_SHARED_API System::SharedPtr<ReadProgressEventArgs> Started(const System::String& archiveName);
113 static ASPOSECPP_SHARED_API System::SharedPtr<ReadProgressEventArgs> ByteUpdate(const System::String& archiveName, const System::SharedPtr<ZipEntry>& entry, int64_t bytesXferred, int64_t totalBytes);
114 static ASPOSECPP_SHARED_API System::SharedPtr<ReadProgressEventArgs> Completed(const System::String& archiveName);
115
116private:
117
118 ASPOSECPP_SHARED_API ReadProgressEventArgs(System::String archiveName, ZipProgressEventType flavor);
119 MEMBER_FUNCTION_MAKE_OBJECT(ReadProgressEventArgs, CODEPORTING_ARGS(const System::String& archiveName, ZipProgressEventType flavor), CODEPORTING_ARGS(archiveName, flavor));
120};
121
123
124class ASPOSECPP_SHARED_CLASS AddProgressEventArgs : public ZipProgressEventArgs
125{
126 typedef AddProgressEventArgs ThisType;
127 typedef ZipProgressEventArgs BaseType;
128
129 ASPOSECPP_SHARED_RTTI_INFO_DECL();
130
131 friend class ZipFile;
132
133protected:
134
135 ASPOSECPP_SHARED_API AddProgressEventArgs();
136
137 static ASPOSECPP_SHARED_API System::SharedPtr<AddProgressEventArgs> AfterEntry(const System::String& archiveName, const System::SharedPtr<ZipEntry>& entry, int entriesTotal);
138 static ASPOSECPP_SHARED_API System::SharedPtr<AddProgressEventArgs> Started(const System::String& archiveName);
139 static ASPOSECPP_SHARED_API System::SharedPtr<AddProgressEventArgs> Completed(const System::String& archiveName);
140
141private:
142
143 ASPOSECPP_SHARED_API AddProgressEventArgs(System::String archiveName, ZipProgressEventType flavor);
144 MEMBER_FUNCTION_MAKE_OBJECT(AddProgressEventArgs, CODEPORTING_ARGS(const System::String& archiveName, ZipProgressEventType flavor), CODEPORTING_ARGS(archiveName, flavor));
145};
146
148
149class ASPOSECPP_SHARED_CLASS SaveProgressEventArgs : public ZipProgressEventArgs
150{
151 typedef SaveProgressEventArgs ThisType;
152 typedef ZipProgressEventArgs BaseType;
153
154 ASPOSECPP_SHARED_RTTI_INFO_DECL();
155
156 friend class ZipFile;
157
158public:
159
160 ASPOSECPP_SHARED_API int get_EntriesSaved();
161
162protected:
163
164 ASPOSECPP_SHARED_API SaveProgressEventArgs(const System::String& archiveName, bool before, int entriesTotal, int entriesSaved, const System::SharedPtr<ZipEntry>& entry);
165 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));
166 ASPOSECPP_SHARED_API SaveProgressEventArgs();
167 ASPOSECPP_SHARED_API SaveProgressEventArgs(const System::String& archiveName, ZipProgressEventType flavor);
168 MEMBER_FUNCTION_MAKE_OBJECT(SaveProgressEventArgs, CODEPORTING_ARGS(const System::String& archiveName, ZipProgressEventType flavor), CODEPORTING_ARGS(archiveName, flavor));
169
170 static ASPOSECPP_SHARED_API System::SharedPtr<SaveProgressEventArgs> ByteUpdate(const System::String& archiveName, const System::SharedPtr<ZipEntry>& entry, int64_t bytesXferred, int64_t totalBytes);
171 static ASPOSECPP_SHARED_API System::SharedPtr<SaveProgressEventArgs> Started(const System::String& archiveName);
172 static ASPOSECPP_SHARED_API System::SharedPtr<SaveProgressEventArgs> Completed(const System::String& archiveName);
173
174private:
175
176 int _entriesSaved;
177};
178
180
181class ASPOSECPP_SHARED_CLASS ExtractProgressEventArgs : public ZipProgressEventArgs
182{
183 typedef ExtractProgressEventArgs ThisType;
184 typedef ZipProgressEventArgs BaseType;
185
186 ASPOSECPP_SHARED_RTTI_INFO_DECL();
187
188 friend class ZipFile;
189
190public:
191
192 ASPOSECPP_SHARED_API int get_EntriesExtracted();
193 ASPOSECPP_SHARED_API System::String get_ExtractLocation();
194
195protected:
196
197 ASPOSECPP_SHARED_API ExtractProgressEventArgs(const System::String& archiveName, bool before, int entriesTotal, int entriesExtracted, const System::SharedPtr<ZipEntry>& entry, System::String extractLocation);
198 MEMBER_FUNCTION_MAKE_OBJECT(
199 ExtractProgressEventArgs,
200 CODEPORTING_ARGS(
201 const System::String& archiveName,
202 bool before,
203 int entriesTotal,
204 int entriesExtracted,
205 const System::SharedPtr<ZipEntry>& entry, System::String extractLocation
206 ),
207 CODEPORTING_ARGS(
208 archiveName,
209 before,
210 entriesTotal,
211 entriesExtracted,
212 entry,
213 extractLocation
214 )
215 );
216
217 ASPOSECPP_SHARED_API ExtractProgressEventArgs(const System::String& archiveName, ZipProgressEventType flavor);
218 MEMBER_FUNCTION_MAKE_OBJECT(ExtractProgressEventArgs, CODEPORTING_ARGS(const System::String& archiveName, ZipProgressEventType flavor), CODEPORTING_ARGS(archiveName, flavor));
219 ASPOSECPP_SHARED_API ExtractProgressEventArgs();
220
221 static ASPOSECPP_SHARED_API System::SharedPtr<ExtractProgressEventArgs> BeforeExtractEntry(const System::String& archiveName, const System::SharedPtr<ZipEntry>& entry, System::String extractLocation);
222 static ASPOSECPP_SHARED_API System::SharedPtr<ExtractProgressEventArgs> ExtractExisting(const System::String& archiveName, const System::SharedPtr<ZipEntry>& entry, System::String extractLocation);
223 static ASPOSECPP_SHARED_API System::SharedPtr<ExtractProgressEventArgs> AfterExtractEntry(const System::String& archiveName, const System::SharedPtr<ZipEntry>& entry, System::String extractLocation);
224 static ASPOSECPP_SHARED_API System::SharedPtr<ExtractProgressEventArgs> ExtractAllStarted(const System::String& archiveName, System::String extractLocation);
225 static ASPOSECPP_SHARED_API System::SharedPtr<ExtractProgressEventArgs> ExtractAllCompleted(const System::String& archiveName, System::String extractLocation);
226 static ASPOSECPP_SHARED_API System::SharedPtr<ExtractProgressEventArgs> ByteUpdate(const System::String& archiveName, const System::SharedPtr<ZipEntry>& entry, int64_t bytesWritten, int64_t totalBytes);
227
228private:
229
230 int _entriesExtracted;
231 System::String _target;
232};
233
235
236class ASPOSECPP_SHARED_CLASS ZipErrorEventArgs : public ZipProgressEventArgs
237{
238 typedef ZipErrorEventArgs ThisType;
239 typedef ZipProgressEventArgs BaseType;
240
241 ASPOSECPP_SHARED_RTTI_INFO_DECL();
242
243 friend class ZipFile;
244
245public:
246
247 ASPOSECPP_SHARED_API System::Exception get_Exception();
248 ASPOSECPP_SHARED_API System::String get_FileName();
249
250 static ASPOSECPP_SHARED_API System::SharedPtr<ZipErrorEventArgs> Saving(System::String archiveName, const System::SharedPtr<ZipEntry>& entry, System::Exception exception);
251
252private:
253
255
256 ASPOSECPP_SHARED_API ZipErrorEventArgs();
257 MEMBER_FUNCTION_MAKE_OBJECT(ZipErrorEventArgs, CODEPORTING_ARGS(), CODEPORTING_ARGS());
258};
259
260}} // namespace Aspose::Zip
261
262#endif // _aspose_zip_events_h_
263
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.