Sign in Join
FPDoc Onlineexperiment

TPascalCodeGenerator class

In unit PasCodeGen

Pascal code generator class

Declaration

pascal
TPascalCodeGenerator = class(TComponent)

Inheritance

  1. TPascalCodeGenerator
  2. TComponent
  3. TPersistent
  4. 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

SourcepublicGenerated source code string list
CurrentSectionpublicCurrent code section type
OutputUnitNamepublishedName of the output unit
ExtraUnitspublishedAdditional units for uses clause
DottedExtraUnitspublishedAdditional units for dotted uses clause
DottedDefinepublishedCompiler define for dotted units
DottedUnitsSupportpublishedLevel of dotted units support
LicenseTextpublishedLicense text for header comment
SwitchespublishedCompiler switches for the unit
AddTimeStamppublishedWhether to include timestamp in header
KeywordSuffixpublishedSuffix for escaped keywords
KeywordPrefixpublishedPrefix for escaped keywords

Methods

DoLogprotectedTrigger log event
BaseUnitsprotectedGet base units for uses clause
DottedBaseUnitsprotectedGet base units for dotted uses clause
CreatepublicCreate new Pascal code generator instance
DestroypublicDestroy Pascal code generator instance
EnsureSectionpublicEnsure code is in specified section
PushSectionpublicPush section onto section stack
PopSectionpublicPop section from section stack
CreateHeaderpublicCreate unit header section
CreateUnitClausepublicCreate unit clause
IndentpublicIncrease indentation level
UndentpublicDecrease indentation level
IsKeyWordpublicCheck if string is Pascal keyword
EscapeKeyWordpublicEscape Pascal keyword if needed
MakePascalStringpublicConvert string to Pascal string literal
PrettyPrintpublicFormat string with proper capitalization
AddLnpublicAdd line to source code with current indentation
CommentpublicAdd comment to source code
ClassCommentpublicAdd formatted class comment header
ClassHeaderpublicAdd class header comment (deprecated)
SimpleMethodBodypublicGenerate simple method body
SaveToStreampublicSave generated source code to stream
SaveToFilepublicSave generated source code to file

Events

OnLogpublishedEvent 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.