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.

Hierarchy

Overview

Fields

Protected FTypes: TPasTypes;
Protected FVariables: TPasItems;
Protected FCIOs: TPasItems;
Protected FConstants: TPasItems;
Protected FFuncsProcs: TPasMethods;
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: TPasMethods 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;
 
Protected FVariables: TPasItems;
 
Protected FCIOs: TPasItems;
 
Protected FConstants: TPasItems;
 
Protected FFuncsProcs: TPasMethods;
 
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;

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;
 

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: TPasMethods 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;
 
Public property SourceFileDateTime: TDateTime read FSourceFileDateTime write FSourceFileDateTime;
 
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 False, then this is a program or library file, not a regular unit (though it's treated by pasdoc almost like a unit, so we use TPasUnit class for this).

Public property IsProgram: boolean read FIsProgram write FIsProgram;
 

Generated by PasDoc 0.16.0.