Changeset 59 for trunk/IDE/UCore.pas


Ignore:
Timestamp:
Jul 17, 2012, 6:44:54 AM (12 years ago)
Author:
chronos
Message:
  • Modified: Compiler will accept source code not only from files but it can be feed by in-memory content.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/IDE/UCore.pas

    r57 r59  
    1313
    1414  TCustomCompiler = class(TCompiler)
     15    SourceFiles: TSourceFileManager;
     16    TargetFiles: TSourceFileManager;
    1517    procedure LoadFromRegistry(Root: HKEY; Key: string);
    1618    procedure SaveToRegistry(Root: HKEY; Key: string);
     19    constructor Create; override;
     20    destructor Destroy; override;
    1721  end;
    1822
     
    2933  private
    3034    procedure ProjectChange(Sender: TObject);
     35    function LoadSourceFile(FileName: string; var Content: string): Boolean;
     36    function SaveSourceFile(FileName: string; const Content: string): Boolean;
    3137  public
    3238    ReopenLastOpenedFile: Boolean;
     
    8187  DeleteFile(DebugLog1.FileName);
    8288  Compiler := TCustomCompiler.Create;
     89  //Compiler.OnLoadSource := LoadSourceFile;
     90  //Compiler.OnSaveTarget := SaveSourceFile;
    8391  Project := TProject.Create;
    8492  ProjectTemplates := TProjectTemplateList.Create;
     
    116124begin
    117125  FormMain.UpdateInterface;
     126end;
     127
     128function TCore.LoadSourceFile(FileName: string; var Content: string): Boolean;
     129begin
     130
     131end;
     132
     133function TCore.SaveSourceFile(FileName: string; const Content: string): Boolean;
     134begin
     135
    118136end;
    119137
     
    205223end;
    206224
     225constructor TCustomCompiler.Create;
     226begin
     227  inherited Create;
     228  SourceFiles := TSourceFileManager.Create;
     229  TargetFiles := TSourceFileManager.Create;
     230  OnLoadSource := SourceFiles.GetFileContent;
     231  OnSaveTarget := TargetFiles.SetFileContent;
     232end;
     233
     234destructor TCustomCompiler.Destroy;
     235begin
     236  TargetFiles.Free;
     237  SourceFiles.Free;
     238  inherited Destroy;
     239end;
     240
    207241
    208242end.
Note: See TracChangeset for help on using the changeset viewer.