To be developed:
- Pas2JS Generics Started ← ←
- Pas2JS Array of const/Type helper Started ← ←
- Pas2JS Overflow checking
- Lazarus Colour schemes for the Ide
- Freepascal: We have accomplished the the finalizing of Attributes:
Today FPC has finally gained initial support for Custom Attributes. The work had initially been done by Joost van der Sluis almost 6 years ago and Svetozar Belic had adjusted the code for trunk. So thank you both for that work even if it took quite some time until it was finally integrated into trunk.What are attributes?
Custom Attributes allow you to decorate (currently) type definitions and published properties of classes with additional metadata that can be queried using the RTTI. What can attributes be used for? You can use them to mark classes with the name of its corresponding database table or ithe base path for a web service class.How are attributes declared?
Attributes are simply classes that descend from the new System type TCustomAttribute. The important part are the constructors of the class.
These can be used to pass additional parameters to the attribute (like the table name or path).
How are attributes used?
Attributes are bound to a type or property by using one or multiple attribute clauses in front of the type or property. For types it must be a type definition (e.g. a class, a record, an enum, etc.) or a unique type redeclaration (e.g. "TLongInt = type LongInt"). Mere type renames (e.g. "TLongInt = LongInt") are not allowed.
Attribute clauses are only available if the new modeswitch PREFIXEDATTRIBUTES is set which is the default in mode Delphi and DelphiUnicode.
The syntax of a attribute clause is the following:
ATTRIBUTECLAUSE::='[' ATTRIBUTELIST ']'
ATTRIBUTELIST::=ATTRIBUTE [, ATTRIBUTELIST ] ATTRIBUTE::=IDENTIFIER [ ( PARAMLIST ) ] PARAMLIST::=CONSTEXPR [, PARAMLIST ]
The IDENTIFIER is either the name of the attribute class as is or the attribute class' name can end in "Attribute" (casing irrelevant) and then the name may be used without the "Attribute" suffix.
Take the following example:
TMyAttribute = class(TCustomAttribute)
constructor Create(aArg: String);
constructor Create(aArg: TGUID);
constructor Create(aArg: LongInt);
TTestClass = class
property Test: LongInt read fTest;
TTestEnum = (
TLongInt = type LongInt;
constructor TMyAttribute.Create(aArg: String); begin end;
- Extended RTTI and with Anonymous function
- Lazarus: A spectacular development: Project Grouping
- Pas2JS: streaming of components now works in the classes unit.
A unit is added that presents you with an API to translate the resource strings in your program.
The unit is called rstranslate. You can1. Load a translation for a single resource string.
2. Load an object with a list of units/strings that must be translated in a simple format.
3. Specify an URL of a file which contains the translations.
The file will be loaded, the object parsed and used to translate using mechanism 2.
Since this is an async operation, there is a callback to notify you when the translation is done.
4. Reset the resource strings to their original values for one string or all strings of a unit.
For each of the cases there is a demo in the folder demo/translate.
You can click the translate button twice : every even click will reset the translation, allowing you to switch between 2 languages.
The implementation is just a sample which should cover most use cases. You can perfectly create your own alternative mechanism, of course.
- Adding CSS Properties to the Object Inspector for Pas2JS
- Extending the IDE For Pas2 JS
- LONG TERM PROJECT: Creating new WEB environment for Lazarus as a Web-App