2009-04-24 23:15 UTC+0300 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt)
* harbour/contrib/hbole/olecore.c
* harbour/contrib/hbole/oleauto.prg
+ implemented FOR EACH enumeration. The code was proposed by
Przemyslaw on mailing list. Some fixes applied.
Hi,
I've put some hands on OLE again - added FOR EACH enumeration support.
Though, OLE does not support backward iteration. Should we ignore
backward (descending) iteration flag and do forward iteration, should we
do not iterate at all (current behavior), or should we give runtime
error (which one?)?
I've tried to run contrib/hbole/tests/testole.prg code and work a little
for missing features. One of the first is array access operator.
It can easy be implemented by adding:
...
METHOD __Index( nIndex ) OPERATOR "[]"
ENDCLASS
METHOD __Index( nIndex ) CLASS HB_OLEAUTO
RETURN ::Item( nIndex )
The feature is available in current code also, i.e. I can write:
oWorkbook:WorkSheets:Item(1)
Of cause
oWorkbook:WorkSheets[1]
looks more friendly, but don't we invent something new in OLE world.
I've tried to write a simple .vbs script. Visual basic does not accept
oWorkbook:WorkSheets[1]
It does accept:
oWorkbook:WorkSheets(1)
but this work also in current hbole implementation. That is array access
syntax in VB? Does it work for OLE collections?
Ok, I can add the 3 lines and make a support for array access operation.
If you'll look to win_tole.prg, you'll see that implementation is more
complex than 3 lines proposed by me, it tries to handle array assign. It
tries to do it in two ways: using :_Item(), and using :SetItem(). If you
look to ICollection documentation you'll not find any of these
collection item assignment ways documented. ICollection supports Item(),
AddAt(), AddItem() methods, but no SetItem(). This is why, I do not want
to implement these array assignment syntax. But do we need array access
syntax? How does it work on OLE automation object in other languages?
Regards,
Mindaugas
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour