modules/libjar/zipwriter/src/nsZipWriter.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 4 */
michael@0 5
michael@0 6 #ifndef _nsZipWriter_h_
michael@0 7 #define _nsZipWriter_h_
michael@0 8
michael@0 9 #include "nsIZipWriter.h"
michael@0 10 #include "nsIFileStreams.h"
michael@0 11 #include "nsIBufferedStreams.h"
michael@0 12 #include "nsIRequestObserver.h"
michael@0 13 #include "nsZipHeader.h"
michael@0 14 #include "nsCOMPtr.h"
michael@0 15 #include "nsCOMArray.h"
michael@0 16 #include "nsTArray.h"
michael@0 17 #include "nsDataHashtable.h"
michael@0 18 #include "mozilla/Attributes.h"
michael@0 19
michael@0 20 #define ZIPWRITER_CONTRACTID "@mozilla.org/zipwriter;1"
michael@0 21 #define ZIPWRITER_CID { 0x430d416c, 0xa722, 0x4ad1, \
michael@0 22 { 0xbe, 0x98, 0xd9, 0xa4, 0x45, 0xf8, 0x5e, 0x3f } }
michael@0 23
michael@0 24 #define OPERATION_ADD 0
michael@0 25 #define OPERATION_REMOVE 1
michael@0 26 struct nsZipQueueItem
michael@0 27 {
michael@0 28 public:
michael@0 29 uint32_t mOperation;
michael@0 30 nsCString mZipEntry;
michael@0 31 nsCOMPtr<nsIFile> mFile;
michael@0 32 nsCOMPtr<nsIChannel> mChannel;
michael@0 33 nsCOMPtr<nsIInputStream> mStream;
michael@0 34 PRTime mModTime;
michael@0 35 int32_t mCompression;
michael@0 36 uint32_t mPermissions;
michael@0 37 };
michael@0 38
michael@0 39 class nsZipWriter MOZ_FINAL : public nsIZipWriter,
michael@0 40 public nsIRequestObserver
michael@0 41 {
michael@0 42 public:
michael@0 43 NS_DECL_ISUPPORTS
michael@0 44 NS_DECL_NSIZIPWRITER
michael@0 45 NS_DECL_NSIREQUESTOBSERVER
michael@0 46
michael@0 47 nsZipWriter();
michael@0 48 nsresult EntryCompleteCallback(nsZipHeader *aHeader, nsresult aStatus);
michael@0 49
michael@0 50 private:
michael@0 51 ~nsZipWriter();
michael@0 52
michael@0 53 uint32_t mCDSOffset;
michael@0 54 bool mCDSDirty;
michael@0 55 bool mInQueue;
michael@0 56
michael@0 57 nsCOMPtr<nsIFile> mFile;
michael@0 58 nsCOMPtr<nsIRequestObserver> mProcessObserver;
michael@0 59 nsCOMPtr<nsISupports> mProcessContext;
michael@0 60 nsCOMPtr<nsIOutputStream> mStream;
michael@0 61 nsCOMArray<nsZipHeader> mHeaders;
michael@0 62 nsTArray<nsZipQueueItem> mQueue;
michael@0 63 nsDataHashtable<nsCStringHashKey, int32_t> mEntryHash;
michael@0 64 nsCString mComment;
michael@0 65
michael@0 66 nsresult SeekCDS();
michael@0 67 void Cleanup();
michael@0 68 nsresult ReadFile(nsIFile *aFile);
michael@0 69 nsresult InternalAddEntryDirectory(const nsACString & aZipEntry,
michael@0 70 PRTime aModTime, uint32_t aPermissions);
michael@0 71 nsresult BeginProcessingAddition(nsZipQueueItem* aItem, bool* complete);
michael@0 72 nsresult BeginProcessingRemoval(int32_t aPos);
michael@0 73 nsresult AddEntryStream(const nsACString & aZipEntry, PRTime aModTime,
michael@0 74 int32_t aCompression, nsIInputStream *aStream,
michael@0 75 bool aQueue, uint32_t aPermissions);
michael@0 76 void BeginProcessingNextItem();
michael@0 77 void FinishQueue(nsresult aStatus);
michael@0 78 };
michael@0 79
michael@0 80 #endif

mercurial