Am 23.12.2022 um 15:50 schrieb Andrew Haines via fpc-pascal:
Error: Ordinal expression expected
[TEnumAttr(['YES', 'NO', 'COULD_BE'])]
There is another (and cleaner) approach that uses an abstract attribute
class. See attachment.
The advantage is that the compiler warns you with an error
On 23.12.2022 15:50, Andrew Haines via fpc-pascal wrote:
On 12/23/22 5:24 AM, Ondrej Pokorny via fpc-pascal wrote:
This may be simpler:
[TEnumAttr(['YES', 'NO', 'COULD_BE'])]
TMyEnum = (meYes, meNo, meCouldBe);
TEnumAttr = class(TCustomAttribute)
protected
FValues: TStringArray;
On Fri, 23 Dec 2022, Sven Barth wrote:
Michael Van Canneyt via fpc-pascal
schrieb am Fr., 23. Dez. 2022, 10:48:
On Fri, 23 Dec 2022, Sven Barth via fpc-pascal wrote:
Michael Van Canneyt via fpc-pascal
schrieb am Fr., 23. Dez. 2022, 08:18:
On Thu, 22 Dec 2022, Andrew Haines via
On 12/23/22 5:24 AM, Ondrej Pokorny via fpc-pascal wrote:
This may be simpler:
[TEnumAttr(['YES', 'NO', 'COULD_BE'])]
TMyEnum = (meYes, meNo, meCouldBe);
TEnumAttr = class(TCustomAttribute)
protected
FValues: TStringArray;
FTypeName: String;
public
class function
Michael Van Canneyt via fpc-pascal
schrieb am Fr., 23. Dez. 2022, 10:48:
>
>
> On Fri, 23 Dec 2022, Sven Barth via fpc-pascal wrote:
>
> > Michael Van Canneyt via fpc-pascal
> > schrieb am Fr., 23. Dez. 2022, 08:18:
> >
> >>
> >>
> >> On Thu, 22 Dec 2022, Andrew Haines via fpc-pascal wrote:
>
This may be simpler:
[TEnumAttr(['YES', 'NO', 'COULD_BE'])]
TMyEnum = (meYes, meNo, meCouldBe);
TEnumAttr = class(TCustomAttribute)
protected
FValues: TStringArray;
FTypeName: String;
public
class function FromType(ATypeInfo: PTypeInfo): TEnumAttr;
constructor
On Fri, 23 Dec 2022, Sven Barth via fpc-pascal wrote:
Michael Van Canneyt via fpc-pascal
schrieb am Fr., 23. Dez. 2022, 08:18:
On Thu, 22 Dec 2022, Andrew Haines via fpc-pascal wrote:
Hi what I want to do is similar to this question here:
Michael Van Canneyt via fpc-pascal
schrieb am Fr., 23. Dez. 2022, 08:18:
>
>
> On Thu, 22 Dec 2022, Andrew Haines via fpc-pascal wrote:
>
> > Hi what I want to do is similar to this question here:
> >
> https://en.delphipraxis.net/topic/423-rtti-determine-record-helper-type-for-a-base-type/
> >
On Thu, 22 Dec 2022, Andrew Haines via fpc-pascal wrote:
Hi what I want to do is similar to this question here:
https://en.delphipraxis.net/topic/423-rtti-determine-record-helper-type-for-a-base-type/
I am going to create multiple type helpers for enums and I would like to look
up the
So, I came up with a solution using Custom Attributes.
I can declare this:
[TEnumAttr('YES', 'NO', 'COULD_BE')]
TMyEnum = (meYes, meNo, meCouldBe);
and at runtime look for the TEnumAttr attribute and use that.
TEnumAttr = class(TCustomAttribute)
protected
FValues: TStringArray;
Hi what I want to do is similar to this question here:
https://en.delphipraxis.net/topic/423-rtti-determine-record-helper-type-for-a-base-type/
I am going to create multiple type helpers for enums and I would like to
look up the helper and use common methods AsString AsOrdinal to get/set
the
11 matches
Mail list logo