24#include <unordered_map>
30#include <rtl/ustring.hxx>
31#include <rtl/strbuf.hxx>
33#include <uno/environment.h>
34#include <typelib/typedescription.hxx>
36#include <com/sun/star/uno/Type.hxx>
38namespace jvmaccess {
class UnoVirtualMachine; }
44 typelib_TypeDescriptionReference * type1,
45 typelib_TypeDescriptionReference * type2 )
49 OUString
const & name1 =
50 OUString::unacquired( &type1->pTypeName );
51 OUString
const & name2 =
52 OUString::unacquired( &type2->pTypeName );
53 return ((type1->eTypeClass == type2->eTypeClass) && name1 == name2);
58 return ((typelib_TypeClass_INTERFACE ==
type->eTypeClass) &&
59 OUString::unacquired( &
type->pTypeName ) ==
"com.sun.star.uno.XInterface");
67 ::com::sun::star::uno::TypeDescription
m_td;
70 virtual void destroy( JNIEnv * jni_env ) = 0;
73 { jni_env->DeleteGlobalRef(
m_class ); }
86 virtual void destroy( JNIEnv * jni_env )
override;
102 virtual void destroy( JNIEnv * jni_env )
override;
120typedef std::unordered_map<
216 typelib_TypeDescriptionReference * type )
const;
219 OUString
const & uno_name )
const;
221 OStringBuffer * buf, typelib_TypeDescriptionReference * type,
222 bool use_Object_for_type_XInterface =
true,
bool use_slashes =
true );
227 inline void destroy( JNIEnv * jni_env );
235 JNI_info( JNIEnv * jni_env, jobject class_loader,
236 jclass classClass, jmethodID methodForName );
247 OStringBuffer * buf, typelib_TypeDescriptionReference * type,
248 bool use_Object_for_type_XInterface,
bool use_slashes )
250 switch (
type->eTypeClass)
252 case typelib_TypeClass_VOID:
255 case typelib_TypeClass_CHAR:
258 case typelib_TypeClass_BOOLEAN:
261 case typelib_TypeClass_BYTE:
264 case typelib_TypeClass_SHORT:
265 case typelib_TypeClass_UNSIGNED_SHORT:
268 case typelib_TypeClass_LONG:
269 case typelib_TypeClass_UNSIGNED_LONG:
272 case typelib_TypeClass_HYPER:
273 case typelib_TypeClass_UNSIGNED_HYPER:
276 case typelib_TypeClass_FLOAT:
279 case typelib_TypeClass_DOUBLE:
282 case typelib_TypeClass_STRING:
284 buf->append(
"Ljava/lang/String;" );
286 buf->append(
"Ljava.lang.String;" );
289 case typelib_TypeClass_TYPE:
291 buf->append(
"Lcom/sun/star/uno/Type;" );
293 buf->append(
"Lcom.sun.star.uno.Type;" );
296 case typelib_TypeClass_ANY:
298 buf->append(
"Ljava/lang/Object;" );
300 buf->append(
"Ljava.lang.Object;" );
303 case typelib_TypeClass_ENUM:
304 case typelib_TypeClass_STRUCT:
305 case typelib_TypeClass_EXCEPTION:
307 OUString
const & uno_name =
308 OUString::unacquired( &
type->pTypeName );
311 sal_Int32
i = uno_name.indexOf(
'<' );
315 use_slashes ? uno_name.replace(
'.',
'/' ) : uno_name,
316 RTL_TEXTENCODING_JAVA_UTF8 ) );
318 OUString s( uno_name.copy( 0,
i ) );
321 use_slashes ? s.replace(
'.',
'/' ) : s,
322 RTL_TEXTENCODING_JAVA_UTF8 ) );
327 case typelib_TypeClass_SEQUENCE:
332 buf,
reinterpret_cast<typelib_IndirectTypeDescription *
>(td.
get())->pType,
333 use_Object_for_type_XInterface, use_slashes );
336 case typelib_TypeClass_INTERFACE:
340 buf->append(
"Ljava/lang/Object;" );
342 buf->append(
"Ljava.lang.Object;" );
347 OUString
const & uno_name =
348 OUString::unacquired( &
type->pTypeName );
352 use_slashes ? uno_name.replace(
'.',
'/' ) : uno_name,
353 RTL_TEXTENCODING_JAVA_UTF8 ) );
359 "unsupported type: " +
360 OUString::unacquired( &
type->pTypeName ) );
jmethodID m_method_IEnvironment_getRegisteredInterface
jfieldID m_field_JNI_proxy_m_td_handle
jmethodID m_ctor_Short_with_short
jmethodID m_method_Integer_intValue
jmethodID m_method_Boolean_booleanValue
jmethodID m_ctor_Character_with_char
jmethodID m_method_Short_shortValue
jmethodID m_ctor_Double_with_double
void destruct(JNIEnv *jni_env)
jmethodID m_method_Long_longValue
jclass m_class_UnoRuntime
jmethodID m_method_Class_getName
::com::sun::star::uno::Type const & m_RuntimeException_type
static JNI_info const * get_jni_info(rtl::Reference< jvmaccess::UnoVirtualMachine > const &uno_vm)
jfieldID m_field_JNI_proxy_m_oid
jmethodID m_ctor_Float_with_float
jfieldID m_field_Type_typeName
jmethodID m_ctor_Any_with_Type_Object
jclass m_class_RuntimeException
jmethodID m_method_JNI_proxy_get_proxy_ctor
jmethodID m_method_Double_doubleValue
jfieldID m_field_JNI_proxy_m_type
jobject m_object_Type_UNSIGNED_LONG
jmethodID m_method_IEnvironment_registerInterface
::com::sun::star::uno::TypeDescription m_XInterface_queryInterface_td
jmethodID m_method_Class_forName
jfieldID m_field_Enum_m_value
::com::sun::star::uno::Type const & m_Exception_type
jmethodID m_method_TypeClass_fromInt
jobject m_object_Type_UNSIGNED_HYPER
jmethodID m_method_Float_floatValue
JNI_info(const JNI_info &)=delete
jmethodID m_ctor_Byte_with_byte
jmethodID m_ctor_Type_with_Name_TypeClass
::com::sun::star::uno::Type const & m_void_type
jmethodID m_ctor_Boolean_with_boolean
jfieldID m_field_Any_object
const JNI_info & operator=(const JNI_info &)=delete
jobject m_object_java_env
jmethodID m_ctor_Long_with_long
JNI_type_info const * get_type_info(JNI_context const &jni, typelib_TypeDescription *type) const
JNI_interface_type_info const * m_XInterface_type_info
jfieldID m_field_Any_type
jmethodID m_method_Byte_byteValue
jmethodID m_method_JNI_proxy_create
void destroy(JNIEnv *jni_env)
static void append_sig(OStringBuffer *buf, typelib_TypeDescriptionReference *type, bool use_Object_for_type_XInterface=true, bool use_slashes=true)
jmethodID m_ctor_AsynchronousFinalizer
jmethodID m_ctor_Integer_with_int
jmethodID m_method_UnoRuntime_generateOid
jmethodID m_ctor_Type_with_Class
jfieldID m_field_JNI_proxy_m_receiver_handle
jmethodID m_method_AsynchronousFinalizer_drain
jobject m_object_Type_UNSIGNED_SHORT
jmethodID m_method_UnoRuntime_queryInterface
jobject m_object_Any_VOID
JNI_type_info const * create_type_info(JNI_context const &jni, typelib_TypeDescription *td) const
jmethodID m_method_Character_charValue
jclass m_class_AsynchronousFinalizer
jmethodID m_method_Object_toString
jmethodID m_method_Throwable_getMessage
typelib_TypeDescription * get() const
struct _typelib_TypeDescription typelib_TypeDescription
bool type_equals(typelib_TypeDescriptionReference *type1, typelib_TypeDescriptionReference *type2)
std::unordered_map< OUString, JNI_type_info_holder > t_str2type
bool is_XInterface(typelib_TypeDescriptionReference *type)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
std::unique_ptr< jfieldID[]> m_fields
virtual void destroy(JNIEnv *jni_env) override
virtual ~JNI_compound_type_info() override
JNI_compound_type_info(JNI_context const &jni, typelib_TypeDescription *td)
JNI_type_info const * m_base
virtual ~JNI_interface_type_info() override
JNI_interface_type_info(JNI_context const &jni, typelib_TypeDescription *td)
virtual void destroy(JNIEnv *jni_env) override
std::unique_ptr< jmethodID[]> m_methods
const JNI_type_info_holder & operator=(const JNI_type_info_holder &)=delete
JNI_type_info_holder(const JNI_type_info_holder &)=delete
void destruct(JNIEnv *jni_env)
::com::sun::star::uno::TypeDescription m_td
const JNI_type_info & operator=(const JNI_type_info &)=delete
JNI_type_info(const JNI_type_info &)=delete
virtual void destroy(JNIEnv *jni_env)=0