Forum > Beginners

Enumeration with values

(1/1)

Abelisto:
Inspired by question from StackOverflow.

Lets say I declare enumeration type like


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---TFoo = (  One = -10,  Two = 5,  Three = 15); 
Is there any way to
1) get the real count of values (3) instead of whole range from -10 to 15?
2) get the index of the value like GetIndex(TFoo.Two) = 1(2)?
3) and vice versa, associate 1(2) to TFoo.Two?

PS: TypeInfo(TFoo) does not compiled with error 'No type info for ...'.

Cyrax:
FPC can't create RTTI for such enumeration type.

Check this bug report out : http://bugs.freepascal.org/view.php?id=27622

Navigation

[0] Message Index

Go to full version