Class TPasCio

Unit

Declaration

type TPasCio = class(TPasType)

Description

Extends TPasItem to store all items in a class / an object, e.g. fields.

TODO: Rename to TPasStructure, most general term.

Source: source/component/PasDoc_Items.pas (line 793).

Hierarchy

Overview

Fields

Protected FClassDirective: TClassDirective;
Protected FFields: TPasItems;
Protected FMethods: TPasRoutines;
Protected FProperties: TPasProperties;
Protected FAncestors: TStringPairVector;
Protected FOutputFileName: string;
Protected FMyType: TCIOType;
Protected FHelperTypeIdentifier: string;
Protected FCios: TPasNestedCios;
Protected FTypes: TPasTypes;
Protected FNameWithGeneric: string;

Methods

Protected procedure Serialize(const ADestination: TStream); override;
Protected procedure Deserialize(const ASource: TStream); override;
Protected procedure StoreMemberTag(ThisTag: TTag; var ThisTagData: TObject; EnclosingTag: TTag; var EnclosingTagData: TObject; const TagParameter: string; var ReplaceStr: string);
Public constructor Create; override;
Public destructor Destroy; override;
Public function FindItem(const ItemName: string): TBaseItem; override;
Public function FindItemMaybeInAncestors(const ItemName: string): TBaseItem; override;
Public function FindItemInAncestors(const ItemName: string): TPasItem;
Public procedure Sort(const SortSettings: TSortSettings); override;
Public procedure RegisterTags(TagManager: TTagManager); override;
Public function FirstAncestor: TPasItem;
Public function InheritedItem: TPasItem; override;
Public function GetInheritedItemDescriptions: TStringPairVector; override;
Public function FirstAncestorName: string;
Public function ShowVisibility: boolean;

Properties

Public property Ancestors: TStringPairVector read FAncestors;
Public property Cios: TPasNestedCios read FCios;
Public property ClassDirective: TClassDirective read FClassDirective write FClassDirective;
Public property Fields: TPasItems read FFields;
Public property HelperTypeIdentifier: string read FHelperTypeIdentifier write FHelperTypeIdentifier;
Public property Methods: TPasRoutines read FMethods;
Public property Properties: TPasProperties read FProperties;
Public property MyType: TCIOType read FMyType write FMyType;
Public property OutputFileName: string read FOutputFileName write FOutputFileName;
Public property Types: TPasTypes read FTypes;
Public property NameWithGeneric: string read FNameWithGeneric write FNameWithGeneric;

Description

Fields

Protected FClassDirective: TClassDirective;

This item has no description.

Source: source/component/PasDoc_Items.pas (line 795).

Protected FFields: TPasItems;

This item has no description.

Source: source/component/PasDoc_Items.pas (line 796).

Protected FMethods: TPasRoutines;

This item has no description.

Source: source/component/PasDoc_Items.pas (line 797).

Protected FProperties: TPasProperties;

This item has no description.

Source: source/component/PasDoc_Items.pas (line 798).

Protected FAncestors: TStringPairVector;

This item has no description.

Source: source/component/PasDoc_Items.pas (line 799).

Protected FOutputFileName: string;

This item has no description.

Source: source/component/PasDoc_Items.pas (line 800).

Protected FMyType: TCIOType;

This item has no description.

Source: source/component/PasDoc_Items.pas (line 801).

Protected FHelperTypeIdentifier: string;

This item has no description.

Source: source/component/PasDoc_Items.pas (line 802).

Protected FCios: TPasNestedCios;

This item has no description.

Source: source/component/PasDoc_Items.pas (line 803).

Protected FTypes: TPasTypes;

This item has no description.

Source: source/component/PasDoc_Items.pas (line 804).

Protected FNameWithGeneric: string;

This item has no description.

Source: source/component/PasDoc_Items.pas (line 805).

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,

  1. It will not break anything if you will accidentally store in cache something that is not generated by parser. That's because saving to cache will be done anyway right after doing parsing, so properties not initialized by parser will have their initial values anyway. You're just wasting memory for cache, and some cache saving/loading time.

  2. For now, in implementation of serialize/deserialize we try to add even things not generated by parser in a commented out code. This way if approach to cache will change some day, we will be able to use this code.

Source: source/component/PasDoc_Items.pas (line 807).

Protected procedure Deserialize(const ASource: TStream); override;

This item has no description.

Source: source/component/PasDoc_Items.pas (line 808).

Protected procedure StoreMemberTag(ThisTag: TTag; var ThisTagData: TObject; EnclosingTag: TTag; var EnclosingTagData: TObject; const TagParameter: string; var ReplaceStr: string);

This item has no description.

Source: source/component/PasDoc_Items.pas (line 810).

Public constructor Create; override;

This item has no description.

Source: source/component/PasDoc_Items.pas (line 814).

Public destructor Destroy; override;

This item has no description.

Source: source/component/PasDoc_Items.pas (line 815).

Public function FindItem(const ItemName: string): TBaseItem; override;

If this class (or interface or object) contains a field, method or property with the name of ItemName, the corresponding item pointer is returned.

Source: source/component/PasDoc_Items.pas (line 820).

Public function FindItemMaybeInAncestors(const ItemName: string): TBaseItem; override;

This item has no description. Showing description inherited from TBaseItem.FindItemMaybeInAncestors.

This is just like FindItem, but in case of classes or such it should also search within ancestors. In this class, the default implementation just calls FindItem.

Source: source/component/PasDoc_Items.pas (line 822).

Public function FindItemInAncestors(const ItemName: string): TPasItem;

