1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/file/ArchiveZipEvent.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,68 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim: set ts=2 et sw=2 tw=80: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this file, 1.8 + * You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef mozilla_dom_file_domarchivezipevent_h__ 1.11 +#define mozilla_dom_file_domarchivezipevent_h__ 1.12 + 1.13 +#include "mozilla/Attributes.h" 1.14 +#include "ArchiveEvent.h" 1.15 + 1.16 +#include "FileCommon.h" 1.17 +#include "zipstruct.h" 1.18 + 1.19 +BEGIN_FILE_NAMESPACE 1.20 + 1.21 +/** 1.22 + * ArchiveZipItem - ArchiveItem for ArchiveReaderZipEvent 1.23 + */ 1.24 +class ArchiveZipItem : public ArchiveItem 1.25 +{ 1.26 +public: 1.27 + ArchiveZipItem(const char* aFilename, 1.28 + const ZipCentral& aCentralStruct, 1.29 + const nsACString& aEncoding); 1.30 + virtual ~ArchiveZipItem(); 1.31 + 1.32 + nsresult GetFilename(nsString& aFilename) MOZ_OVERRIDE; 1.33 + 1.34 + // From zipItem to DOMFile: 1.35 + virtual nsIDOMFile* File(ArchiveReader* aArchiveReader) MOZ_OVERRIDE; 1.36 + 1.37 +public: // for the event 1.38 + static uint32_t StrToInt32(const uint8_t* aStr); 1.39 + static uint16_t StrToInt16(const uint8_t* aStr); 1.40 + 1.41 +private: 1.42 + nsresult ConvertFilename(); 1.43 + 1.44 +private: // data 1.45 + nsCString mFilename; 1.46 + 1.47 + nsString mFilenameU; 1.48 + ZipCentral mCentralStruct; 1.49 + 1.50 + nsCString mEncoding; 1.51 +}; 1.52 + 1.53 +/** 1.54 + * ArchiveReaderEvent implements the ArchiveReaderEvent for the ZIP format 1.55 + */ 1.56 +class ArchiveReaderZipEvent : public ArchiveReaderEvent 1.57 +{ 1.58 +public: 1.59 + ArchiveReaderZipEvent(ArchiveReader* aArchiveReader, 1.60 + const nsACString& aEncoding); 1.61 + 1.62 + nsresult Exec() MOZ_OVERRIDE; 1.63 + 1.64 +private: 1.65 + nsCString mEncoding; 1.66 +}; 1.67 + 1.68 +END_FILE_NAMESPACE 1.69 + 1.70 +#endif // mozilla_dom_file_domarchivezipevent_h__ 1.71 +