Re: [fpc-pascal] Re: Handling with sources and exebutables with different names
On Thu, May 17, 2012 21:09, luciano de souza wrote: > Actually, there are no errors. > > Using cmd.exe on Windows 7 and FPC 2.6.0, I did: > > fpc test.pas -oindex.cgi > > I got test.exe and no errors are raised. Please add option -s (i.e. 'fpc -s test.pas -oindex.cgi') and post content of the generated file ppas.bat here. Tomas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FSplit is deprecated
2012/5/17 Marco van de Voort : > So use functions from 2.0.x like sysutils.extract* Found it, thank you. I was a little bit impatient yesterday, I should have searched a little longer on my own. Due to the extraordinarily high quality of FPC and Lazarus I have begun to take absolute perfection for granted and when I then accidentally stumble over one little trivial imperfection (every 6 months or so) while I am in a hurry (always) it irritates me sometimes ;-) Bernd ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Unicodestrings and Assign(File)
2012/5/13 Sven Barth : > Currently the Windows RTL uses (nearly?) always the Ansi functions > (exception might be WinCE as there the Ansi functions don't exist), so using > TFileStream won't help here. Does AssignStream() also accept any other THandleStream? Maybe you can just make your own TFileStream descendant with a slightly different constructor that is using the widestring file open API? Maybe you could then use such a customized stream with AssignStream()? (Untested) Bernd ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Extend multiple classes with same code
Hi, I have 2 objects inherited from the base one T_A = class(TObject); T_B1 = class(T_A); T_B2 = class(T_A); T_B3 = class(T_A); Now if I want to extend T_B1 it is easy to inherit it to T_C1 = class (T_B1) and add many functions to it, but. I want the same extend T_B2 not T_B3, 1 - The first idea is adding this functions to T_A, but it is not my class to modify it, or it is protected from my modify. 2 - Copy and paste this functions to T_B2, but in that case I need every time to fix functions in B1 I must do it in B2, that make it so hard, and not good programming quality. Is there any new idea to do that, what about Helper, generics, i read about it i felt it is not fit to my problem (or i am wrong). Thanks in advance Zaher Dirkey ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Extend multiple classes with same code
On Fri, 18 May 2012, Zaher Dirkey wrote: Hi, I have 2 objects inherited from the base one T_A = class(TObject); T_B1 = class(T_A); T_B2 = class(T_A); T_B3 = class(T_A); Now if I want to extend T_B1 it is easy to inherit it to T_C1 = class (T_B1) and add many functions to it, but. I want the same extend T_B2 not T_B3, 1 - The first idea is adding this functions to T_A, but it is not my class to modify it, or it is protected from my modify. 2 - Copy and paste this functions to T_B2, but in that case I need every time to fix functions in B1 I must do it in B2, that make it so hard, and not good programming quality. Is there any new idea to do that, what about Helper, generics, i read about it i felt it is not fit to my problem (or i am wrong). Maybe you can try interfaces and interface delegation. Michael.___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Extend multiple classes with same code
On Fri, May 18, 2012 at 9:18 PM, Michael Van Canneyt wrote: > > Maybe you can try interfaces and interface delegation. > > I don't think so, class T_A is not my code or it is very strict to modify it, also i am talk about multiple implementation not interfacing objects (or you can provide me and example). Best Regards Zaher Dirkey ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Extend multiple classes with same code
On 18.05.2012 20:38, Zaher Dirkey wrote: Hi, I have 2 objects inherited from the base one T_A = class(TObject); T_B1 = class(T_A); T_B2 = class(T_A); T_B3 = class(T_A); Now if I want to extend T_B1 it is easy to inherit it to T_C1 = class (T_B1) and add many functions to it, but. I want the same extend T_B2 not T_B3, 1 - The first idea is adding this functions to T_A, but it is not my class to modify it, or it is protected from my modify. 2 - Copy and paste this functions to T_B2, but in that case I need every time to fix functions in B1 I must do it in B2, that make it so hard, and not good programming quality. Is there any new idea to do that, what about Helper, generics, i read about it i felt it is not fit to my problem (or i am wrong). Thanks in advance Helper types might help you here. E.g. type T_AHelper = class helper for T_A procedure YourNewProc; end; procedure T_AHelper.YourNewProc; begin ... end; var t: T_B1; begin t.YourNewProc; end; You can access public, published and (strict) protected members using a class helper. The helper needs to be in scope ( = it's unit needs to be in the uses) if you want to use one of it's methods on a instance of T_A (or T_B). Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Extend multiple classes with same code
2012/5/18 Zaher Dirkey : > Hi, > > I have 2 objects inherited from the base one > > T_A = class(TObject); > > T_B1 = class(T_A); > T_B2 = class(T_A); > T_B3 = class(T_A); How about this: T_A = class(TObject); T_AX = class(T_A);// <-- this class implements your extensions T_B1 = class(T_AX); // TB_1 and T_B2 = class(T_AX); // TB_2 inherit it T_B3 = class(T_A); ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Extend multiple classes with same code
On Fri, May 18, 2012 at 11:27 PM, Bernd wrote: > > _B3 = class(T_A); > How about this: > > T_A = class(TObject); > > T_AX = class(T_A);// <-- this class implements your extensions > > T_B1 = class(T_AX); // TB_1 and > T_B2 = class(T_AX); // TB_2 inherit it > T_B3 = class(T_A); > > > I can't, in fact it is my mistak when i explained. B1 B2 is in the base unit like as A, i cant modify it, very strict. My projects is db layer, i have TmyCustomField, TmyFields=class(TmyCustomField) and TmyParams=class(TmyCustomField), that in the base unit. now i like to inherit both TmyFields and TmyParams to add functions work on Firebird, TmyFirebirdFields and TmyFirebirdParams, both have same functions to work on buffer SQLDA. Best Regards Zaher Dirkey ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Extend multiple classes with same code
You simply cant do it. Not even multiple inheritance would help you in this case. You will have to extend each class by hand. Multiple inheritance would allow you to join back branches in the class hierarchy, but in this case you want to add the same functionality to multiple branches, but keep the branches separate entities. This is impossible with current freepascal OOP and i dont think this is even a good thing to have. It could be done multi-class helper, kind of class helper that works on multiple classes. But i dont even know of a language that has such possibility (i dont know much languages anyway). 2012/5/18 Zaher Dirkey : > > On Fri, May 18, 2012 at 11:27 PM, Bernd wrote: >> >> >> _B3 = class(T_A); >> How about this: >> >> T_A = class(TObject); >> >> T_AX = class(T_A); // <-- this class implements your extensions >> >> T_B1 = class(T_AX); // TB_1 and >> T_B2 = class(T_AX); // TB_2 inherit it >> T_B3 = class(T_A); >> >> > > I can't, in fact it is my mistak when i explained. > > B1 B2 is in the base unit like as A, i cant modify it, very strict. > > My projects is db layer, i have TmyCustomField, > TmyFields=class(TmyCustomField) and TmyParams=class(TmyCustomField), that in > the base unit. > > now i like to inherit both TmyFields and TmyParams to add functions work on > Firebird, TmyFirebirdFields and TmyFirebirdParams, both have same functions > to work on buffer SQLDA. > > Best Regards > Zaher Dirkey > > > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal