Re: [fpc-pascal] class inheritance and type incompatibility

2013-09-28 Thread Xiangrong Fang
2013/9/28 Sven Barth > On second sight your solution is not correct, because you are using Clone > inside your parent class which would not use the (non-virtual) Clone you > created. > > I've now played around with 2.6.2 myself and this should solve this > problem: > > === code begin === > > type

[fpc-pascal] generic class helper and class references

2013-09-28 Thread Xiangrong Fang
Hi There, While playing with generics (ref. class inheritance and type incompatibility), I have an idea to use "generic class helper" to overcome the problem that generic methods cannot be "virtual" (because the compiler see specialized class different than the generic one?) I have a TTree generi

Re: [fpc-pascal] class inheritance and type incompatibility

2013-09-28 Thread Xiangrong Fang
2013/9/29 Sven Barth > > If you want to override the virtual Clone method of TTree in > TIntTree you need to use the same result type + override or otherwise you > gain nothing, because the compiler will not consider the method as > overloaded and use the Clone method of TTree inside > TTree's me

Re: [fpc-pascal] class inheritance and type incompatibility

2013-09-28 Thread Sven Barth
On 28.09.2013 16:37, Xiangrong Fang wrote: 2013/9/28 Sven Barth mailto:pascaldra...@googlemail.com>> On second sight your solution is not correct, because you are using Clone inside your parent class which would not use the (non-virtual) Clone you created. ​What If I make Clone vi

Re: [fpc-pascal] class inheritance and type incompatibility

2013-09-28 Thread Xiangrong Fang
2013/9/28 Sven Barth > > On second sight your solution is not correct, because you are using Clone > inside your parent class which would not use the (non-virtual) Clone you > created. > ​What If I make Clone virtual? If by adding "virtual" to Clone, the problem is solved, then what's the differ

Re: [fpc-pascal] Status of UTF8

2013-09-28 Thread Andrew Brunner
On 09/28/2013 07:51 AM, Jonas Maebe wrote: You can read your data into a RawByteString and then call SetCodePage(rawbytestr,codepagenr,false) to set its code page to whatever the code page of the data in that string is (without attempting to convert the data, which is what the last "false" pa

Re: [fpc-pascal] Status of UTF8

2013-09-28 Thread Jonas Maebe
On 28 Sep 2013, at 14:38, Andrew Brunner wrote: > I did see that I can change the default code page, but that is not acceptable > where incoming MIME data is concerned. That global variable specifies the default code page for the plain ansistring type. It is not intended to be changed all the

[fpc-pascal] Status of UTF8

2013-09-28 Thread Andrew Brunner
I wanted to get the status of WideString support. Specifically Multi-lingual (Ansi/UTF8 strings) using Threads. I noticed that FPC is now automatically converting (encoding/decoding) the contents of a string during various operations. These conversions seem to be using system locale settings

Re: [fpc-pascal] class inheritance and type incompatibility

2013-09-28 Thread Sven Barth
On 27.09.2013 08:03, Xiangrong Fang wrote: Hi Sven, 2013/9/26 Sven Barth mailto:pascaldra...@googlemail.com>> As you can see you are constructing a TTreeInteger class inside TTreeInteger.Clone and nothing in the world afterwards can turn it into a TTreeInt. ​Do you mean that cast

Re: [fpc-pascal] class inheritance and type incompatibility

2013-09-28 Thread Sven Barth
On 27.09.2013 07:12, Sven Barth wrote: Am 27.09.2013 03:52 schrieb "Xiangrong Fang" mailto:xrf...@gmail.com>>: > Is there any problem with this solution? No, at least not on first sight :) On second sight your solution is not correct, because you are using Clone inside your parent class whic