RE: [gtkmm] The correct way to use Glib::Error?



> From: gtkmm-list-admin gnome org 
>   I sent this request out a couple of months ago and didn't 
> get a response, so I'll try again.  I'd be fine if someone 
> would just point me to an example.
> 
>   I'm not sure of the method of using Glib::Error in Gtkmm2.  
> Should I throw short exceptions,

What's a short exception?

> pass pointers or something else?

Most people prefer to catch exceptions as const references. Just throw them
as instances and never mind the pointers. But that's just generel exceptions
advice, and not specific to Glib::Error exceptions.
 
>   I'm starting a port and I really don't want to have to go 
> through the error code twice.
> 
>   Are there any examples that show they way it's ment to be 
> used? If not, how would I implement the following pseudo code 
> "properly"?

Are you trying to wrap Gerrors, or just trying to do the same thing in C++.
If the exceptions don't match any actual Gerrors, then you can easily derive
your own exception heirarchy in C++. There's no reason to throw glibmm
exceptions unless you are wrapping functions that return Gerrors.

If you are wrapping a C API, then I can tell you how to wrap Gerror*
arguments as exceptions.

Murray Cumming
www.murrayc.com
murrayc usa net



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]