Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | // ArchiverInfo.h |
michael@0 | 2 | |
michael@0 | 3 | #ifndef __ARCHIVERINFO_H |
michael@0 | 4 | #define __ARCHIVERINFO_H |
michael@0 | 5 | |
michael@0 | 6 | #include "Common/String.h" |
michael@0 | 7 | #include "Common/Types.h" |
michael@0 | 8 | #include "Common/Buffer.h" |
michael@0 | 9 | |
michael@0 | 10 | struct CArchiverExtInfo |
michael@0 | 11 | { |
michael@0 | 12 | UString Ext; |
michael@0 | 13 | UString AddExt; |
michael@0 | 14 | CArchiverExtInfo() {} |
michael@0 | 15 | CArchiverExtInfo(const UString &ext): Ext(ext) {} |
michael@0 | 16 | CArchiverExtInfo(const UString &ext, const UString &addExt): Ext(ext), AddExt(addExt) {} |
michael@0 | 17 | }; |
michael@0 | 18 | |
michael@0 | 19 | struct CArchiverInfo |
michael@0 | 20 | { |
michael@0 | 21 | #ifndef EXCLUDE_COM |
michael@0 | 22 | UString FilePath; |
michael@0 | 23 | CLSID ClassID; |
michael@0 | 24 | #endif |
michael@0 | 25 | UString Name; |
michael@0 | 26 | CObjectVector<CArchiverExtInfo> Extensions; |
michael@0 | 27 | #ifndef _SFX |
michael@0 | 28 | CByteBuffer StartSignature; |
michael@0 | 29 | CByteBuffer FinishSignature; |
michael@0 | 30 | bool Associate; |
michael@0 | 31 | #endif |
michael@0 | 32 | int FindExtension(const UString &ext) const |
michael@0 | 33 | { |
michael@0 | 34 | for (int i = 0; i < Extensions.Size(); i++) |
michael@0 | 35 | if (ext.CompareNoCase(Extensions[i].Ext) == 0) |
michael@0 | 36 | return i; |
michael@0 | 37 | return -1; |
michael@0 | 38 | } |
michael@0 | 39 | UString GetAllExtensions() const |
michael@0 | 40 | { |
michael@0 | 41 | UString s; |
michael@0 | 42 | for (int i = 0; i < Extensions.Size(); i++) |
michael@0 | 43 | { |
michael@0 | 44 | if (i > 0) |
michael@0 | 45 | s += ' '; |
michael@0 | 46 | s += Extensions[i].Ext; |
michael@0 | 47 | } |
michael@0 | 48 | return s; |
michael@0 | 49 | } |
michael@0 | 50 | const UString &GetMainExtension() const |
michael@0 | 51 | { |
michael@0 | 52 | return Extensions[0].Ext; |
michael@0 | 53 | } |
michael@0 | 54 | bool UpdateEnabled; |
michael@0 | 55 | bool KeepName; |
michael@0 | 56 | |
michael@0 | 57 | CArchiverInfo(): UpdateEnabled(false), KeepName(false) |
michael@0 | 58 | #ifndef _SFX |
michael@0 | 59 | ,Associate(true) |
michael@0 | 60 | #endif |
michael@0 | 61 | {} |
michael@0 | 62 | }; |
michael@0 | 63 | |
michael@0 | 64 | void ReadArchiverInfoList(CObjectVector<CArchiverInfo> &archivers); |
michael@0 | 65 | |
michael@0 | 66 | #endif |