📄 uextidents.pas
字号:
//Saves the identifier to the stream.
procedure Save(Stream: TIdentStream); override;
//Loads the identifier from the stream.
procedure Load(Stream: TIdentStream; Version: TIdentClassVersion);
override;
//Compares this identifier with the other one.
function CompareWith(Ident: TIdentifier; const MsgPrefix: String;
Messages: TStrings): Boolean; override;
property EnumType: TEnumType read FEnumType write FEnumType;
property Value: String read FValue write FValue;
property ValueSet: Boolean read FValueSet write FValueSet;
end;
{ * * * *** * * * *** TSubRangeType *** * * * *** * * * }
{The class for subranges. It contains two strings of the declarations of the
lower and the upper limit of the subrange. }
TSubRangeType = class(TType)
private
FFromDefText: String; //the lower limit of the subrange
FToDefText: String; //the upper limit of the subrange
protected
//Copies all data of this identifier to the Clone.
procedure CloneTo(Clone: TIdentifier); override;
public
//Gets a description of the identifier, mostly like it has been declared in
//the pascal data.
function GetDescriptionString(TextFormat: TTextFormat;
SourceIdent: TIdentifier = nil): String;
override;
//Gets the declaration of the identifier in an internal representation.
procedure GetDeclaration(Assembly: TDeclarationAssembler); override;
//Tests if this identifier is equal to Other as regards content.
function ParamEqualTo(Other: TType): Boolean; override;
//Saves the identifier to the stream.
procedure Save(Stream: TIdentStream); override;
//Loads the identifier from the stream.
procedure Load(Stream: TIdentStream; Version: TIdentClassVersion);
override;
//Compares this identifier with the other one.
function CompareWith(Ident: TIdentifier; const MsgPrefix: String;
Messages: TStrings): Boolean; override;
property FromDefText: String read FFromDefText write FFromDefText;
property ToDefText: String read FToDefText write FToDefText;
end;
{ * * * *** * * * *** TClassReferenceType *** * * * *** * * * }
{The class for class references. It contains an identifier of the base class
on which it can hold a reference. }
TClassReferenceType = class(TType)
private
FBaseClass: TType; //the base class the type can reference
protected
//Copies all data of this identifier to the Clone.
procedure CloneTo(Clone: TIdentifier); override;
public
//Frees the object and the base type.
destructor Destroy; override;
//Calls Proc with each instance of TIdentType.
procedure ForEachIdentType(Proc: TForEachIdentTypeProc; Parent: TIdentifier;
Data: TIdentifier = nil); override;
//Adds the given set to its own and all contained identifiers.
procedure AddPortabilityIssues(Portability: TIdentPortabilities); override;
//Gets a description of the identifier, mostly like it has been declared in
//the pascal data.
function GetDescriptionString(TextFormat: TTextFormat;
SourceIdent: TIdentifier = nil): String;
override;
//Gets the declaration of the identifier in an internal representation.
procedure GetDeclaration(Assembly: TDeclarationAssembler); override;
//Tests if this identifier is equal to Other as regards content.
function ParamEqualTo(Other: TType): Boolean; override;
//Adds itself and all owned identifiers to the list.
procedure AddToList(List: TIdentifierList); override;
//Saves the identifier to the stream.
procedure Save(Stream: TIdentStream); override;
//Loads the identifier from the stream.
procedure Load(Stream: TIdentStream; Version: TIdentClassVersion);
override;
//Compares this identifier with the other one.
function CompareWith(Ident: TIdentifier; const MsgPrefix: String;
Messages: TStrings): Boolean; override;
property BaseClass: TType read FBaseClass write FBaseClass;
end;
{ * * * *** * * * *** TFileType *** * * * *** * * * }
{The class for file types. It contains an identifier of the type that can be
read from and written to a file or nil. }
TFileType = class(TPackableType)
private
FFileType: TType; //the type to read from/write to the file
protected
//Copies all data of this identifier to the Clone.
procedure CloneTo(Clone: TIdentifier); override;
public
//Frees the object and the type.
destructor Destroy; override;
//Calls Proc with each instance of TIdentType.
procedure ForEachIdentType(Proc: TForEachIdentTypeProc; Parent: TIdentifier;
Data: TIdentifier = nil); override;
//Adds the given set to its own and all contained identifiers.
procedure AddPortabilityIssues(Portability: TIdentPortabilities); override;
//Tests if it is or contains Ident.
function RecursiveIsIn(Ident: TIdentifier): Boolean; override;
//Gets a description of the identifier, mostly like it has been declared in
//the pascal data.
function GetDescriptionString(TextFormat: TTextFormat;
SourceIdent: TIdentifier = nil): String;
override;
//Gets the declaration of the identifier in an internal representation.
procedure GetDeclaration(Assembly: TDeclarationAssembler); override;
//Tests if this identifier is equal to Other as regards content.
function ParamEqualTo(Other: TType): Boolean; override;
//Adds itself and all owned identifiers to the list.
procedure AddToList(List: TIdentifierList); override;
//Saves the identifier to the stream.
procedure Save(Stream: TIdentStream); override;
//Loads the identifier from the stream.
procedure Load(Stream: TIdentStream; Version: TIdentClassVersion);
override;
//Compares this identifier with the other one.
function CompareWith(Ident: TIdentifier; const MsgPrefix: String;
Messages: TStrings): Boolean; override;
property FileType: TType read FFileType write FFileType;
end;
{ * * * *** * * * *** TSetType *** * * * *** * * * }
{The class for set types. It contains an identifier of the type of the items
of the set. }
TSetType = class(TPackableType)
private
FSetType: TType; //the type of the items of the set
protected
//Copies all data of this identifier to the Clone.
procedure CloneTo(Clone: TIdentifier); override;
public
//Frees the object and the type.
destructor Destroy; override;
//Calls Proc with each instance of TIdentType.
procedure ForEachIdentType(Proc: TForEachIdentTypeProc; Parent: TIdentifier;
Data: TIdentifier = nil); override;
//Adds the given set to its own and all contained identifiers.
procedure AddPortabilityIssues(Portability: TIdentPortabilities); override;
//Tests if it is or contains Ident.
function RecursiveIsIn(Ident: TIdentifier): Boolean; override;
//Gets a description of the identifier, mostly like it has been declared in
//the pascal data.
function GetDescriptionString(TextFormat: TTextFormat;
SourceIdent: TIdentifier = nil): String;
override;
//Gets the declaration of the identifier in an internal representation.
procedure GetDeclaration(Assembly: TDeclarationAssembler); override;
//Tests if this identifier is equal to Other as regards content.
function ParamEqualTo(Other: TType): Boolean; override;
//Adds itself and all owned identifiers to the list.
procedure AddToList(List: TIdentifierList); override;
//Saves the identifier to the stream.
procedure Save(Stream: TIdentStream); override;
//Loads the identifier from the stream.
procedure Load(Stream: TIdentStream; Version: TIdentClassVersion);
override;
//Compares this identifier with the other one.
function CompareWith(Ident: TIdentifier; const MsgPrefix: String;
Messages: TStrings): Boolean; override;
property SetType: TType read FSetType write FSetType;
end;
{ * * * *** * * * *** TArrayType *** * * * *** * * * }
//a dynamic array of boolean values
TDynBooleanArray = array of Boolean;
{The class for array types. It contains a string of the indices and an
identifier of the type of the items. }
TArrayType = class(TPackableType)
private
//the list of the declared indices of the array
FIndices: TIdentifierList;
//whether a new bracket was started for a new index, Length is
//~[link FIndices].Count - 1
FNewBrackets: TDynBooleanArray;
FBaseType: TType; //the base type/type of the items
protected
//Copies all data of this identifier to the Clone.
procedure CloneTo(Clone: TIdentifier); override;
public
//Create the object and the list of indices.
constructor Create; override;
//Frees the object, the indices and the base type.
destructor Destroy; override;
//Gets the version the identifier will save its data in by ~[link Save].
class function GetVersion: TIdentClassVersion; override;
//Checks if the identifier can read data of the version by ~[link Load].
class function CheckVersion(Version: TIdentClassVersion): Boolean;
override;
//Calls Proc with each instance of TIdentType.
procedure ForEachIdentType(Proc: TForEachIdentTypeProc; Parent: TIdentifier;
Data: TIdentifier = nil); override;
//Adds the given set to its own and all contained identifiers.
procedure AddPortabilityIssues(Portability: TIdentPortabilities); override;
//Tests if it is or contains Ident.
function RecursiveIsIn(Ident: TIdentifier): Boolean; override;
//Gets a description of the identifier, mostly like it has been declared in
//the pascal data.
function GetDescriptionString(TextFormat: TTextFormat;
SourceIdent: TIdentifier = nil): String;
override;
//Gets the declaration of the identifier in an internal representation.
procedure GetDeclaration(Assembly: TDeclarationAssembler); override;
//Tests if this identifier is equal to Other as regards content.
function ParamEqualTo(Other: TType): Boolean; override;
//Adds itself and all owned identifiers to the list.
procedure AddToList(List: TIdentifierList); override;
//Saves the identifier to the stream.
procedure Save(Stream: TIdentStream); override;
//Loads the identifier from the stream.
procedure Load(Stream: TIdentStream; Version: TIdentClassVersion);
override;
//Compares this identifier with the other one.
function CompareWith(Ident: TIdentifier; const MsgPrefix: String;
Messages: TStrings): Boolean; override;
//Adds an index to the array.
procedure AddIndexType(IndexType: TType; NewBracket: Boolean);
//the list of the declared indices of the array
property Indices: TIdentifierList read FIndices;
property NewBrackets: TDynBooleanArray read FNewBrackets;
property BaseType: TType read FBaseType write FBaseType;
end;
{ * * * *** * * * *** TField *** * * * *** * * * }
{The class for fields in record-like types. It contains an identifier of its
type. }
TField = class(TIdentifier)
private
FFieldType: TType; //the type of the field
protected
//Copies all data of this identifier to the Clone.
procedure CloneTo(Clone: TIdentifier); override;
public
//Frees the object and the type identifier.
destructor Destroy; override;
//Calls Proc with each instance of TIdentType.
procedure ForEachIdentType(Proc: TForEachIdentTypeProc; Parent: TIdentifier;
Data: TIdentifier = nil); override;
//Adds the given set to its own and all contained identifiers.
procedure AddPortabilityIssues(Portability: TIdentPortabilities); override;
//Tests if it is or contains Ident.
function RecursiveIsIn(Ident: TIdentifier): Boolean; override;
//Gets a description of the identifier, mostly like it has been declared in
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -