Class TPasUnit
Unit
Declaration
type TPasUnit = class(TPasItem)
Description
extends TPasItem to store anything about a unit, its constants, types etc.; also provides methods for parsing a complete unit.
Note: Remember to always set CacheDateTime after deserializing this unit.
Source: source/component/PasDoc_Items.pas (line 1023).
Hierarchy
- TObject
- TSerializable
- TBaseItem
- TPasItem
- TPasUnit
Overview
Fields
| Protected | FTypes: TPasTypes; |
| Protected | FVariables: TPasItems; |
| Protected | FCIOs: TPasItems; |
| Protected | FConstants: TPasItems; |
| Protected | FFuncsProcs: TPasRoutines; |
| Protected | FUsesUnits: TStringVector; |
| Protected | FSourceFilename: string; |
| Protected | FOutputFileName: string; |
| Protected | FCacheDateTime: TDateTime; |
| Protected | FSourceFileDateTime: TDateTime; |
| Protected | FIsUnit: boolean; |
| Protected | FIsProgram: boolean; |
Methods
| Protected | procedure Serialize(const ADestination: TStream); override; |
| Protected | procedure Deserialize(const ASource: TStream); override; |
| Public | constructor Create; override; |
| Public | destructor Destroy; override; |
| Public | procedure AddCIO(const i: TPasCio); |
| Public | procedure AddConstant(const i: TPasItem); |
| Public | procedure AddType(const i: TPasItem); |
| Public | procedure AddVariable(const i: TPasItem); |
| Public | function FindInsideSomeClass(const AClassName, ItemInsideClass: string): TPasItem; |
| Public | function FindInsideSomeEnum(const EnumName, EnumMember: string): TPasItem; |
| Public | function FindItem(const ItemName: string): TBaseItem; override; |
| Public | procedure Sort(const SortSettings: TSortSettings); override; |
| Public | function FileNewerThanCache(const FileName: string): boolean; |
| Public | function BasePath: string; override; |
Properties
| Public | property CIOs: TPasItems read FCIOs; |
| Public | property Constants: TPasItems read FConstants; |
| Public | property FuncsProcs: TPasRoutines read FFuncsProcs; |
| Public | property UsesUnits: TStringVector read FUsesUnits; |
| Public | property Types: TPasTypes read FTypes; |
| Public | property Variables: TPasItems read FVariables; |
| Public | property OutputFileName: string read FOutputFileName write FOutputFileName; |
| Public | property SourceFileName: string read FSourceFilename write FSourceFilename; |
| Public | property SourceFileDateTime: TDateTime
read FSourceFileDateTime write FSourceFileDateTime; |
| Public | property CacheDateTime: TDateTime
read FCacheDateTime write FCacheDateTime; |
| Public | property IsUnit: boolean read FIsUnit write FIsUnit; |
| Public | property IsProgram: boolean read FIsProgram write FIsProgram; |
Description
Fields
| Protected | FTypes: TPasTypes; |
|
This item has no description. | |
| Protected | FVariables: TPasItems; |
|
This item has no description. | |
| Protected | FCIOs: TPasItems; |
|
This item has no description. | |
| Protected | FConstants: TPasItems; |
|
This item has no description. | |
| Protected | FFuncsProcs: TPasRoutines; |
|
This item has no description. | |
| Protected | FUsesUnits: TStringVector; |
|
This item has no description. | |
| Protected | FSourceFilename: string; |
|
This item has no description. | |
| Protected | FOutputFileName: string; |
|
This item has no description. | |
| Protected | FCacheDateTime: TDateTime; |
|
This item has no description. | |
| Protected | FSourceFileDateTime: TDateTime; |
|
This item has no description. | |
| Protected | FIsUnit: boolean; |
|
This item has no description. | |
| Protected | FIsProgram: boolean; |
|
This item has no description. | |
Methods
| Protected | procedure Serialize(const ADestination: TStream); override; |
|
This item has no description. Showing description inherited from TBaseItem.Serialize. Serialization of TPasItem need to store in stream only data that is generated by parser. That's because current approach treats "loading from cache" as equivalent to parsing a unit and stores to cache right after parsing a unit. So what is generated by parser must be written to cache. That said,
| |
| Protected | procedure Deserialize(const ASource: TStream); override; |
|
This item has no description. | |
| Public | constructor Create; override; |
|
This item has no description. | |
| Public | destructor Destroy; override; |
|
This item has no description. | |
| Public | procedure AddCIO(const i: TPasCio); |
|
This item has no description. | |
| Public | procedure AddConstant(const i: TPasItem); |
|
This item has no description. | |
| Public | procedure AddType(const i: TPasItem); |
|
This item has no description. | |
| Public | procedure AddVariable(const i: TPasItem); |
|
This item has no description. | |
| Public | function FindInsideSomeClass(const AClassName, ItemInsideClass: string): TPasItem; |
|
This item has no description. | |
| Public | function FindInsideSomeEnum(const EnumName, EnumMember: string): TPasItem; |
|
This item has no description. | |
| Public | function FindItem(const ItemName: string): TBaseItem; override; |
|
This item has no description. Showing description inherited from TBaseItem.FindItem. Search for an item called ItemName inside this Pascal item. For units, it searches for items declared inside this unit (like a procedure, or a class in this unit). For classes it searches for items declared within this class (like a method or a property). For an enumerated type, it searches for members of this enumerated type. All normal rules of ObjectPascal scope apply, which means that e.g. if this item is a unit, Returns nil if not found. Note that it never compares ItemName with Self.Name. You may want to check this yourself if you want. Note that for TPasItem descendants, it always returns also some TPasItem descendant (so if you use this method with some TPasItem instance, you can safely cast result of this method to TPasItem). Implementation in this class always returns nil. Override as necessary. | |
| Public | procedure Sort(const SortSettings: TSortSettings); override; |
|
This item has no description. Showing description inherited from TPasItem.Sort. This recursively sorts all items inside this item, and all items inside these items, etc. E.g. in case of TPasUnit, this method sorts all variables, consts, CIOs etc. inside (honouring SortSettings), and also recursively calls Sort(SortSettings) for every CIO. Note that this does not guarantee that absolutely everything inside will be really sorted. Some items may be deliberately left unsorted, e.g. Members of TPasEnum are never sorted (their declared order always matters, so we shouldn't sort them when displaying their documentation — reader of such documentation would be seriously misleaded). Sorting of other things depends on SortSettings — e.g. without ssMethods, CIOs methods will not be sorted. So actually this method makes sure that all things that should be sorted are really sorted. | |
| Public | function FileNewerThanCache(const FileName: string): boolean; |
|
Returns if unit WasDeserialized, and file FileName exists, and file FileName is newer than CacheDateTime. So if FileName contains some info generated from information of this unit, then we can somehow assume that FileName still contains valid information and we don't have to write it once again. Sure, we're not really 100% sure that FileName still contains valid information, but that's how current approach to cache works. | |
| Public | function BasePath: string; override; |
|
This item has no description. Showing description inherited from TBaseItem.BasePath. The full (absolute) path used to resolve filenames in this item's descriptions. Must always end with PathDelim. In this class, this simply returns GetCurrentDir (with PathDelim added if needed). | |
Properties
| Public | property CIOs: TPasItems read FCIOs; |
|
list of classes, interfaces, objects, and records defined in this unit | |
| Public | property Constants: TPasItems read FConstants; |
|
list of constants defined in this unit | |
| Public | property FuncsProcs: TPasRoutines read FFuncsProcs; |
|
list of functions and procedures defined in this unit | |
| Public | property UsesUnits: TStringVector read FUsesUnits; |
|
The names of all units mentioned in a uses clause in the interface section of this unit. This is never nil. After TDocGenerator.BuildLinks, for every i: UsesUnits.Objects[i] will point to TPasUnit object with Name = UsesUnits[i] (or nil, if pasdoc's didn't parse such unit). In other words, you will be able to use UsesUnits.Objects[i] to obtain given unit's instance, as parsed by pasdoc. | |
| Public | property Types: TPasTypes read FTypes; |
|
list of types defined in this unit | |
| Public | property Variables: TPasItems read FVariables; |
|
list of variables defined in this unit | |
| Public | property OutputFileName: string read FOutputFileName write FOutputFileName; |
|
name of documentation output file THIS SHOULD NOT BE HERE! | |
| Public | property SourceFileName: string read FSourceFilename write FSourceFilename; |
|
This item has no description. | |
| Public | property SourceFileDateTime: TDateTime
read FSourceFileDateTime write FSourceFileDateTime; |
|
This item has no description. | |
| Public | property CacheDateTime: TDateTime
read FCacheDateTime write FCacheDateTime; |
|
If WasDeserialized then this specifies the datetime of a cache data of this unit, i.e. when cache data was generated. If cache was obtained from a file then this is just the cache file modification date/time. If not WasDeserialized then this property has undefined value – don't use it. | |
| Public | property IsUnit: boolean read FIsUnit write FIsUnit; |
|
If | |
| Public | property IsProgram: boolean read FIsProgram write FIsProgram; |
|
This item has no description. | |
Generated by PasDoc 0.17.0.snapshot.