LibreOffice Module connectivity (master) 1
JBigDecimal.cxx
Go to the documentation of this file.
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
21#include <java/tools.hxx>
22using namespace connectivity;
23
24//************ Class: java.lang.Boolean
25
26
27jclass java_math_BigDecimal::theClass = nullptr;
28
29java_math_BigDecimal::~java_math_BigDecimal()
30{}
31
33{
34 // the class must be fetched only once, therefore static
35 if( !theClass )
36 theClass = findMyClass("java/math/BigDecimal");
37 return theClass;
38}
39
40java_math_BigDecimal::java_math_BigDecimal( const OUString& _par0 ): java_lang_Object( nullptr, nullptr )
41{
43 if( !t.pEnv )
44 return;
45 // Java-Call for the Constructor
46 // initialize temporary Variable
47 static const char * const cSignature = "(Ljava/lang/String;)V";
48 jobject tempObj;
49 static jmethodID mID(nullptr);
50 obtainMethodId_throwSQL(t.pEnv, "<init>",cSignature, mID);
51
52 jstring str = convertwchar_tToJavaString(t.pEnv,_par0.replace(',','.'));
53 tempObj = t.pEnv->NewObject( getMyClass(), mID, str );
54 t.pEnv->DeleteLocalRef(str);
55 saveRef( t.pEnv, tempObj );
56 t.pEnv->DeleteLocalRef( tempObj );
57 ThrowSQLException( t.pEnv, nullptr );
58 // and cleanup
59}
60
61java_math_BigDecimal::java_math_BigDecimal( const double& _par0 ): java_lang_Object( nullptr, nullptr )
62{
64 if( !t.pEnv )
65 return;
66 // Java-Call for the Constructor
67 // initialize temporary Variable
68 static const char * const cSignature = "(D)V";
69 jobject tempObj;
70 static jmethodID mID(nullptr);
71 obtainMethodId_throwSQL(t.pEnv, "<init>",cSignature, mID);
72 tempObj = t.pEnv->NewObject( getMyClass(), mID, _par0 );
73 saveRef( t.pEnv, tempObj );
74 t.pEnv->DeleteLocalRef( tempObj );
75 ThrowSQLException( t.pEnv, nullptr );
76 // and cleanup
77}
78
79/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
XPropertyListType t
void saveRef(JNIEnv *pEnv, jobject myObj)
Definition: Object.cxx:142
static void ThrowSQLException(JNIEnv *pEnv, const css::uno::Reference< css::uno::XInterface > &_rContext)
Definition: Object.cxx:208
static jclass findMyClass(const char *_pClassName)
Definition: Object.cxx:466
void obtainMethodId_throwSQL(JNIEnv *_pEnv, const char *_pMethodName, const char *_pSignature, jmethodID &_inout_MethodID) const
Definition: Object.cxx:229
java_math_BigDecimal(const OUString &_par0)
Definition: JBigDecimal.cxx:40
virtual jclass getMyClass() const override
Definition: JBigDecimal.cxx:32
jstring convertwchar_tToJavaString(JNIEnv *pEnv, const OUString &Temp)
Definition: tools.cxx:93