View Issue Details

IDProjectCategoryView StatusLast Update
0030961FPCRTLpublic2017-08-28 07:58
ReportersilvioprogAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version3.1.1Product Build 
Target Version3.2.0Fixed in Version3.1.1 
Summary0030961: [FEATURE REQUEST] TypInfo.AddEnumElementAliases()/TypInfo.RemoveEnumElementAliases()

The AddEnumElementAliases() function allows the programmer to register their own enum aliases, for example:

// the TMyStatus kinds are: stEnabled, stDisabled
AddEnumElementAliases(TypeInfo(TMyStatus), ['On', 'Off'])
AddEnumElementAliases(TypeInfo(Boolean), ['no', 'yes'], 1 {Start value});
AddEnumElementAliases(TypeInfo(Boolean), ['', 'on']);

after registering them, the RTTI functions like GetEnumProp()/SetEnumProp() can access the enums using their aliases instead of their standard kinds and without raising any error.

Unfortunately AddEnumElementAliases() and RemoveEnumElementAliases() don't have any documentation, they have just an entry on their wiki:

1. .
2. .

but they can be easily understood:

AddEnumElementAliases(): Register one or more alias for the enum kinds. The aliases can be any string or empty string.
RemoveEnumElementAliases(): Unregister all registered aliases for a enum kind.
TagsNo tags attached.
Fixed in Revision36719
Attached Files


Michael Van Canneyt

2017-07-10 12:00

administrator   ~0101649


Issue History

Date Modified Username Field Change
2016-11-20 01:34 silvioprog New Issue
2016-11-20 10:04 Michael Van Canneyt Assigned To => Michael Van Canneyt
2016-11-20 10:04 Michael Van Canneyt Status new => assigned
2017-07-10 12:00 Michael Van Canneyt Fixed in Revision => 36719
2017-07-10 12:00 Michael Van Canneyt Note Added: 0101649
2017-07-10 12:00 Michael Van Canneyt Status assigned => resolved
2017-07-10 12:00 Michael Van Canneyt Fixed in Version => 3.1.1
2017-07-10 12:00 Michael Van Canneyt Resolution open => fixed
2017-07-10 12:00 Michael Van Canneyt Target Version => 3.2.0
2017-08-28 07:58 silvioprog Status resolved => closed