[Properties (by Name)] [Methods (by Name)] [Events (by Name)]
Pascal code generator class
Source position: pascodegen.pp line 47
type TPascalCodeGenerator = class(TComponent) |
||
public |
||
constructor Create(); override; |
|
Create new Pascal code generator instance |
destructor Destroy; override; |
|
Destroy Pascal code generator instance |
procedure EnsureSection(); |
|
Ensure code is in specified section |
procedure PushSection(); |
|
Push section onto section stack |
function PopSection; |
|
Pop section from section stack |
procedure CreateHeader; virtual; |
|
Create unit header section |
procedure CreateUnitClause; virtual; |
|
Create unit clause |
procedure Indent; |
|
Increase indentation level |
procedure Undent; |
|
Decrease indentation level |
function IsKeyWord(); virtual; |
|
Check if string is Pascal keyword |
function EscapeKeyWord(); virtual; |
|
Escape Pascal keyword if needed |
function MakePascalString(); |
|
Convert string to Pascal string literal |
function PrettyPrint(); |
|
Format string with proper capitalization |
procedure AddLn(); |
|
Add line to source code with current indentation |
procedure Comment(); |
|
Add comment to source code |
procedure ClassComment(); virtual; |
|
Add formatted class comment header |
procedure ClassHeader(); deprecated ; |
|
Add class header comment (deprecated) |
procedure SimpleMethodBody(); virtual; |
|
Generate simple method body |
procedure SaveToStream(); |
|
Save generated source code to stream |
procedure SaveToFile(); |
|
Save generated source code to file |
|
Generated source code string list |
|
property CurrentSection: TCodeSection; [rw] |
|
Current code section type |
published |
||
property OutputUnitName: string; [rw] |
|
Name of the output unit |
property ExtraUnits: string; [rw] |
|
Additional units for uses clause |
property DottedExtraUnits: string; [rw] |
|
Additional units for dotted uses clause |
property DottedDefine: string; [rw] |
|
Compiler define for dotted units |
property DottedUnitsSupport: TDottedUnitsSupport; [rw] |
|
Level of dotted units support |
property LicenseText: TStrings; [rw] |
|
License text for header comment |
|
Compiler switches for the unit |
|
property OnLog: TCodeGeneratorLogEvent; [rw] |
|
Event handler for log messages |
property AddTimeStamp: Boolean; [rw] |
|
Whether to include timestamp in header |
property KeywordSuffix: string; [rw] |
|
Suffix for escaped keywords |
property KeywordPrefix: string; [rw] |
|
Prefix for escaped keywords |
end; |
|
Pascal code generator class |
|
| | | ||
| | | ||
| | | ||
TPascalCodeGenerator is a class that provides functionality for generating Pascal code. It offers utility methods for code indentation, section management, logging and automatic handling of code blocks. The resulting generated code is available in a string list accessible through the TPascalCodeGenerator.Source property. The class supports dotted unit names and provides configurable keyword escaping.
|
Pascal code section types |
|
|
Event handler type for logging messages |