Upx_Doxygen
https://github.com/upx/upx
ui.h
1 /* ui.h --
2 
3  This file is part of the UPX executable compressor.
4 
5  Copyright (C) 1996-2016 Markus Franz Xaver Johannes Oberhumer
6  Copyright (C) 1996-2016 Laszlo Molnar
7  All Rights Reserved.
8 
9  UPX and the UCL library are free software; you can redistribute them
10  and/or modify them under the terms of the GNU General Public License as
11  published by the Free Software Foundation; either version 2 of
12  the License, or (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; see the file COPYING.
21  If not, write to the Free Software Foundation, Inc.,
22  59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 
24  Markus F.X.J. Oberhumer Laszlo Molnar
25  <markus@oberhumer.com> <ezerotven+github@gmail.com>
26  */
27 
28 #ifndef __UPX_UI_H
29 #define __UPX_UI_H 1
30 
31 class InputFile;
32 class OutputFile;
33 class Packer;
34 class UiPacker;
35 
36 /*************************************************************************
37 //
38 **************************************************************************/
39 
40 class UiPacker {
41 public:
42  UiPacker(const Packer *p_);
43 
44 public:
45  virtual ~UiPacker();
46 
47  static void uiConfirmUpdate();
48  static void uiPackTotal();
49  static void uiUnpackTotal();
50  static void uiListTotal(bool uncompress = false);
51  static void uiTestTotal();
52  static void uiFileInfoTotal();
53 
54 public:
55  virtual void uiPackStart(const OutputFile *fo);
56  virtual void uiPackEnd(const OutputFile *fo);
57  virtual void uiUnpackStart(const OutputFile *fo);
58  virtual void uiUnpackEnd(const OutputFile *fo);
59  virtual void uiListStart();
60  virtual void uiList();
61  virtual void uiListEnd();
62  virtual void uiTestStart();
63  virtual void uiTestEnd();
64  virtual bool uiFileInfoStart();
65  virtual void uiFileInfoEnd();
66 
67  // callback
68  virtual void startCallback(unsigned u_len, unsigned step, int pass, int total_passes);
69  virtual void firstCallback();
70  virtual void finalCallback(unsigned u_len, unsigned c_len);
71  virtual void endCallback();
72  virtual void endCallback(bool done);
73  virtual upx_callback_t *getCallback() { return &cb; }
74 
75 protected:
76  static void __acc_cdecl progress_callback(upx_callback_p cb, unsigned, unsigned);
77  virtual void doCallback(unsigned isize, unsigned osize);
78 
79 protected:
80  virtual void uiUpdate(off_t fc_len = -1, off_t fu_len = -1);
81 
82 public:
83  static void uiHeader();
84  static void uiFooter(const char *n);
85 
86  int ui_pass;
87  int ui_total_passes;
88 
89 protected:
90  virtual void printInfo(int nl = 0);
91  const Packer *p;
92 
93  // callback
94  upx_callback_t cb;
95 
96  // internal state
97  struct State;
98  State *s;
99 
100  // totals
101  static unsigned total_files;
102  static unsigned total_files_done;
103  static upx_uint64_t total_c_len;
104  static upx_uint64_t total_u_len;
105  static upx_uint64_t total_fc_len;
106  static upx_uint64_t total_fu_len;
107  static unsigned update_c_len;
108  static unsigned update_u_len;
109  static unsigned update_fc_len;
110  static unsigned update_fu_len;
111 };
112 
113 #endif /* already included */
114 
115 /* vim:set ts=4 sw=4 et: */
Definition: file.h:89
Definition: packer.h:115
Definition: file.h:121
Definition: ui.h:40
Definition: conf.h:478
Definition: ui.cpp:46