This searches for item (field, method or property) defined in ancestor of this cio. I.e. searches within the FirstAncestor, then within FirstAncestor.FirstAncestor, and so on. Returns nil if not found.

Source: source/component/PasDoc_Items.pas (line 829).

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.

Source: source/component/PasDoc_Items.pas (line 831).

Public procedure RegisterTags(TagManager: TTagManager); override;

This item has no description. Showing description inherited from TBaseItem.RegisterTags.

It registers TTags that init Authors, Created, LastMod and remove relevant tags from description. You can override it to add more handlers.

Source: source/component/PasDoc_Items.pas (line 833).

Public function FirstAncestor: TPasItem;

This returns Ancestors[0].Data, i.e. instance of the first ancestor of this Cio (or nil if it couldn't be found), or nil if Ancestors.Count = 0.

Source: source/component/PasDoc_Items.pas (line 879).

Public function InheritedItem: TPasItem; override;

Get the closest item that this item inherits from. Returns the value of FirstAncestor.

Source: source/component/PasDoc_Items.pas (line 883).

Public function GetInheritedItemDescriptions: TStringPairVector; override;

This item has no description. Showing description inherited from TPasItem.GetInheritedItemDescriptions.

Generate a list of descriptions defined on this item in base classes.

This stops at the first class ancestor to have a description defined for an ancestor of this item. Along the way it will also collect descriptions of this item from any implemented interfaces.

If there is no description in any ancestor, it will return an empty vector.

Source: source/component/PasDoc_Items.pas (line 885).

Public function FirstAncestorName: string;

This returns the name of first ancestor of this Cio.

If Ancestor.Count > 0 then it simply returns Ancestors[0], i.e. the name of the first ancestor as was specified at class declaration, else it returns ''.

So this method is roughly something like FirstAncestor.Name, but with a few notable differences:

  • FirstAncestor is nil if the ancestor was not found in items parsed by pasdoc. But this method will still return in this case name of ancestor.

  • FirstAncestor.Name is the name of ancestor as specified at declaration of an ancestor. But this method is the name of ancestor as specified at declaration of this cio — with the same letter case, with optional unit specifier.

If this function returns '', then you can be sure that FirstAncestor returns nil. The other way around is not necessarily true — FirstAncestor may be nil, but still this function may return something <> ''.

Source: source/component/PasDoc_Items.pas (line 912).

Public function ShowVisibility: boolean;

Is Visibility of items (Fields, Methods, Properties) important ?

Source: source/component/PasDoc_Items.pas (line 937).

Properties

Public property Ancestors: TStringPairVector read FAncestors;

Name of the ancestor (class, object, interface). Each item is a TStringPair, with

  • Name is the name (single Pascal identifier) of this ancestor,

  • Value is the full declaration of this ancestor. For example, in addition to Name, this may include "specialize" directive (for FPC generic specialization) at the beginning. And "<foo,bar>" section at the end (for FPC or Delphi generic specialization).

  • Data is a TPasItem reference to this ancestor, or Nil if not found. This is assigned only in TDocGenerator.BuildLinks.

Note that each ancestor is a TPasItem, not necessarily TPasCio. Consider e.g. the case

TMyStringList = Classes.TStringList;
TMyExtendedStringList = class(TMyStringList)
  ...
end;

At least for now, such declaration will result in TPasType (not TPasCio!) with Name = 'TMyStringList', which means that ancestor of TMyExtendedStringList will be a TPasType instance.

Note that the PasDoc_Parser already takes care of correctly setting Ancestors when user didn't specify any ancestor name at cio declaration. E.g. if this cio is a class, and user didn't specify ancestor name at class declaration, and this class name is not 'TObject' (in case pasdoc parses the RTL), the Ancestors[0] will be set to 'TObject'.

Source: source/component/PasDoc_Items.pas (line 867).

Public property Cios: TPasNestedCios read FCios;

Nested classes (and records, interfaces...).

Source: source/component/PasDoc_Items.pas (line 870).

Public property ClassDirective: TClassDirective read FClassDirective write FClassDirective;

ClassDirective is used to indicate whether a class is sealed or abstract.

Source: source/component/PasDoc_Items.pas (line 873).

Public property Fields: TPasItems read FFields;

list of all fields

Source: source/component/PasDoc_Items.pas (line 915).

Public property HelperTypeIdentifier: string read FHelperTypeIdentifier write FHelperTypeIdentifier;

Class or record helper type identifier

Source: source/component/PasDoc_Items.pas (line 918).

Public property Methods: TPasRoutines read FMethods;

list of all methods

Source: source/component/PasDoc_Items.pas (line 922).

Public property Properties: TPasProperties read FProperties;

list of properties

Source: source/component/PasDoc_Items.pas (line 925).

Public property MyType: TCIOType read FMyType write FMyType;

determines if this is a class, an interface or an object

Source: source/component/PasDoc_Items.pas (line 928).

Public property OutputFileName: string read FOutputFileName write FOutputFileName;

name of documentation output file (if each class / object gets its own file, that's the case for HTML, but not for TeX)

Source: source/component/PasDoc_Items.pas (line 932).

Public property Types: TPasTypes read FTypes;

Simple nested types (that don't fall into Cios).

Source: source/component/PasDoc_Items.pas (line 940).

Public property NameWithGeneric: string read FNameWithGeneric write FNameWithGeneric;

Name, with optional "generic" directive before (for FPC generics) and generic type identifiers list "<foo,bar>" after (for FPC and Delphi generics).

Source: source/component/PasDoc_Items.pas (line 944).


Generated by PasDoc 0.17.0.snapshot.