Guest User

Untitled

a guest
Aug 30th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. Which language elements can be annotated using attributes language feature of Delphi?
  2. procedure Request([FormParam] AUsername: string; [FormParam] APassword: string);
  3.  
  4. program Project25;
  5.  
  6. {$APPTYPE CONSOLE}
  7.  
  8. uses
  9. Rtti;
  10.  
  11. type
  12. TestAttribute = class(TCustomAttribute);
  13.  
  14. [TestAttribute] TEnum = (first, second, third);
  15. [TestAttribute] TFunc = function: Integer;
  16. [TestAttribute] TEvent = procedure of object;
  17. [TestAttribute] AliasInteger = Integer;
  18.  
  19. [TestAttribute] ARecord = record
  20. x:Integer;
  21. [TestAttribute] RecordField: Integer;
  22. [TestAttribute] procedure DummyProc;
  23. end;
  24.  
  25. [TestAttribute] AClass = class
  26. strict private
  27. type [TestAttribute] InnerType = record y:Integer; end;
  28. private
  29. [TestAttribute]
  30. function GetTest: Integer;
  31. public
  32. [TestAttribute] x: Integer;
  33. [TestAttribute] class var z: Integer;
  34. // Can't find a way to declare attribute for property!
  35. property Test:Integer read GetTest;
  36. [TestAttribute] class function ClassFuncTest:Integer;
  37. end;
  38.  
  39. var [TestAttribute] GlobalVar: Integer;
  40.  
  41. [TestAttribute]
  42. procedure GlobalFunction;
  43. var [TestAttribute] LocalVar: Integer;
  44. begin
  45. end;
  46.  
  47. { ARecord }
  48.  
  49. procedure ARecord.DummyProc;
  50. begin
  51. end;
  52.  
  53. { AClass }
  54.  
  55. class function AClass.ClassFuncTest: Integer;
  56. begin
  57. end;
  58.  
  59. function AClass.GetTest: Integer;
  60. begin
  61. end;
  62.  
  63. begin
  64. end.
Add Comment
Please, Sign In to add comment