Bug 1686838 [wpt PR 27194] - [webcodecs] Deprecate VideoFrame.destroy()., a=testonly
[gecko.git] / xpcom / base / nsGZFileWriter.h
blobad817118880bc0e10b70685fbb65b61a26609be9
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/. */
7 #ifndef nsGZFileWriter_h
8 #define nsGZFileWriter_h
10 #include "nsIGZFileWriter.h"
11 #include "zlib.h"
13 /**
14 * A simple class for writing .gz files.
16 class nsGZFileWriter final : public nsIGZFileWriter {
17 virtual ~nsGZFileWriter();
19 public:
20 enum Operation { Append, Create };
22 explicit nsGZFileWriter(Operation aMode = Create);
24 NS_DECL_ISUPPORTS
25 NS_DECL_NSIGZFILEWRITER
27 /**
28 * nsIGZFileWriter exposes two non-virtual overloads of Write(). We
29 * duplicate them here so that you can call these overloads on a pointer
30 * to the concrete nsGZFileWriter class.
32 [[nodiscard]] nsresult Write(const char* aStr) {
33 return nsIGZFileWriter::Write(aStr);
36 [[nodiscard]] nsresult Write(const char* aStr, uint32_t aLen) {
37 return nsIGZFileWriter::Write(aStr, aLen);
40 private:
41 Operation mMode;
42 bool mInitialized;
43 bool mFinished;
44 gzFile mGZFile;
47 #endif