Jump to content
Mike Torrettinni

How to manage defined list values

Recommended Posts

4 hours ago, Fr0sT.Brutal said:

For such big numbers you can have all the data in any convenient form (CSV, JSON, XML) and write a tool that would generate a unit from this data.

Or you could convert a JSON on the fly to any record or class, thus the multi-language support you mentioned would be solved too.

The question is, do you really need this amount of data linked to every single project?

Share this post


Link to post
1 hour ago, Attila Kovacs said:

Or you could convert a JSON on the fly to any record or class, thus the multi-language support you mentioned would be solved too.

The question is, do you really need this amount of data linked to every single project?

Sure he could but pre-defined enums and consts benefit from compiler-controlled item names and CodeInsight showing const values in code editor

  • Like 1

Share this post


Link to post

You could associate the loaded values with enums, but which of the above mentioned versions showing you the constant values with codeinsight?

Share this post


Link to post
13 hours ago, Attila Kovacs said:

You could associate the loaded values with enums, but which of the above mentioned versions showing you the constant values with codeinsight?

Yup, my mistake. Codeinsight doesn't show arrays, even constant ones.

  • Like 1

Share this post


Link to post

Although I am a big fan of rtti and attributes I would choose the const array[enum] of x any day as its compact to write and compile time evaluated (i.e. error if someone introduces a new enum value and forgets to specify an array value for it).

Edited by Stefan Glienke
  • Like 4

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×