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