Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/xpcom/base/nsGZFileWriter.h
Line
Count
Source (jump to first uncovered line)
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 final : public nsIGZFileWriter
17
{
18
  virtual ~nsGZFileWriter();
19
20
public:
21
22
  enum Operation {
23
    Append,
24
    Create
25
  };
26
27
28
  explicit nsGZFileWriter(Operation aMode = Create);
29
30
  NS_DECL_ISUPPORTS
31
  NS_DECL_NSIGZFILEWRITER
32
33
  /**
34
   * nsIGZFileWriter exposes two non-virtual overloads of Write().  We
35
   * duplicate them here so that you can call these overloads on a pointer to
36
   * the concrete nsGZFileWriter class.
37
   */
38
  MOZ_MUST_USE nsresult Write(const char* aStr)
39
0
  {
40
0
    return nsIGZFileWriter::Write(aStr);
41
0
  }
42
43
  MOZ_MUST_USE nsresult Write(const char* aStr, uint32_t aLen)
44
0
  {
45
0
    return nsIGZFileWriter::Write(aStr, aLen);
46
0
  }
47
48
private:
49
  Operation mMode;
50
  bool mInitialized;
51
  bool mFinished;
52
  gzFile mGZFile;
53
};
54
55
#endif