michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_dom_file_filestreamwrappers_h__ michael@0: #define mozilla_dom_file_filestreamwrappers_h__ michael@0: michael@0: #include "FileCommon.h" michael@0: michael@0: #include "nsIInputStream.h" michael@0: #include "nsIOutputStream.h" michael@0: michael@0: BEGIN_FILE_NAMESPACE michael@0: michael@0: class FileHelper; michael@0: michael@0: class FileStreamWrapper : public nsISupports michael@0: { michael@0: public: michael@0: NS_DECL_THREADSAFE_ISUPPORTS michael@0: michael@0: FileStreamWrapper(nsISupports* aFileStream, michael@0: FileHelper* aFileHelper, michael@0: uint64_t aOffset, michael@0: uint64_t aLimit, michael@0: uint32_t aFlags); michael@0: michael@0: virtual ~FileStreamWrapper(); michael@0: michael@0: enum { michael@0: NOTIFY_PROGRESS = 1 << 0, michael@0: NOTIFY_CLOSE = 1 << 1, michael@0: NOTIFY_DESTROY = 1 << 2 michael@0: }; michael@0: michael@0: protected: michael@0: nsCOMPtr mFileStream; michael@0: nsRefPtr mFileHelper; michael@0: uint64_t mOffset; michael@0: uint64_t mLimit; michael@0: uint32_t mFlags; michael@0: bool mFirstTime; michael@0: }; michael@0: michael@0: class FileInputStreamWrapper : public FileStreamWrapper, michael@0: public nsIInputStream michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS_INHERITED michael@0: NS_DECL_NSIINPUTSTREAM michael@0: michael@0: FileInputStreamWrapper(nsISupports* aFileStream, michael@0: FileHelper* aFileHelper, michael@0: uint64_t aOffset, michael@0: uint64_t aLimit, michael@0: uint32_t aFlags); michael@0: michael@0: protected: michael@0: virtual ~FileInputStreamWrapper() michael@0: { } michael@0: michael@0: private: michael@0: nsCOMPtr mInputStream; michael@0: }; michael@0: michael@0: class FileOutputStreamWrapper : public FileStreamWrapper, michael@0: public nsIOutputStream michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS_INHERITED michael@0: NS_DECL_NSIOUTPUTSTREAM michael@0: michael@0: FileOutputStreamWrapper(nsISupports* aFileStream, michael@0: FileHelper* aFileHelper, michael@0: uint64_t aOffset, michael@0: uint64_t aLimit, michael@0: uint32_t aFlags); michael@0: michael@0: protected: michael@0: virtual ~FileOutputStreamWrapper() michael@0: { } michael@0: michael@0: private: michael@0: nsCOMPtr mOutputStream; michael@0: #ifdef DEBUG michael@0: void* mWriteThread; michael@0: #endif michael@0: }; michael@0: michael@0: END_FILE_NAMESPACE michael@0: michael@0: #endif // mozilla_dom_file_filestreamwrappers_h__