|
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* vim: set ts=2 et sw=2 tw=80: */ |
|
3 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
|
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 #ifndef mozilla_dom_file_domarchivezipevent_h__ |
|
8 #define mozilla_dom_file_domarchivezipevent_h__ |
|
9 |
|
10 #include "mozilla/Attributes.h" |
|
11 #include "ArchiveEvent.h" |
|
12 |
|
13 #include "FileCommon.h" |
|
14 #include "zipstruct.h" |
|
15 |
|
16 BEGIN_FILE_NAMESPACE |
|
17 |
|
18 /** |
|
19 * ArchiveZipItem - ArchiveItem for ArchiveReaderZipEvent |
|
20 */ |
|
21 class ArchiveZipItem : public ArchiveItem |
|
22 { |
|
23 public: |
|
24 ArchiveZipItem(const char* aFilename, |
|
25 const ZipCentral& aCentralStruct, |
|
26 const nsACString& aEncoding); |
|
27 virtual ~ArchiveZipItem(); |
|
28 |
|
29 nsresult GetFilename(nsString& aFilename) MOZ_OVERRIDE; |
|
30 |
|
31 // From zipItem to DOMFile: |
|
32 virtual nsIDOMFile* File(ArchiveReader* aArchiveReader) MOZ_OVERRIDE; |
|
33 |
|
34 public: // for the event |
|
35 static uint32_t StrToInt32(const uint8_t* aStr); |
|
36 static uint16_t StrToInt16(const uint8_t* aStr); |
|
37 |
|
38 private: |
|
39 nsresult ConvertFilename(); |
|
40 |
|
41 private: // data |
|
42 nsCString mFilename; |
|
43 |
|
44 nsString mFilenameU; |
|
45 ZipCentral mCentralStruct; |
|
46 |
|
47 nsCString mEncoding; |
|
48 }; |
|
49 |
|
50 /** |
|
51 * ArchiveReaderEvent implements the ArchiveReaderEvent for the ZIP format |
|
52 */ |
|
53 class ArchiveReaderZipEvent : public ArchiveReaderEvent |
|
54 { |
|
55 public: |
|
56 ArchiveReaderZipEvent(ArchiveReader* aArchiveReader, |
|
57 const nsACString& aEncoding); |
|
58 |
|
59 nsresult Exec() MOZ_OVERRIDE; |
|
60 |
|
61 private: |
|
62 nsCString mEncoding; |
|
63 }; |
|
64 |
|
65 END_FILE_NAMESPACE |
|
66 |
|
67 #endif // mozilla_dom_file_domarchivezipevent_h__ |
|
68 |