> Anyway, Paul, can you help me on one thing please? Can you tell me how I can
> use this ErrorPrinter for warnings too?
An XQueryWarning is just a typedef for XQueryException, so it should just work
as-is.
That aside: generally, I don't like to decide for the user how errors should be
printed. By putting an error-printer in the public API, you're essentially
making that decision for them. If you're going to do that, you could just
define operator<<(ostream&,ZorbaException const&) and then << would just work.
If you want to set parameters (like XML or indentation), then the nice way to
do it is via stream manipulators, e.g.:
// ...
}
catch ( XQueryException const &e ) {
cout << XQueryException::as_xml << XQueryException::indent( 2 ) << e;
}
You can look at src/util/indent.h for how to do this kind of thing. The above
manipulators, however, should be "one-shot" and auto-reset (which is trivial to
do).
--
https://code.launchpad.net/~zorba-coders/zorba/zorba-error_printer_in_api/+merge/134405
Your team Zorba Coders is subscribed to branch lp:zorba.
--
Mailing list: https://launchpad.net/~zorba-coders
Post to : [email protected]
Unsubscribe : https://launchpad.net/~zorba-coders
More help : https://help.launchpad.net/ListHelp