xref: /aosp_15_r20/external/lzma/CPP/7zip/UI/Console/HashCon.h (revision f6dc9357d832569d4d1f5d24eacdb3935a1ae8e6)
1 // HashCon.h
2 
3 #ifndef ZIP7_INC_HASH_CON_H
4 #define ZIP7_INC_HASH_CON_H
5 
6 #include "../Common/HashCalc.h"
7 
8 #include "UpdateCallbackConsole.h"
9 
10 class CHashCallbackConsole Z7_final:
11     public IHashCallbackUI,
12     public CCallbackConsoleBase
13 {
14   Z7_IFACE_IMP(IDirItemsCallback)
15   Z7_IFACE_IMP(IHashCallbackUI)
16 
17   UString _fileName;
18   AString _s;
19 
AddSpace()20   void AddSpace()
21   {
22     _s.Add_Space_if_NotEmpty();
23   }
24 
AddSpacesBeforeName()25   void AddSpacesBeforeName()
26   {
27     if (!_s.IsEmpty())
28     {
29       _s.Add_Space();
30       _s.Add_Space();
31     }
32   }
33 
34   void PrintSeparatorLine(const CObjectVector<CHasherState> &hashers);
35   void PrintResultLine(UInt64 fileSize,
36       const CObjectVector<CHasherState> &hashers, unsigned digestIndex, bool showHash, const AString &path);
37   void PrintProperty(const char *name, UInt64 value);
38 
39 public:
40   bool PrintNameInPercents;
41   bool PrintHeaders;
42   // bool PrintSize;
43   // bool PrintNewLine; // set it too (false), if you need only hash for single file without LF char.
44   AString PrintFields;
45 
46   AString GetFields() const;
47 
CHashCallbackConsole()48   CHashCallbackConsole():
49       PrintNameInPercents(true),
50       PrintHeaders(false)
51       // , PrintSize(true),
52       // , PrintNewLine(true)
53     {}
54 };
55 
56 void PrintHashStat(CStdOutStream &so, const CHashBundle &hb);
57 
58 #endif
59