Difference between revisions of "Property attributes"

From Lazarus wiki
Jump to navigationJump to search
m (Text replace - "delphi>" to "syntaxhighlight>")
(Redirected page to Custom Attributes)
Tag: New redirect
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Syntax Diagram ==
+
#REDIRECT [[Custom Attributes]]
 
 
  PropertyDeclaration ::= PROPERTY Identifier [PropertyInterface] [PropertySpecifiers]  [Directives]<br>
 
  PropertySpecifiers ::= [ ... ]
 
                        [ ... ]
 
                        [ATTRIBUTES AttributesArray]<br>
 
  AttributesArray ::= '[' (AttributeDeclaration [, AttributeDeclaration]) ']'<br>
 
  AttributeDeclaration ::= ''''<string>':'<string>''''<br>
 
 
 
== Declaration Examples ==
 
 
 
<syntaxhighlight>
 
TmenuItem = class(...)
 
...
 
property Detachable: Boolean read FDetachable write SetDetachable attributes
 
['widgetsets:qt,gtk,win32', 'implementor:Vasya Pupkin', 'creation-date:01.01.2007'];
 
...
 
end;
 
</syntaxhighlight>
 
 
 
<syntaxhighlight>
 
TxxxDatabase = class(...)
 
...
 
property TransactionModel: TTransactionModel read FtransactionModel write
 
SetTransactionModel attributes ['engines:firebird,oracle,sybase-asa'];
 
...
 
end;
 
</syntaxhighlight>
 
 
 
== How to store additional info ==
 
 
 
There were two suggestions about the place for the property attributes:
 
 
 
#RTTI. Advantage - easier access from application. Disadvantage - bigger final executable.
 
#PPU. Advantage - info will not be added to executable. Disadvantage - more complicated way of accessing data.
 
 
 
As a result of the discussion PPU storage has been selected.
 

Latest revision as of 21:17, 25 July 2019

Redirect to: