Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Which language elements can be annotated using attributes language feature of Delphi?
- procedure Request([FormParam] AUsername: string; [FormParam] APassword: string);
- program Project25;
- {$APPTYPE CONSOLE}
- uses
- Rtti;
- type
- TestAttribute = class(TCustomAttribute);
- [TestAttribute] TEnum = (first, second, third);
- [TestAttribute] TFunc = function: Integer;
- [TestAttribute] TEvent = procedure of object;
- [TestAttribute] AliasInteger = Integer;
- [TestAttribute] ARecord = record
- x:Integer;
- [TestAttribute] RecordField: Integer;
- [TestAttribute] procedure DummyProc;
- end;
- [TestAttribute] AClass = class
- strict private
- type [TestAttribute] InnerType = record y:Integer; end;
- private
- [TestAttribute]
- function GetTest: Integer;
- public
- [TestAttribute] x: Integer;
- [TestAttribute] class var z: Integer;
- // Can't find a way to declare attribute for property!
- property Test:Integer read GetTest;
- [TestAttribute] class function ClassFuncTest:Integer;
- end;
- var [TestAttribute] GlobalVar: Integer;
- [TestAttribute]
- procedure GlobalFunction;
- var [TestAttribute] LocalVar: Integer;
- begin
- end;
- { ARecord }
- procedure ARecord.DummyProc;
- begin
- end;
- { AClass }
- class function AClass.ClassFuncTest: Integer;
- begin
- end;
- function AClass.GetTest: Integer;
- begin
- end;
- begin
- end.
Add Comment
Please, Sign In to add comment