Last active
May 26, 2016 21:44
-
-
Save JordiCorbilla/0c14137a7369a9f09862e597b73b2440 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @Author: Jordi Corbilla | |
* (c) Copyright by Jordi Corbilla. | |
**/ | |
TUML = class(TObject) | |
private | |
FFormat: string; | |
FOutFile: TLog; | |
FUmlFileName: string; | |
public | |
property Format: string read FFormat write FFormat; | |
constructor Create(umlFileName: string); | |
class function Start(umlFileName: string): TUML; | |
procedure Define(name : String; kind : String); overload; | |
procedure Define(); overload; | |
procedure Call(caller: string; callee: string; method: string; params: string); overload; | |
procedure Call(caller: string; callee: string; method: string; params: string; result: string); overload; | |
procedure Convert(); | |
end; | |
const | |
DefaultFormat = 'jpg'; | |
DefaultLocationLibrary = '..\..\thirdpartylibs\sdedit\sdedit.jar'; | |
implementation | |
uses | |
ShellAPI, Windows; | |
{ TUML } | |
procedure TUML.Call(caller, callee, method, params: string); | |
begin | |
FOutFile.print(caller + ':' + callee + '.' + method + '(' + params + ')'); | |
end; | |
procedure TUML.Call(caller, callee, method, params, result: string); | |
begin | |
FOutFile.print(caller + ':' + result + '=' + callee + '.' + method + '(' + params + ')'); | |
end; | |
procedure TUML.Convert(); | |
var | |
params: string; | |
FileINFormat: string; | |
FileOutFormat: string; | |
begin | |
FileINFormat := FUmlFileName + '.sdx'; | |
FileOutFormat := FUmlFileName + '.' + FFormat; | |
params := '-jar ' + DefaultLocationLibrary + ' -o ' + FileOutFormat + ' -t ' + FFormat + ' -r landscape ' + FileINFormat; | |
ShellExecute(0, nil, 'java.exe', PChar(params), nil, SW_HIDE); | |
end; | |
constructor TUML.Create(umlFileName: string); | |
begin | |
FOutFile := TLog.Start(umlFileName + '.sdx'); | |
FFormat := DefaultFormat; | |
FUmlFileName := umlFileName; | |
end; | |
procedure TUML.Define; | |
begin | |
FOutFile.print(''); | |
end; | |
procedure TUML.Define(name, kind: String); | |
begin | |
FOutFile.print(name + ':' + kind); | |
end; | |
class function TUML.Start(umlFileName: string): TUML; | |
begin | |
result := Create(umlFileName); | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment