TPascalCodeGenerator class
Pascal code generator class
Declaration
TPascalCodeGenerator = class(TComponent)Inheritance
- TPascalCodeGenerator
- TComponent
- TPersistent
- TObject
Description
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
Source property.
The class supports dotted unit names and provides configurable keyword escaping.See also
Properties
Source | public | Generated source code string list |
CurrentSection | public | Current code section type |
OutputUnitName | published | Name of the output unit |
ExtraUnits | published | Additional units for uses clause |
DottedExtraUnits | published | Additional units for dotted uses clause |
DottedDefine | published | Compiler define for dotted units |
DottedUnitsSupport | published | Level of dotted units support |
LicenseText | published | License text for header comment |
Switches | published | Compiler switches for the unit |
AddTimeStamp | published | Whether to include timestamp in header |
KeywordSuffix | published | Suffix for escaped keywords |
KeywordPrefix | published | Prefix for escaped keywords |
Methods
DoLog | protected | Trigger log event |
BaseUnits | protected | Get base units for uses clause |
DottedBaseUnits | protected | Get base units for dotted uses clause |
Create | public | Create new Pascal code generator instance |
Destroy | public | Destroy Pascal code generator instance |
EnsureSection | public | Ensure code is in specified section |
PushSection | public | Push section onto section stack |
PopSection | public | Pop section from section stack |
CreateHeader | public | Create unit header section |
CreateUnitClause | public | Create unit clause |
Indent | public | Increase indentation level |
Undent | public | Decrease indentation level |
IsKeyWord | public | Check if string is Pascal keyword |
EscapeKeyWord | public | Escape Pascal keyword if needed |
MakePascalString | public | Convert string to Pascal string literal |
PrettyPrint | public | Format string with proper capitalization |
AddLn | public | Add line to source code with current indentation |
Comment | public | Add comment to source code |
ClassComment | public | Add formatted class comment header |
ClassHeader | public | Add class header comment (deprecated) |
SimpleMethodBody | public | Generate simple method body |
SaveToStream | public | Save generated source code to stream |
SaveToFile | public | Save generated source code to file |
Events
OnLog | published | Event handler for log messages |
Inherited
From TComponent (74)
_AddRef _Release BeforeDestruction CanObserve ChangeName ComObject ComponentCount ComponentIndex Components ComponentState ComponentStyle DefineProperties DesignInfo DestroyComponents Destroying ExecuteAction FindComponent FreeNotification FreeOnRelease GetChildOwner GetChildParent GetChildren GetDeltaStreams GetEnumerator GetIDsOfNames GetNamePath GetObservers GetOwner GetParentComponent GetTypeInfo GetTypeInfoCount HasParent iicrGetComponent InsertComponent Invoke IsImplementorOf Loaded Loading Name Notification ObserverAdded Observers OnGetDeltaStreams Owner PaletteCreated QueryInterface ReadDeltaState ReadDeltaStream ReadState ReferenceInterface RemoveComponent RemoveFreeNotification RemoveFreeNotifications SafeCallException SetAncestor SetChildOrder SetDesigning SetDesignInstance SetInline SetName SetParentComponent SetSubComponent Tag ToString TToStringNameMode UpdateAction Updated UpdateRegistry Updating ValidateContainer ValidateInsert ValidateRename VCLComObject WriteState
From TPersistent (5)
Assign AssignTo FPOAttachObserver FPODetachObserver FPONotifyObservers
From TObject (37)
AfterConstruction CheckDisposed ClassInfo ClassName ClassNameIs ClassParent ClassType CleanupInstance DefaultHandler DefaultHandlerStr Dispatch DispatchStr Disposed DisposeOf Equals FieldAddress Free FreeInstance GetDisposed GetHashCode GetInterface GetInterfaceByStr GetInterfaceEntry GetInterfaceEntryByStr GetInterfaceTable GetInterfaceWeak GetLastCastErrorInfo InheritsFrom InitInstance InstanceSize MethodAddress MethodName newinstance QualifiedClassName StringMessageTable SystemHasExtendedRTTI UnitName
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
