[fpc-devel] Unicode support (yet again)
Graeme Geldenhuys
graemeg.lists at gmail.com
Fri Sep 16 12:00:30 CEST 2011
On 16/09/2011 11:48, Felipe Monteiro de Carvalho wrote:
>
> What about stuff like this in classes:
>
> TReader = class(TFiler)
> function ReadString: string;
> function ReadWideString: WideString;
> function ReadUnicodeString: UnicodeString;
I'm clearly not understanding your (and a few others) logic here. Why
must classes like that become obfuscated with such "extra" methods?
What is wrong with changing this class definition...
TReader = class(TFiler)
function ReadString: string;
function ReadWideString: WideString;
function ReadUnicodeString: UnicodeString;
...into this...
TReader = class(TFiler)
function ReadString: UnicodeString;
Where UnicodeString will be whatever the native encoding is on each
platform. The class interface stays neat and readable, no conversions
required on any platforms etc..
Adding a new overloaded method to each class that handles strings, or
multiple versions of classes handling different encodings just seems the
wrong way to go. Talk about code duplication!
Regards,
- Graeme -
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/
More information about the fpc-devel
mailing list