2
0

DXPFPCConfig.pas 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. // DXPFPCConfig
  2. {
  3. FPC Globals for DXPExpert.<p>
  4. Licensed under MPL (http://www.mozilla.org/MPL/)
  5. Copyright 2003 - Eric Grange
  6. }
  7. unit DXPFPCConfig;
  8. interface
  9. uses Classes, DXPConfig, SysUtils;
  10. type
  11. // TDXPFPCConfig
  12. //
  13. TDXPFPCConfig = class (TDXPConfig)
  14. private
  15. { Private Declarations }
  16. FOptions : TStrings;
  17. public
  18. { Public Declarations }
  19. constructor Create; override;
  20. destructor Destroy; override;
  21. procedure SaveToStream(aStream : TStream); override;
  22. procedure LoadFromStream(aStream : TStream); override;
  23. property Options : TStrings read FOptions;
  24. end;
  25. // -----------------------------------------------------------------
  26. // -----------------------------------------------------------------
  27. // -----------------------------------------------------------------
  28. implementation
  29. // -----------------------------------------------------------------
  30. // -----------------------------------------------------------------
  31. // -----------------------------------------------------------------
  32. const
  33. cFPCConfigVersion = 'FPCcfg-00.01';
  34. cDefaultFPCoptions = '-OG -O2 -Op3 -Or -Sg -Sh -Sa -Ci -vwnh -Xs -XX';
  35. // Create
  36. //
  37. constructor TDXPFPCConfig.Create;
  38. begin
  39. inherited;
  40. FOptions:=TStringList.Create;
  41. TStringList(FOptions).CaseSensitive:=True;
  42. FOptions.CommaText:=cDefaultFPCoptions;
  43. end;
  44. // Destroy
  45. //
  46. destructor TDXPFPCConfig.Destroy;
  47. begin
  48. FOptions.Free;
  49. inherited;
  50. end;
  51. // SaveToStream
  52. //
  53. procedure TDXPFPCConfig.SaveToStream(aStream : TStream);
  54. begin
  55. WriteString(aStream, cFPCConfigVersion);
  56. WriteString(aStream, FOptions.CommaText);
  57. end;
  58. // LoadFromStream
  59. //
  60. procedure TDXPFPCConfig.LoadFromStream(aStream : TStream);
  61. begin
  62. if ReadString(aStream)<>cFPCConfigVersion then
  63. raise Exception.Create(ClassName+': invalid stream');
  64. FOptions.CommaText:=ReadString(aStream);
  65. end;
  66. end.