Forum > General

ConvUtils unit misses some Delphi features

<< < (2/2)

AlexTP:
I now compared our FPC last code with Delphi docs. We still miss some symbols--
* https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.ConvUtils.ConvUnitToStr
* https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.ConvUtils.ConvUnitWithinNext
* https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.ConvUtils.ConvUnitWithinPrevious
* https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.ConvUtils.RaiseConversionError
* https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.ConvUtils.RaiseConversionRegError
* https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.ConvUtils.StrToConvUnit
* https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.ConvUtils.TryConvTypeToFamily
* https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.ConvUtils.TryStrToConvUnit
* https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.ConvUtils.UnregisterConversionFamily
* https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.ConvUtils.UnregisterConversionType
* https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.ConvUtils.TConvTypeList

Bart:
I know.

Bart

AlexTP:
Bart, a small idea.
Since cIllegalXXXX are zeros, let's make 'fake' ConvType and 'fake' ConvFamily for zero, which is not converting anything.

Bart:
I opted for a different solution based upon the observed behaviour of Delpi that in fact raises an exception, even when the docs say it returns 0.
There's another problem with functions returning a string. The y cannot return an error value (currently they return some thing like '[$0000FFFF]' for e.g. a none existing TConvType. But since any string value (even en emty string) is a valid description for a TConvType (or a TConvFamily) there is no way to let such a function indicate there's an error.

For the implementation part I implemented some TryXXX functions that return False upon failure, much like the TryStrToInt() etc. functions.

Bart

Bart:
And some more: Issue 39778.

Bart

Navigation

[0] Message Index

[*] Previous page

Go to full version