toolkit/mozapps/update/updater/archivereader.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/mozapps/update/updater/archivereader.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,42 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* vim:set ts=2 sw=2 sts=2 et cindent: */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef ArchiveReader_h__
    1.11 +#define ArchiveReader_h__
    1.12 +
    1.13 +#include "mozilla/NullPtr.h"
    1.14 +#include <stdio.h>
    1.15 +#include "mar.h"
    1.16 +
    1.17 +#ifdef XP_WIN
    1.18 +  typedef WCHAR NS_tchar;
    1.19 +#else
    1.20 +  typedef char NS_tchar;
    1.21 +#endif
    1.22 +
    1.23 +// This class provides an API to extract files from an update archive.
    1.24 +class ArchiveReader
    1.25 +{
    1.26 +public:
    1.27 +  ArchiveReader() : mArchive(nullptr) {}
    1.28 +  ~ArchiveReader() { Close(); }
    1.29 +
    1.30 +  int Open(const NS_tchar *path);
    1.31 +  int VerifySignature();
    1.32 +  int VerifyProductInformation(const char *MARChannelID, 
    1.33 +                               const char *appVersion);
    1.34 +  void Close();
    1.35 +
    1.36 +  int ExtractFile(const char *item, const NS_tchar *destination);
    1.37 +  int ExtractFileToStream(const char *item, FILE *fp);
    1.38 +
    1.39 +private:
    1.40 +  int ExtractItemToStream(const MarItem *item, FILE *fp);
    1.41 +
    1.42 +  MarFile *mArchive;
    1.43 +};
    1.44 +
    1.45 +#endif  // ArchiveReader_h__

mercurial