On Mon, Sep 23, 2013 at 8:50 AM, Sven Barth pascaldra...@googlemail.comwrote:
You need to add a Result.Assign(Self) to your clone call and implement
a virtually inherited Assign method in each class where you copy all
fields. This is how TPersistent and its descendants do it as well.
Yes I
On Mon, 23 Sep 2013, Zaher Dirkey wrote:
Hi,
I have objects (classes) derived from base one
TBaseObject = class(TObject)
public
constructor Create; virtual;
function Clone:TBaseObject;
end;
TMyObject = class(TBaseObject)
my fields here
end;
o1, o2:TmyObject;
o1 already created;
On 23/09/13 10:02, Michael Van Canneyt wrote:
This is wrong. You are typecasting a class reference to an object
instance.
The following works:
{$mode objfpc}
Type
TBaseObject = class(TObject)
public
constructor Create; virtual;
function Clone:TBaseObject;
end;
TBaseObjectClass
On Mon, 23 Sep 2013, patspiper wrote:
On 23/09/13 10:02, Michael Van Canneyt wrote:
This is wrong. You are typecasting a class reference to an object instance.
The following works:
{$mode objfpc}
Type
TBaseObject = class(TObject)
public
constructor Create; virtual;
function
Short answer: you can't. The same would happen with normal classes.
Long answer: You could add an additional method Next to your TIntTree
which returns a TIntTree and just do Result := TIntTree(inherited
Next); there.
Why are you subclassing in this case anyway?
Thanks, I will inherit the
On 09/21/2013 04:04 PM, Xiangrong Fang wrote:
Hi All,
I need to use a C++ so file in FreePascal
AFAIK, you only can use C++ libraries in Pascal, if the functions for
the mutual interface are flat C function (i. e. ANSI C functions not
using any C++ classes). Of course, on top of this in
Am 23.09.2013 10:53, schrieb Michael Schnell:
On 09/21/2013 04:04 PM, Xiangrong Fang wrote:
Hi All,
I need to use a C++ so file in FreePascal
AFAIK, you only can use C++ libraries in Pascal, if the functions for
the mutual interface are flat C function (i. e. ANSI C functions not
using any
On Mon, Sep 23, 2013 at 10:02 AM, Michael Van Canneyt
mich...@freepascal.org wrote:
Var
C : TBaseObjectClass;
begin
C:=TBaseObjectClass(ClassType)**;
Result:=C.Create;
end;
Yes, that help me, thanks.
Now about assigning I must repeat it (assign) for every child class copy
its
On 20/09/13 19:49, Bart wrote:
On 9/20/13, Reinier Olislagers reinierolislag...@gmail.com wrote:
The question however becomes what is the
algorithm for deciding invalid characters which IMO will become a mess
very quickly. Much better to just consider the entire input as invalid.
Here's
On Mon, Sep 23, 2013 at 12:46 PM, Michael Van Canneyt
mich...@freepascal.org wrote:
There is no such safe mechanism.
The best you can do is make the properties published, and write an RTTI
lookup routine that copies all Published values.
I've done this several times, it works well for most
On Mon, 23 Sep 2013, Zaher Dirkey wrote:
On Mon, Sep 23, 2013 at 12:46 PM, Michael Van Canneyt mich...@freepascal.org
wrote:
There is no such safe mechanism.
The best you can do is make the properties published, and write an RTTI
lookup routine that copies all Published
On Mon, 23 Sep 2013 11:46:54 +0200 (CEST)
Michael Van Canneyt mich...@freepascal.org wrote:
On Mon, 23 Sep 2013, Zaher Dirkey wrote:
On Mon, Sep 23, 2013 at 10:02 AM, Michael Van Canneyt
mich...@freepascal.org wrote:
Var
C : TBaseObjectClass;
begin
On Mon, Sep 23, 2013 at 12:57 PM, Mattias Gaertner
nc-gaert...@netcologne.de wrote:
type
TMyClass = class(TPersistent)
private
type
TMyClassVars = record
a,b,c: string;
end;
private
F: TMyClassVars;
public
procedure Assign(Source: TPersistent);
On Mon, 23 Sep 2013 12:10:41 +0200
Frederic Da Vitoria davito...@gmail.com wrote:
2013/9/23 Mattias Gaertner nc-gaert...@netcologne.de
On Mon, 23 Sep 2013 11:46:54 +0200 (CEST)
Michael Van Canneyt mich...@freepascal.org wrote:
On Mon, 23 Sep 2013, Zaher Dirkey wrote:
sorry ... delayed answer ... I don´t felt very well these days
and this subject is a bit difficult for me ... but I will give time this
week to read all I received ... and find out a way ... I´ll write later
this week
any way, I thank you very much all for your help!
Philippe
On
Am 23.09.2013 13:09, schrieb Guillermo Martínez:
Hi,
I'm receiving some of the messages from this mailing list coding in an
odd format: A block of characters and digits without any sense. For
example, the one I quoted at the end of this mail. Does somebody knows
why?
According to my
On Mon, 23 Sep 2013, Mattias Gaertner wrote:
On Mon, 23 Sep 2013 11:46:54 +0200 (CEST)
Michael Van Canneyt mich...@freepascal.org wrote:
On Mon, 23 Sep 2013, Zaher Dirkey wrote:
On Mon, Sep 23, 2013 at 10:02 AM, Michael Van Canneyt mich...@freepascal.org
wrote:
Var
C :
I realized FPC supports nested {} comments by default.
SynPdf, a Synopse PDF engine
http://synopse.info/fossil/wiki?name=PDF+Engine
has '{' characters inside comments but they are not meant as nested comments.
How to turn nested comments off?
I did not find any such option even by using the new
On Mon, 23 Sep 2013, Juha Manninen wrote:
I realized FPC supports nested {} comments by default.
SynPdf, a Synopse PDF engine
http://synopse.info/fossil/wiki?name=PDF+Engine
has '{' characters inside comments but they are not meant as nested comments.
How to turn nested comments off?
I did
On Mon, September 23, 2013 13:22, Sven Barth wrote:
Am 23.09.2013 13:09, schrieb Guillermo Martínez:
Hi,
I'm receiving some of the messages from this mailing list coding in an
odd format: A block of characters and digits without any sense. For
example, the one I quoted at the end of this
On 23/09/13 14:57, Michael Van Canneyt wrote:
On Mon, 23 Sep 2013, Mattias Gaertner wrote:
On Mon, 23 Sep 2013 11:46:54 +0200 (CEST)
Michael Van Canneyt mich...@freepascal.org wrote:
On Mon, 23 Sep 2013, Zaher Dirkey wrote:
On Mon, Sep 23, 2013 at 10:02 AM, Michael Van Canneyt
On Mon, Sep 23, 2013 at 3:06 PM, Michael Van Canneyt
mich...@freepascal.org wrote:
Use Delphi mode or TP mode.
Thanks, it helped.
Actually there already was {$MODE Delphi} in an include file.
Apparently it does not work, it must be in every pascal unit.
This PDF package still does not compile
Am 23.09.2013 14:28, schrieb Juha Manninen:
On Mon, Sep 23, 2013 at 3:06 PM, Michael Van Canneyt
mich...@freepascal.org wrote:
Use Delphi mode or TP mode.
Thanks, it helped.
Actually there already was {$MODE Delphi} in an include file.
Apparently it does not work, it must be in every pascal
2013/9/23 Michael Van Canneyt mich...@freepascal.org
On Mon, 23 Sep 2013, Mattias Gaertner wrote:
On Mon, 23 Sep 2013 11:46:54 +0200 (CEST)
Michael Van Canneyt mich...@freepascal.org wrote:
On Mon, 23 Sep 2013, Zaher Dirkey wrote:
On Mon, Sep 23, 2013 at 10:02 AM, Michael Van Canneyt
On Mon, 23 Sep 2013, Frederic Da Vitoria wrote:
Yes. But that works only for 'simple' types and still requires you to write
code.
For the more general case where you can have arrays, classes, interfaces and
whatnot as fields of your object, there is simply no correct way.
Isn't there?
Am 23.09.2013 14:23, schrieb patspiper:
On 23/09/13 14:57, Michael Van Canneyt wrote:
On Mon, 23 Sep 2013, Mattias Gaertner wrote:
On Mon, 23 Sep 2013 11:46:54 +0200 (CEST)
Michael Van Canneyt mich...@freepascal.org wrote:
On Mon, 23 Sep 2013, Zaher Dirkey wrote:
On Mon, Sep 23, 2013
From: Tomas Hajny xhaj...@hajny.biz
That should not be an issue by itself. The more likely reason is
probably use of 8-bit message (utf-8) without encoding in us-ascii
(7-bit) compatible envelope - typically MIME Quoted Printable (as
already used for the HTML section, but not for the plain
On 23/09/13 10:46, Michael Van Canneyt wrote:
I've done this several times, it works well for most situations.
My I also suggest Zaher takes a look at tiOPF's code to see how they
implement class cloning.
Also be careful about the pitfalls of cloning a class. eg: How you want
to handle more
On Mon, Sep 23, 2013 at 12:58 PM, Graeme Geldenhuys gra...@geldenhuys.co.uk
wrote:
Also be careful about the pitfalls of cloning a class. eg: How you want
to handle more complex cases. eg: Cloning a class with a reference to
another class, or cloning a class with an embedded class (field),
On Mon, Sep 23, 2013 at 4:28 PM, Zaher Dirkey parm...@gmail.com wrote:
The idea is simply than needs to use a stream or RTTI, it is like a
record, if looked at an object like as a record but it is inheritable.
Compile can now every object body, and do the assigning as record assign.
I changed the webmail configuration to MIME / 8 bits ... I hope it
helps!
Philippe
On Mon, 23 Sep 2013 15:06:00 +0200, Guillermo
Martínez wrote:
From: Tomas Hajny
That should not be an
issue by itself. The more likely reason is probably use of 8-bit message
(utf-8) without encoding
On 9/23/13, Lukasz Sokol el.es...@gmail.com wrote:
function TryRomanToInt(AInput:String; out AResult: integer):boolean;
var i, Len, N, Np1 : integer;
[snip]
if N = Np1 then AResult := AResult + N
else AResult := AResult - N;
end;
else // i = Len-1 = last char we
Premise: I didn't go through your entire implementation, thou' at first
sight looks much better than the current one.
I know roman numerals since I was 8 or 9 yo, that makes a quick and dirt
result of about 35 years.
Thing is:
1. in the roman numerals, not all the digits can be subtracted
Ooops,
I also forgot to mention that only I, X, C and M can appear up to three
times in a row. V, L and D does not; they can only once.
Cheers again, A.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
On 23.09.2013 21:17, Alberto Narduzzi wrote:
Ooops,
I also forgot to mention that only I, X, C and M can appear up to three
times in a row. V, L and D does not; they can only once.
Are you sure regarding M considering there is no symbol for 5000? Or
didn't Romans count to more than 5000 - 1?
On 9/23/13, Alberto Narduzzi albertonardu...@yahoo.com wrote:
Thing is:
1. in the roman numerals, not all the digits can be subtracted from the
others
2. no more than three same roman numerals can appear in a row.
My implementation is a little more relaxed as to rule 2.
It is more often
On 9/23/13, Sven Barth pascaldra...@googlemail.com wrote:
Are you sure regarding M considering there is no symbol for 5000? Or
didn't Romans count to more than 5000 - 1?
There are numerous extensions upon the scheme.
In later times adding horizontal lines above or under a Roman numeral
meant
2013/9/23 Bart bartjun...@gmail.com
The question was: is current behaviour (accepting IIMIIC etc.) a bug or
not.
What about making an option of it?
Anyhow, if the function accepts invalid combinations, what should it
return? For some, the answer would be obvious (), but some combinations
On 9/23/13, Frederic Da Vitoria davito...@gmail.com wrote:
What about making an option of it?
It's up to the fpc devels.
Anyhow, if the function accepts invalid combinations, what should it
return? For some, the answer would be obvious (), but some combinations
are indeed ambiguous
On Thu, Sep 19, 2013 at 1:44 AM, Sven Barth pascaldra...@googlemail.com wrote:
Am 18.09.2013 23:34 schrieb Marcos Douglas m...@delfire.net:
On Tue, Sep 17, 2013 at 2:41 PM, Sven Barth pascaldra...@googlemail.com
wrote:
On 17.09.2013 17:27, Marcos Douglas wrote:
On Tue, Sep 17, 2013 at
What about making an option of it?
If it accepts, then it should apply the subtraction rule: only the
(one) numeral left to the other (bigger one) can be subtracted.
So IIIM would be III + IM = 3 + 1000-1 = 1002 (and not 1000-3 = 997)
There should be no ambiguity there, it's only a pain to
What about making an option of it?
Anyhow, if the function accepts invalid combinations, what should it
return? For some, the answer would be obvious (), but some
combinations are indeed ambiguous (M) So that we maybe could accept
unambiguous invalid combinations, but I don't see how to
Are you sure regarding M considering there is no symbol for 5000? Or
didn't Romans count to more than 5000 - 1?
yes I am. as 5000 - 1 would need to be written CMXCIX, which has the
4-M-in-a-row, that is invalid, as a maximum of three is allowed.
Yes, probably ancient Romans had no need
On 23/09/2013 22:30, Alberto Narduzzi wrote:
What about making an option of it?
Anyhow, if the function accepts invalid combinations, what should it
return? For some, the answer would be obvious (), but some
combinations are indeed ambiguous (M) So that we maybe could accept
unambiguous
So the question is, what does or should do RomanToInt for invalid input?
It is NOT called CheckValidRoman, so it could be that the result for
invalid input is simply undefined. If it is, then all is ok.
so, what does 10AT (or $10AT for tht matter) return for HexToDec???
maybe NaN, if there is
On Monday, September 23, 2013 7:09 AM, Guillermo Martínez
gmarti...@burdjia.com wrote:
Hi,
I'm receiving some of the messages from this mailing list coding in an
odd format: A block of characters and digits without any sense. For
example, the one I quoted at the end of this mail.
46 matches
Mail list logo