Re: [api-dev] Re: Usage of UNO_QUERY_THROW

2008-12-16 Thread Daniel Rentz

Frank Schönheit - Sun Microsystems Germany schrieb:

Hi Daniel,


What happens if UNO_QUERY_THROW is used instead?
...
What is the reason you have introduced UNO_SET_THROW?


It spares the queryInterface call. For a pattern like

  Reference< XFoo > xFoo = xBar->getSomeFoo();
  // ensure that xFoo is not NULL, which would be a violation
  // of xBar's constraint
  ...

it just felt wrong (since potentially too expensive) to do

  Reference< XFoo > xFoo( xBar->getSomeFoo(), UNO_QUERY_THROW );

UNO_SET_THROW is cheaper in this case.


Ok, understood. Thanks.

Daniel

-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] Re: Usage of UNO_QUERY_THROW

2008-12-16 Thread Frank Schönheit - Sun Microsystems Germany
Hi Daniel,

> What happens if UNO_QUERY_THROW is used instead?
> ...
> What is the reason you have introduced UNO_SET_THROW?

It spares the queryInterface call. For a pattern like

  Reference< XFoo > xFoo = xBar->getSomeFoo();
  // ensure that xFoo is not NULL, which would be a violation
  // of xBar's constraint
  ...

it just felt wrong (since potentially too expensive) to do

  Reference< XFoo > xFoo( xBar->getSomeFoo(), UNO_QUERY_THROW );

UNO_SET_THROW is cheaper in this case.

Ciao
Frank

-- 
- Frank Schönheit, Software Engineer frank.schoenh...@sun.com -
- Sun Microsystems  http://www.sun.com/staroffice -
- OpenOffice.org Base   http://dba.openoffice.org -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] Re: Usage of UNO_QUERY_THROW

2008-12-15 Thread Daniel Rentz

Frank Schönheit schrieb:

Hi Michael,


so i thought, what the heck is UNO_SET_THROW?
it seems to do the same thing as UNO_QUERY_THROW, except it does not 
query, it only checks for NULL.
hmm, according to opengrok's mere 50 results, i'm not the only one who 
never heard of it...


http://www.openoffice.org/servlets/ReadMsg?list=interface-announce&msgNo=1092

I know that hardly anybody cares about *announcing* interface
changes/extensions in interface-announce, but that even nobody cares to
*read* this list ... :-\


Thanks for the pointer, I remember I have read it but didn't need it for 
a long time, so I have forgotten. Shame on me.


What happens if UNO_QUERY_THROW is used instead? As far as I can see, 
"Reference< interface_type >::Reference( XInterface * pInterface, 
UnoReference_QueryThrow )" calls "Reference< interface_type 
>::iquery_throw( XInterface * pInterface )" which calls 
"BaseReference::iquery_throw( XInterface* pInterface, const Type & rType 
)" which calls "BaseReference::iquery( XInterface * pInterface, const 
Type & rType )" which returns 0. So, iquery_throw will throw too.


What is the reason you have introduced UNO_SET_THROW?


Regards
Daniel

-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] Re: Usage of UNO_QUERY_THROW

2008-12-12 Thread Frank Schönheit
Hi Michael,

> so i thought, what the heck is UNO_SET_THROW?
> it seems to do the same thing as UNO_QUERY_THROW, except it does not 
> query, it only checks for NULL.
> hmm, according to opengrok's mere 50 results, i'm not the only one who 
> never heard of it...

http://www.openoffice.org/servlets/ReadMsg?list=interface-announce&msgNo=1092

I know that hardly anybody cares about *announcing* interface
changes/extensions in interface-announce, but that even nobody cares to
*read* this list ... :-\

Ciao
Frank


-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org