IdCoderUUE.pas 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. Classes,
  34. IdCoder00E, IdCoder3to4;
  35. type
  36. TIdDecoderUUE = class(TIdDecoder00E)
  37. public
  38. constructor Create(AOwner: TComponent); override;
  39. end;
  40. TIdEncoderUUE = class(TIdEncoder00E)
  41. public
  42. constructor Create(AOwner: TComponent); override;
  43. end;
  44. const
  45. // Note the embedded '
  46. GUUECodeTable: string = '`!"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_'; {do not localize}
  47. var
  48. GUUEDecodeTable: TIdDecodeTable;
  49. implementation
  50. uses
  51. IdGlobal;
  52. { TIdEncoderUUE }
  53. constructor TIdEncoderUUE.Create(AOwner: TComponent);
  54. begin
  55. inherited Create(AOwner);
  56. FCodingTable := ToBytes(GUUECodeTable);
  57. FFillChar := GUUECodeTable[1];
  58. end;
  59. { TIdDecoderUUE }
  60. constructor TIdDecoderUUE.Create(AOwner: TComponent);
  61. begin
  62. inherited Create(AOwner);
  63. FDecodeTable := GUUEDecodeTable;
  64. FFillChar := GUUECodeTable[1];
  65. end;
  66. initialization
  67. TIdDecoder00E.ConstructDecodeTable(GUUECodeTable, GUUEDecodeTable);
  68. // Older UUEncoders use space instead of `. This way we account for both.
  69. GUUEDecodeTable[Ord(' ')] := GUUEDecodeTable[Ord('`')];
  70. end.