CopyParam.h 4.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //---------------------------------------------------------------------------
  2. #ifndef CopyParamH
  3. #define CopyParamH
  4. #include "FileMasks.h"
  5. #include "RemoteFiles.h"
  6. //---------------------------------------------------------------------------
  7. // When adding new options, mind TCopyParamType::GetLogStr()
  8. enum TOperationSide { osLocal, osRemote, osCurrent };
  9. enum TFileNameCase { ncNoChange, ncUpperCase, ncLowerCase, ncFirstUpperCase, ncLowerCaseShort };
  10. // TScript::OptionProc depend on the order
  11. enum TTransferMode { tmBinary, tmAscii, tmAutomatic };
  12. enum TResumeSupport { rsOn, rsSmart, rsOff };
  13. class THierarchicalStorage;
  14. //---------------------------------------------------------------------------
  15. class TCopyParamType {
  16. private:
  17. TFileMasks FAsciiFileMask;
  18. TFileNameCase FFileNameCase;
  19. bool FPreserveReadOnly;
  20. bool FPreserveTime;
  21. TRights FRights;
  22. TTransferMode FTransferMode;
  23. bool FAddXToDirectories;
  24. bool FPreserveRights;
  25. TResumeSupport FResumeSupport;
  26. __int64 FResumeThreshold;
  27. AnsiString __fastcall GetLogStr() const;
  28. char FInvalidCharsReplacement;
  29. AnsiString FLocalInvalidChars;
  30. AnsiString FTokenizibleChars;
  31. bool FCalculateSize;
  32. AnsiString FFileMask;
  33. TFileMasks FExcludeFileMask;
  34. bool FNegativeExclude;
  35. bool FClearArchive;
  36. static const char TokenPrefix = '%';
  37. static const char NoReplacement = char(false);
  38. static const char TokenReplacement = char(true);
  39. static AnsiString __fastcall Untokenize(AnsiString FileName);
  40. void __fastcall SetLocalInvalidChars(AnsiString value);
  41. bool __fastcall GetReplaceInvalidChars() const;
  42. void __fastcall SetReplaceInvalidChars(bool value);
  43. public:
  44. __fastcall TCopyParamType();
  45. __fastcall TCopyParamType(const TCopyParamType & Source);
  46. virtual __fastcall ~TCopyParamType();
  47. TCopyParamType & __fastcall operator =(const TCopyParamType & rhp);
  48. virtual void __fastcall Assign(const TCopyParamType * Source);
  49. virtual void __fastcall Default();
  50. AnsiString __fastcall ChangeFileName(AnsiString FileName,
  51. TOperationSide Side, bool FirstLevel) const;
  52. int __fastcall LocalFileAttrs(const TRights & Rights) const;
  53. TRights __fastcall RemoteFileRights(int Attrs) const;
  54. bool __fastcall UseAsciiTransfer(AnsiString FileName, TOperationSide Side) const;
  55. bool __fastcall AllowResume(__int64 Size) const;
  56. AnsiString __fastcall ValidLocalFileName(AnsiString FileName) const;
  57. bool __fastcall AllowTransfer(AnsiString FileName, TOperationSide Side,
  58. bool Directory) const;
  59. void __fastcall Load(THierarchicalStorage * Storage);
  60. void __fastcall Save(THierarchicalStorage * Storage) const;
  61. static const int cpiExcludeMaskOnly = 0x01;
  62. AnsiString __fastcall GetInfoStr(AnsiString Separator, int Options = 0) const;
  63. bool __fastcall operator==(const TCopyParamType & rhp) const;
  64. __property TFileMasks AsciiFileMask = { read = FAsciiFileMask, write = FAsciiFileMask };
  65. __property TFileNameCase FileNameCase = { read = FFileNameCase, write = FFileNameCase };
  66. __property bool PreserveReadOnly = { read = FPreserveReadOnly, write = FPreserveReadOnly };
  67. __property bool PreserveTime = { read = FPreserveTime, write = FPreserveTime };
  68. __property TRights Rights = { read = FRights, write = FRights };
  69. __property TTransferMode TransferMode = { read = FTransferMode, write = FTransferMode };
  70. __property AnsiString LogStr = { read=GetLogStr };
  71. __property bool AddXToDirectories = { read=FAddXToDirectories, write=FAddXToDirectories };
  72. __property bool PreserveRights = { read = FPreserveRights, write = FPreserveRights };
  73. __property TResumeSupport ResumeSupport = { read = FResumeSupport, write = FResumeSupport };
  74. __property __int64 ResumeThreshold = { read = FResumeThreshold, write = FResumeThreshold };
  75. __property char InvalidCharsReplacement = { read = FInvalidCharsReplacement, write = FInvalidCharsReplacement };
  76. __property bool ReplaceInvalidChars = { read = GetReplaceInvalidChars, write = SetReplaceInvalidChars };
  77. __property AnsiString LocalInvalidChars = { read = FLocalInvalidChars, write = SetLocalInvalidChars };
  78. __property bool CalculateSize = { read = FCalculateSize, write = FCalculateSize };
  79. __property AnsiString FileMask = { read = FFileMask, write = FFileMask };
  80. __property TFileMasks ExcludeFileMask = { read = FExcludeFileMask, write = FExcludeFileMask };
  81. __property bool NegativeExclude = { read = FNegativeExclude, write = FNegativeExclude };
  82. __property bool ClearArchive = { read = FClearArchive, write = FClearArchive };
  83. };
  84. //---------------------------------------------------------------------------
  85. #endif