class theExceptionThrower : public rtl::Static<ExceptionThrower, theExceptionThrower> {};
#if RETHROW_FAKE_EXCEPTIONS // In the native iOS / Android app, where we don't have any Java, Python, // BASIC, or other scripting, the only thing that would use the C++/UNO bridge // functionality that invokes codeSnippet() was cppu::throwException(). // // codeSnippet() is part of what corresponds to the code that uses // run-time-generated machine code on other platforms. We can't generate code // at run-time on iOS, that has been known forever. // // Instead of digging in and trying to understand what is wrong, another // solution was chosen. It turns out that the number of types of exception // objects thrown by cppu::throwException() is fairly small. During startup of // the LibreOffice code, and loading of an .odt document, only one kind of // exception is thrown this way... (The lovely // css::ucb:InteractiveAugmentedIOException.) // // So we can simply have code that checks what the type of object being thrown // is, and explicitly throws such an object then with a normal C++ throw // statement. Seems to work. template <class E> void tryThrow(css::uno::Any const& aException)
{
E aSpecificException; if (aException >>= aSpecificException) throw aSpecificException;
}
void SAL_CALL throwException( Any const & exc )
{ if (exc.getValueTypeClass() != TypeClass_EXCEPTION)
{ throw RuntimeException(
u"no UNO exception given " "(must be derived from com::sun::star::uno::Exception)!"_ustr );
}
#if RETHROW_FAKE_EXCEPTIONS
lo_mobile_throwException(exc); #else
Mapping uno2cpp(Environment(u"" UNO_LB_UNO ""_ustr), Environment::getCurrent()); if (! uno2cpp.is())
{ throw RuntimeException(
u"cannot get binary UNO to C++ mapping!"_ustr );
}
Any SAL_CALL getCaughtException()
{ // why does this differ from RETHROW_FAKE_EXCEPTIONS? #ifdefined(ANDROID) return Any(); #else
Mapping cpp2uno(Environment::getCurrent(), Environment(u"" UNO_LB_UNO ""_ustr)); if (! cpp2uno.is())
{ throw RuntimeException(
u"cannot get C++ to binary UNO mapping!"_ustr );
}
Mapping uno2cpp(Environment(u"" UNO_LB_UNO ""_ustr), Environment::getCurrent()); if (! uno2cpp.is())
{ throw RuntimeException(
u"cannot get binary UNO to C++ mapping!"_ustr );
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.