IdCoderUUE.pas 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. {
  2. $Project$
  3. $Workfile$
  4. $Revision$
  5. $DateUTC$
  6. $Id$
  7. This file is part of the Indy (Internet Direct) project, and is offered
  8. under the dual-licensing agreement described on the Indy website.
  9. (http://www.indyproject.org/)
  10. Copyright:
  11. (c) 1993-2005, Chad Z. Hower and the Indy Pit Crew. All rights reserved.
  12. }
  13. {
  14. $Log$
  15. }
  16. {
  17. Rev 1.6 1/21/2004 1:44:16 PM JPMugaas
  18. InitComponent
  19. Rev 1.5 10/16/2003 11:11:18 PM DSiders
  20. Added localization comments.
  21. Rev 1.4 2003.06.13 6:57:12 PM czhower
  22. Speed improvement
  23. Rev 1.2 6/13/2003 07:58:48 AM JPMugaas
  24. Should now compile with new decoder design.
  25. Rev 1.1 2003.06.13 3:41:20 PM czhower
  26. Optimizaitions.
  27. Rev 1.0 11/14/2002 02:15:06 PM JPMugaas
  28. }
  29. unit IdCoderUUE;
  30. {$i IdCompilerDefines.inc}
  31. interface
  32. uses
  33. {$IFDEF WORKAROUND_INLINE_CONSTRUCTORS}
  34. Classes,
  35. {$ENDIF}
  36. IdCoder00E, IdCoder3to4;
  37. type
  38. TIdDecoderUUE = class(TIdDecoder00E)
  39. protected
  40. procedure InitComponent; override;
  41. {$IFDEF WORKAROUND_INLINE_CONSTRUCTORS}
  42. public
  43. constructor Create(AOwner: TComponent); reintroduce; overload;
  44. {$ENDIF}
  45. end;
  46. TIdEncoderUUE = class(TIdEncoder00E)
  47. protected
  48. procedure InitComponent; override;
  49. {$IFDEF WORKAROUND_INLINE_CONSTRUCTORS}
  50. public
  51. constructor Create(AOwner: TComponent); reintroduce; overload;
  52. {$ENDIF}
  53. end;
  54. const
  55. // Note the embedded '
  56. GUUECodeTable: string = '`!"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_'; {do not localize}
  57. var
  58. GUUEDecodeTable: TIdDecodeTable;
  59. implementation
  60. uses
  61. IdGlobal;
  62. { TIdEncoderUUE }
  63. {$IFDEF WORKAROUND_INLINE_CONSTRUCTORS}
  64. constructor TIdEncoderUUE.Create(AOwner: TComponent);
  65. begin
  66. inherited Create(AOwner);
  67. end;
  68. {$ENDIF}
  69. procedure TIdEncoderUUE.InitComponent;
  70. begin
  71. inherited InitComponent;
  72. FCodingTable := ToBytes(GUUECodeTable);
  73. FFillChar := GUUECodeTable[1];
  74. end;
  75. { TIdDecoderUUE }
  76. {$IFDEF WORKAROUND_INLINE_CONSTRUCTORS}
  77. constructor TIdDecoderUUE.Create(AOwner: TComponent);
  78. begin
  79. inherited Create(AOwner);
  80. end;
  81. {$ENDIF}
  82. procedure TIdDecoderUUE.InitComponent;
  83. begin
  84. inherited InitComponent;
  85. FDecodeTable := GUUEDecodeTable;
  86. FFillChar := GUUECodeTable[1];
  87. end;
  88. initialization
  89. TIdDecoder00E.ConstructDecodeTable(GUUECodeTable, GUUEDecodeTable);
  90. // Older UUEncoders use space instead of `. This way we account for both.
  91. GUUEDecodeTable[Ord(' ')] := GUUEDecodeTable[Ord('`')];
  92. end.