Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : : #ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_
21 : : #define _CONNECTIVITY_JAVA_TOOLS_HXX_
22 : :
23 : : #include <com/sun/star/beans/PropertyValue.hpp>
24 : : #include <com/sun/star/uno/Sequence.h>
25 : :
26 : : #include <jni.h>
27 : : #include "java/sql/SQLException.hxx"
28 : : #include <comphelper/uno3.hxx>
29 : :
30 : : #include <com/sun/star/container/XNameAccess.hpp>
31 : : #include <com/sun/star/io/XInputStream.hpp>
32 : : #include <com/sun/star/util/Time.hpp>
33 : : #include <com/sun/star/util/Date.hpp>
34 : : #include <com/sun/star/util/DateTime.hpp>
35 : :
36 : :
37 : : namespace connectivity
38 : : {
39 : :
40 : : jstring convertwchar_tToJavaString(JNIEnv *pEnv,const ::rtl::OUString& _Temp);
41 : : ::rtl::OUString JavaString2String(JNIEnv *pEnv,jstring _Str);
42 : : class java_util_Properties;
43 : :
44 : : java_util_Properties* createStringPropertyArray(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
45 : :
46 : 0 : template<class T,class JT> ::com::sun::star::uno::Sequence< T > copyArrayAndDelete(JNIEnv *pEnv,jobjectArray _Array, const T*, const JT* )
47 : : {
48 : 0 : ::com::sun::star::uno::Sequence< T > xOut;
49 : 0 : if(_Array)
50 : : {
51 : 0 : jsize nLen = pEnv->GetArrayLength(_Array);
52 : 0 : xOut.realloc(nLen);
53 : 0 : for(jsize i=0;i<nLen;++i)
54 : : {
55 : 0 : JT xInfo(pEnv,pEnv->GetObjectArrayElement(_Array,i));
56 : 0 : java_lang_Object::ThrowSQLException(pEnv,NULL);
57 : 0 : xOut.getArray()[i] = xInfo;
58 : : }
59 : 0 : pEnv->DeleteLocalRef(_Array);
60 : : }
61 : 0 : return xOut;
62 : : }
63 : :
64 : : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > Map2XNameAccess(JNIEnv *pEnv,jobject _pMap);
65 : : jobject convertTypeMapToJavaMap(JNIEnv *pEnv,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & _rMap);
66 : :
67 : : /** return if a exception occurred
68 : : @param pEnv
69 : : The native java env
70 : : @param _bClear
71 : : <TRUE/> if the execption should be cleared
72 : : @return
73 : : <TRUE/> if an exception is occurred
74 : : */
75 : : sal_Bool isExceptionOccurred(JNIEnv *pEnv,sal_Bool _bClear);
76 : :
77 : : jobject createByteInputStream(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x,sal_Int32 length);
78 : : jobject createCharArrayReader(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x,sal_Int32 length);
79 : : }
80 : :
81 : : #endif // _CONNECTIVITY_JAVA_TOOLS_HXX_
82 : :
83 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|