|
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* vim: set ts=8 sts=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 |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 #ifndef nsGZFileWriter_h |
|
8 #define nsGZFileWriter_h |
|
9 |
|
10 #include "nsIGZFileWriter.h" |
|
11 #include "zlib.h" |
|
12 |
|
13 /** |
|
14 * A simple class for writing .gz files. |
|
15 */ |
|
16 class nsGZFileWriter : public nsIGZFileWriter |
|
17 { |
|
18 public: |
|
19 nsGZFileWriter(); |
|
20 virtual ~nsGZFileWriter(); |
|
21 |
|
22 NS_DECL_ISUPPORTS |
|
23 NS_DECL_NSIGZFILEWRITER |
|
24 |
|
25 /** |
|
26 * nsIGZFileWriter exposes two non-virtual overloads of Write(). We |
|
27 * duplicate them here so that you can call these overloads on a pointer to |
|
28 * the concrete nsGZFileWriter class. |
|
29 */ |
|
30 nsresult Write(const char* aStr) |
|
31 { |
|
32 return nsIGZFileWriter::Write(aStr); |
|
33 } |
|
34 |
|
35 nsresult Write(const char* aStr, uint32_t aLen) |
|
36 { |
|
37 return nsIGZFileWriter::Write(aStr, aLen); |
|
38 } |
|
39 |
|
40 private: |
|
41 bool mInitialized; |
|
42 bool mFinished; |
|
43 gzFile mGZFile; |
|
44 }; |
|
45 |
|
46 #endif |