TatScriptRefactor Class
TatScriptRefactor is an auxiliary class that provides useful methods for safely change a script source code, like adding a unit in the uses clause, changing the form directive, among others.
Syntax
Unit: atScript
TatScriptRefactor = class(TPersistent);
Methods
| Name | Description |
|---|---|
| AddUsedUnit | Adds the unit AUnitName to the uses clause of the script source, if not already present. |
| BeginRefactor | Call BeginRefactor before doing any change to script source. This avoids the scripter engine to clear some references attached to the script, like events. |
| DeclareRoutine | Overloaded DeclareRoutine(string) DeclareRoutine(TatRoutineInfo) |
| EndRefactor | Call EndRefactor after doing any change to script source using the refactor. |
| SourcePos | Retrieve the position of the SubStr in the source code. Search starts from the position indicated by FromPos. |
| UpdateFormHeader | Creates or updates the $FORM directive in the script source with the specified form class name and file name. |
Properties
| Name | Description |
|---|---|
| Script | Returns the script object which the refactor belongs to. |
| Source | Retrieves the source code of the script associated with this refactor. |
| UpcaseSource | Retrieves the script source code all in upper case. |