~ubuntu-branches/ubuntu/vivid/unrar-nonfree/vivid

« back to all changes in this revision

Viewing changes to ui.hpp

  • Committer: Package Import Robot
  • Author(s): Martin Meredith
  • Date: 2015-02-03 12:58:01 UTC
  • mfrom: (1.1.18) (5.1.18 sid)
  • Revision ID: package-import@ubuntu.com-20150203125801-od6ev8cqy1er51vz
Tags: 1:5.2.5-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef _RAR_UI_
 
2
#define _RAR_UI_
 
3
 
 
4
// UIERROR_ - error message;
 
5
// UIMSG_   - informational message;
 
6
// UIWAIT_  - message waiting for user confirmation;
 
7
// UIEVENT_ - if simple message is not enough;
 
8
 
 
9
enum UIMESSAGE_CODE {
 
10
  UIERROR_SYSERRMSG, UIERROR_GENERALERRMSG, UIERROR_INCERRCOUNT,
 
11
  UIERROR_CHECKSUM, UIERROR_CHECKSUMENC, UIERROR_CHECKSUMPACKED,
 
12
  UIERROR_BADPSW, UIERROR_MEMORY, UIERROR_FILEOPEN, UIERROR_FILECREATE,
 
13
  UIERROR_FILECLOSE, UIERROR_FILESEEK, UIERROR_FILEREAD,
 
14
  UIERROR_FILEWRITE, UIERROR_FILEDELETE, UIERROR_FILERENAME,
 
15
  UIERROR_FILEATTR, UIERROR_FILECOPY, UIERROR_FILECOPYHINT,
 
16
  UIERROR_DIRCREATE, UIERROR_SLINKCREATE, UIERROR_HLINKCREATE,
 
17
  UIERROR_NEEDADMIN, UIERROR_ARCBROKEN, UIERROR_HEADERBROKEN,
 
18
  UIERROR_MHEADERBROKEN, UIERROR_FHEADERBROKEN, UIERROR_SUBHEADERBROKEN,
 
19
  UIERROR_SUBHEADERUNKNOWN, UIERROR_SUBHEADERDATABROKEN, UIERROR_RRDAMAGED,
 
20
  UIERROR_UNKNOWNMETHOD, UIERROR_UNKNOWNENCMETHOD, UIERROR_RENAMING,
 
21
  UIERROR_NEWERRAR, UIERROR_NOTSFX, UIERROR_OLDTOSFX, UIERROR_WRONGSFXVER,
 
22
  UIERROR_ALREADYENC, UIERROR_SYNCSCAN, UIERROR_DICTOUTMEM,
 
23
  UIERROR_USESMALLERDICT, UIERROR_MODIFYUNKNOWN, UIERROR_MODIFYOLD,
 
24
  UIERROR_MODIFYLOCKED, UIERROR_MODIFYVOLUME, UIERROR_NOTVOLUME,
 
25
  UIERROR_NOTFIRSTVOLUME, UIERROR_RECVOLLIMIT, UIERROR_RECVOLDIFFSETS,
 
26
  UIERROR_RECVOLALLEXIST, UIERROR_RECVOLFOUND, UIERROR_RECONSTRUCTING,
 
27
  UIERROR_RECVOLCANNOTFIX, UIERROR_OPFAILED, UIERROR_UNEXPEOF,
 
28
  UIERROR_BADARCHIVE, UIERROR_CMTBROKEN, UIERROR_INVALIDNAME,
 
29
  UIERROR_NEWRARFORMAT, UIERROR_NOTSUPPORTED, UIERROR_ENCRNOTSUPPORTED,
 
30
  UIERROR_RARZIPONLY, UIERROR_REPAIROLDFORMAT, UIERROR_NOFILESREPAIRED,
 
31
  UIERROR_NOFILESTOADD, UIERROR_NOFILESTODELETE, UIERROR_NOFILESTOEXTRACT,
 
32
  UIERROR_MISSINGVOL, UIERROR_NEEDPREVVOL, UIERROR_UNKNOWNEXTRA,
 
33
  UIERROR_NTFSREQUIRED, UIERROR_ZIPVOLSFX, UIERROR_FILERO,
 
34
  UIERROR_TOOLARGESFX, UIERROR_EMAIL, UIERROR_ACLGET, UIERROR_ACLBROKEN,
 
35
  UIERROR_ACLUNKNOWN, UIERROR_ACLSET, UIERROR_STREAMBROKEN,
 
36
  UIERROR_STREAMUNKNOWN, UIERROR_INCOMPATSWITCH, UIERROR_PATHTOOLONG,
 
37
  UIERROR_DIRSCAN, UIERROR_UOWNERGET, UIERROR_UOWNERBROKEN,
 
38
  UIERROR_UOWNERGETOWNERID, UIERROR_UOWNERGETGROUPID, UIERROR_UOWNERSET,
 
39
  UIERROR_ULINKREAD, UIERROR_ULINKEXIST,
 
40
 
 
41
  UIMSG_FIRST,
 
42
  UIMSG_STRING, UIMSG_BUILD, UIMSG_RRSEARCH, UIMSG_RRFOUND,
 
43
  UIMSG_RRNOTFOUND, UIMSG_RRDAMAGED, UIMSG_BLOCKSRECOVERED,
 
44
  UIMSG_COPYINGDATA, UIMSG_AREADAMAGED, UIMSG_SECTORDAMAGED,
 
45
  UIMSG_SECTORRECOVERED, UIMSG_SECTORNOTRECOVERED, UIMSG_FOUND,
 
46
  UIMSG_CORRECTINGNAME, UIMSG_BADARCHIVE, UIMSG_CREATING, UIMSG_RENAMING,
 
47
  UIMSG_RECVOLCALCCHECKSUM, UIMSG_RECVOLFOUND, UIMSG_RECVOLMISSING,
 
48
  UIMSG_MISSINGVOL, UIMSG_RECONSTRUCTING, UIMSG_CHECKSUM, UIMSG_FAT32SIZE,
 
49
 
 
50
  UIWAIT_FIRST,
 
51
  UIWAIT_DISKFULLNEXT, UIWAIT_FCREATEERROR,
 
52
 
 
53
  UIEVENT_FIRST,
 
54
  UIEVENT_SEARCHDUPFILES, UIEVENT_CLEARATTRSTART, UIEVENT_CLEARATTRFILE,
 
55
  UIEVENT_DELADDEDSTART, UIEVENT_DELADDEDFILE, UIEVENT_FILESFOUND,
 
56
  UIEVENT_ERASEDISK, UIEVENT_FILESUMSTART, UIEVENT_FILESUMPROGRESS,
 
57
  UIEVENT_FILESUMEND, UIEVENT_PROTECTSTART, UIEVENT_PROTECTEND,
 
58
  UIEVENT_TESTADDEDSTART, UIEVENT_TESTADDEDEND, UIEVENT_RRTESTINGSTART,
 
59
  UIEVENT_RRTESTINGEND, UIEVENT_NEWARCHIVE, UIEVENT_NEWREVFILE
 
60
};
 
61
 
 
62
// Flags for uiAskReplace function.
 
63
enum UIASKREP_FLAGS {
 
64
  UIASKREP_F_NORENAME=1,UIASKREP_F_EXCHSRCDEST=2,UIASKREP_F_SHOWNAMEONLY=4
 
65
};
 
66
 
 
67
// Codes returned by uiAskReplace. Note that uiAskReplaceEx returns only
 
68
// UIASKREP_R_REPLACE, UIASKREP_R_SKIP and UIASKREP_R_CANCEL codes.
 
69
enum UIASKREP_RESULT {
 
70
  UIASKREP_R_REPLACE,UIASKREP_R_SKIP,UIASKREP_R_REPLACEALL,UIASKREP_R_SKIPALL,
 
71
  UIASKREP_R_RENAME,UIASKREP_R_RENAMEAUTO,UIASKREP_R_CANCEL,UIASKREP_R_UNUSED
 
72
};
 
73
 
 
74
UIASKREP_RESULT uiAskReplace(wchar *Name,size_t MaxNameSize,int64 FileSize,RarTime *FileTime,uint Flags);
 
75
UIASKREP_RESULT uiAskReplaceEx(RAROptions *Cmd,wchar *Name,size_t MaxNameSize,int64 FileSize,RarTime *FileTime,uint Flags);
 
