Difference between revisions of "Property attributes"

From Lazarus wiki
(How to store additional info)
m (Text replace - "delphi>" to "syntaxhighlight>")
Line 10: Line 10:
 
== Declaration Examples ==
 
== Declaration Examples ==
  
<delphi>
+
<syntaxhighlight>
 
TmenuItem = class(...)
 
TmenuItem = class(...)
 
...
 
...
Line 17: Line 17:
 
...
 
...
 
end;
 
end;
</delphi>
+
</syntaxhighlight>
  
<delphi>
+
<syntaxhighlight>
 
TxxxDatabase = class(...)
 
TxxxDatabase = class(...)
 
...
 
...
Line 26: Line 26:
 
...
 
...
 
end;
 
end;
</delphi>
+
</syntaxhighlight>
  
 
== How to store additional info ==
 
== How to store additional info ==

Revision as of 15:53, 24 March 2012

Syntax Diagram

 PropertyDeclaration ::= PROPERTY Identifier [PropertyInterface] [PropertySpecifiers]   [Directives]
PropertySpecifiers ::= [ ... ] [ ... ] [ATTRIBUTES AttributesArray]
AttributesArray ::= '[' (AttributeDeclaration [, AttributeDeclaration]) ']'
AttributeDeclaration ::= '<string>':'<string>'

Declaration Examples

TmenuItem = class(...)
...
property Detachable: Boolean read FDetachable write SetDetachable attributes
 ['widgetsets:qt,gtk,win32', 'implementor:Vasya Pupkin', 'creation-date:01.01.2007'];
...
end;
TxxxDatabase = class(...)
...
property TransactionModel: TTransactionModel read FtransactionModel write
 SetTransactionModel attributes ['engines:firebird,oracle,sybase-asa'];
...
end;

How to store additional info

There were two suggestions about the place for the property attributes:

  1. RTTI. Advantage - easier access from application. Disadvantage - bigger final executable.
  2. 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.