El 11/03/2020 a las 11:15, fredvs via fpc-pascal escribió:
---> tabulatorkindty = (tak_left,tak_right,tak_centered,tak_decimal,tak_none);

?

And then use:

--->  if (kind <> tabulatorkindty(tak_none) ?

Or do you have a other idea?

Yes, for my taste that is the way to go.

But you don't need to convert the type:

if (kind <> tak_none)

Nevertheless. I supposse you are reading from a format that stores tabulatorkindty value as an integer. In such cases I want to be in the safe side and control  everything of external input data:

function ToTabulartoryKind(intValue:Integer):tabulatorkindty;
begin
  if (intValue>=ord(Low(tabulatorkindty))) and 
(intValue<=ord(high(tabulatorkindty)))
          then Result:=tabulatorkindty(intValue)
          else Result:=tak_none;

//you could use set and IN operando but sometimes I've had problems with big 
integers
end;

I'd probable would add a value tk_invalid.

--
Saludos

Santiago A.

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to