76
 
 
77
void uiInit(bool Sound);
 
78
 
 
79
 
 
80
void uiStartArchiveExtract(bool Extract,const wchar *ArcName);
 
81
bool uiStartFileExtract(const wchar *FileName,bool Extract,bool Test,bool Skip);
 
82
void uiExtractProgress(int64 CurFileSize,int64 TotalFileSize,int64 CurSize,int64 TotalSize);
 
83
void uiProcessProgress(const char *Command,int64 CurSize,int64 TotalSize);
 
84
 
 
85
enum UIPASSWORD_TYPE {UIPASSWORD_GLOBAL,UIPASSWORD_FILE,UIPASSWORD_ARCHIVE};
 
86
bool uiGetPassword(UIPASSWORD_TYPE Type,const wchar *FileName,SecPassword *Password);
 
87
 
 
88
enum UIALARM_TYPE {UIALARM_ERROR, UIALARM_INFO, UIALARM_QUESTION};
 
89
void uiAlarm(UIALARM_TYPE Type);
 
90
 
 
91
 
 
92
bool uiAskNextVolume(wchar *VolName,size_t MaxSize);
 
93
bool uiAskRepeatRead(const wchar *FileName);
 
94
bool uiAskRepeatWrite(const wchar *FileName,bool DiskFull);
 
95
 
 
96
#ifndef SFX_MODULE
 
97
const wchar *uiGetMonthName(int Month);
 
98
#endif
 
99
 
 
100
 
 
101
class uiMsgStore
 
102
{
 
103
  private:
 
104
    static const size_t MAX_MSG = 8;
 
105
    const wchar *Str[MAX_MSG];
 
106
    uint Num[MAX_MSG];
 
107
    uint StrSize,NumSize;
 
108
    UIMESSAGE_CODE Code;
 
109
  public:
 
110
    uiMsgStore(UIMESSAGE_CODE Code)
 
111
    {
 
112
      NumSize=StrSize=0;
 
113
      this->Code=Code;
 
114
    }
 
115
    uiMsgStore& operator << (const wchar *s)
 
116
    {
 
117
      if (StrSize<MAX_MSG)
 
118
        Str[StrSize++]=s;
 
119
      return *this;
 
120
    }
 
121
    uiMsgStore& operator << (uint n)
 
122
    {
 
123
      if (NumSize<MAX_MSG)
 
124
        Num[NumSize++]=n;
 
125
      return *this;
 
126
    }
 
127
 
 
128
    void Msg();
 
129
};
 
130
 
 
131
 
 
132
// Templates recognize usual NULL as integer, not wchar*.
 
133
#define UINULL ((wchar *)NULL)
 
134
 
 
135
inline void uiMsg(UIMESSAGE_CODE Code)
 
136
{
 
137
  uiMsgStore Store(Code);
 
138
  Store.Msg();
 
139
}
 
140
 
 
141
template<class T1> void uiMsg(UIMESSAGE_CODE Code,T1 a1)
 
142
{
 
143
  uiMsgStore Store(Code);
 
144
  Store<<a1;
 
145
  Store.Msg();
 
146
}
 
147
 
 
148
template<class T1,class T2> void uiMsg(UIMESSAGE_CODE Code,T1 a1,T2 a2)
 
149
{
 
150
  uiMsgStore Store(Code);
 
151
  Store<<a1<<a2;
 
152
  Store.Msg();
 
153
}
 
154
 
 
155
template<class T1,class T2,class T3> void uiMsg(UIMESSAGE_CODE code,T1 a1,T2 a2,T3 a3)
 
156
{
 
157
  uiMsgStore Store(code);
 
158
  Store<<a1<<a2<<a3;
 
159
  Store.Msg();
 
160
}
 
161
 
 
162
#endif