Re: [fpc-pascal] OOP and XML usage

2010-01-30 Thread Jorge Aldo G. de F. Junior
using my system you can retrieve the text by a typecast

mytag.first;
mytag.findofclass(TXMLText); <- will stop the search at the first
object of specified class
If mytag.child is TXMLText Then <- to guarantee that we have found something
  WriteLn((mytag.child as TXMLText).Content); <- will print the
contents of the text

or if you know the text position between the child tags

writeln((mytag.childs[0] As TXMLText).Content);

but this is a way quite harder than a simple

WriteLn(mytag.properties['ip']); <- will return the property or '' if
not set (the object constructor can setup defaults)

thats why i prefer tag properties instead of xml text...

later you can save the objects with

Var F : Text;
Begin
  Assign(F, 'myfile.xml');
  Rewrite(F);
  WriteLn(F, MyTag.AsXML);
  Close(F);
End;

2010/1/29 Graeme Geldenhuys :
> Jorge Aldo G. de F. Junior wrote:
>> and actually i prefer to setup properties of objects using xml
>> properties instead of xml text
>>
>>  instead of
>> 192.168.1.180
>
> Both examples are valid XML, so I don't see any issue the way I am using
> it. My previous example was just that, an example. My actual XML uses both
> tag attributes and element text. The later is mainly used for longer text
> in my xml file.
>
>
>
> Regards,
>  - Graeme -
>
> --
> fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
> http://opensoft.homeip.net/fpgui/
>
> ___
> fpc-pascal maillist  -  fpc-pas...@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


Re: [fpc-pascal] Stupid question: is this safe?

2010-01-30 Thread Bart
On 1/29/10, Jonas Maebe  wrote:

>  The only problem that can occur is a range check run time error in case
> range checking is enabled.

Ok, thanks for the quick answer.
I actually need this in the fix for IntStrToTime() I'm working on.

Bart
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Stupid question: is this safe?

2010-01-30 Thread Marco van de Voort
In our previous episode, Bart said:
> >  The only problem that can occur is a range check run time error in case
> > range checking is enabled.
> 
> Ok, thanks for the quick answer.
> I actually need this in the fix for IntStrToTime() I'm working on.

Btw http://bugs.freepascal.org/view.php?id=15633

I also updated the unit test with your most recent questions.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Stupid question: is this safe?

2010-01-30 Thread Bart
On 1/30/10, Marco van de Voort  wrote:
> Btw http://bugs.freepascal.org/view.php?id=15633
>
>  I also updated the unit test with your most recent questions.

Saw that.
We're almost there I guess.
I'll post back in Mantis.

Thanks,

Bart
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Problem with Objective Pascal and delphi mode

2010-01-30 Thread Felipe Monteiro de Carvalho
Thanks Jonas,

One more thing, why is the modeswitch called objectivec1 ? It could be
objectivepascal instead.

Does the number 1 imply that it's version 1 of the mode and there may
be multiple versions supported at the same time? Or was it for
Objective C Runtime Library 1.0 ? (I am almost sure that not)

thanks,
-- 
Felipe Monteiro de Carvalho
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Problem with Objective Pascal and delphi mode

2010-01-30 Thread Jonas Maebe

On 30 Jan 2010, at 20:08, Felipe Monteiro de Carvalho wrote:

> One more thing, why is the modeswitch called objectivec1 ? It could be
> objectivepascal instead.
> 
> Does the number 1 imply that it's version 1 of the mode and there may
> be multiple versions supported at the same time? Or was it for
> Objective C Runtime Library 1.0 ? (I am almost sure that not)

It means/meant version one of the Objective-C language. The Objective-C 
language evolves semi-independently of the run time (you can write programs in 
Objective-C 2.0 running on i386 and ppc32, whose Objective-C runtime is version 
1). Objective-C 2.0 (the language) features require Mac OS X 10.5 or later, 
while 1.0 features are available as of 10.0.

See http://en.wikipedia.org/wiki/Objective-C#Objective-C_2.0 and 
http://lists.apple.com/archives/Objc-language/2006/Aug/msg00039.html for some 
features that were added in 2.0. And I just realised I actually already added a 
feature of Objective-C 2.0, namely the ability to specify protocol methods as 
"optional" (although this will not break programs when running on 10.4 and 
earlier, because those systems only have version 1.0 of the run time, and in 
that case no distinction is made in the rtti between optional and required 
methods -- so this means that FPC takes these modifiers into account during 
compilation, but the run time won't see/check them when running on such 
systems).

That's also why it says objectivec1 and not objectivepascal1: it refers to the 
Objective-C 1.0 language.


Jonas___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal