apt  2.2.4
About: Apt (Advanced Package Tool) is a management system for software packages (Debian/Ubuntu). Release series 2.2.
  Fossies Dox: apt-2.2.4.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

multicompress.h
Go to the documentation of this file.
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 /* ######################################################################
4 
5  MultiCompressor
6 
7  Multiple output class. Takes a single FILE* and writes it simultaneously
8  to many compressed files. Then checks if the resulting output is
9  different from any previous output and overwrites the old files. Care is
10  taken to ensure that the new files are not generally readable while they
11  are being written.
12 
13  ##################################################################### */
14  /*}}}*/
15 #ifndef MULTICOMPRESS_H
16 #define MULTICOMPRESS_H
17 
19 #include <apt-pkg/fileutl.h>
20 
21 #include <string>
22 #include <stdio.h>
23 #include <sys/types.h>
24 #include <time.h>
25 
27 {
28  // An output file
29  struct Files
30  {
31  std::string Output;
35  pid_t CompressProc;
36  time_t OldMTime;
37  };
38 
40  pid_t Outputter;
41  mode_t Permissions;
42 
43  bool Child(int const &Fd);
44  bool Start();
45  bool Die();
46 
47  public:
48 
49  // The FD to write to for compression.
51  unsigned long UpdateMTime;
52 
53  bool Finalize(unsigned long long &OutSize);
54  bool OpenOld(FileFd &Fd);
55  static bool GetStat(std::string const &Output,std::string const &Compress,struct stat &St);
56 
57  MultiCompress(std::string const &Output,std::string const &Compress,
58  mode_t const &Permissions, bool const &Write = true);
60 };
61 
62 #endif
Definition: fileutl.h:39
Files * Outputs
Definition: multicompress.h:39
unsigned long UpdateMTime
Definition: multicompress.h:51
bool OpenOld(FileFd &Fd)
bool Finalize(unsigned long long &OutSize)
bool Child(int const &Fd)
mode_t Permissions
Definition: multicompress.h:41
MultiCompress(std::string const &Output, std::string const &Compress, mode_t const &Permissions, bool const &Write=true)
static bool GetStat(std::string const &Output, std::string const &Compress, struct stat &St)
Representation of supported compressors.
APT::Configuration::Compressor CompressProg
Definition: multicompress.h:32