3
* ====================================================================
4
* Licensed to the Apache Software Foundation (ASF) under one
5
* or more contributor license agreements. See the NOTICE file
6
* distributed with this work for additional information
7
* regarding copyright ownership. The ASF licenses this file
8
* to you under the Apache License, Version 2.0 (the
9
* "License"); you may not use this file except in compliance
10
* with the License. You may obtain a copy of the License at
12
* http://www.apache.org/licenses/LICENSE-2.0
14
* Unless required by applicable law or agreed to in writing,
15
* software distributed under the License is distributed on an
16
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17
* KIND, either express or implied. See the License for the
18
* specific language governing permissions and limitations
20
* ====================================================================
23
* @file org_apache_subversion_javahl_types_VersionExtended.cpp
24
* @brief Implementation of the native methods in the Java class VersionExtended.
27
#include "../include/org_apache_subversion_javahl_types_VersionExtended.h"
28
#include "../include/org_apache_subversion_javahl_types_VersionExtended_LinkedLib.h"
29
#include "../include/org_apache_subversion_javahl_types_VersionExtended_LinkedLibIterator.h"
30
#include "../include/org_apache_subversion_javahl_types_VersionExtended_LoadedLib.h"
31
#include "../include/org_apache_subversion_javahl_types_VersionExtended_LoadedLibIterator.h"
32
#include "VersionExtended.h"
33
#include "JNIStackElement.h"
36
// VersionExtended native methods
38
JNIEXPORT jstring JNICALL
39
Java_org_apache_subversion_javahl_types_VersionExtended_getBuildDate(
40
JNIEnv *env, jobject jthis)
42
JNIEntry(VersionExtended, getBuildDate);
43
const VersionExtended *const vx = VersionExtended::getCppObject(jthis);
45
return env->NewStringUTF(vx->build_date());
49
JNIEXPORT jstring JNICALL
50
Java_org_apache_subversion_javahl_types_VersionExtended_getBuildTime(
51
JNIEnv *env, jobject jthis)
53
JNIEntry(VersionExtended, getBuildTime);
54
const VersionExtended *const vx = VersionExtended::getCppObject(jthis);
56
return env->NewStringUTF(vx->build_time());
60
JNIEXPORT jstring JNICALL
61
Java_org_apache_subversion_javahl_types_VersionExtended_getBuildHost(
62
JNIEnv *env, jobject jthis)
64
JNIEntry(VersionExtended, getBuildHost);
65
const VersionExtended *const vx = VersionExtended::getCppObject(jthis);
67
return env->NewStringUTF(vx->build_host());
71
JNIEXPORT jstring JNICALL
72
Java_org_apache_subversion_javahl_types_VersionExtended_getCopyright(
73
JNIEnv *env, jobject jthis)
75
JNIEntry(VersionExtended, getCopyright);
76
const VersionExtended *const vx = VersionExtended::getCppObject(jthis);
78
return env->NewStringUTF(vx->copyright());
82
JNIEXPORT jstring JNICALL
83
Java_org_apache_subversion_javahl_types_VersionExtended_getRuntimeHost(
84
JNIEnv *env, jobject jthis)
86
JNIEntry(VersionExtended, getRuntimeHost);
87
const VersionExtended *const vx = VersionExtended::getCppObject(jthis);
89
return env->NewStringUTF(vx->runtime_host());
93
JNIEXPORT jstring JNICALL
94
Java_org_apache_subversion_javahl_types_VersionExtended_getRuntimeOSName(
95
JNIEnv *env, jobject jthis)
97
JNIEntry(VersionExtended, getRuntimeOSName);
98
const VersionExtended *const vx = VersionExtended::getCppObject(jthis);
100
return env->NewStringUTF(vx->runtime_osname());
105
// VersionExtended.LinkedLib native methods
108
static const svn_version_ext_linked_lib_t *
109
getLinkedLib(JNIEnv *env, jobject jthis)
111
static volatile jfieldID fid = 0;
114
fid = env->GetFieldID(env->GetObjectClass(jthis), "index", "I");
115
if (JNIUtil::isJavaExceptionThrown())
119
const int index = env->GetIntField(jthis, fid);
120
if (JNIUtil::isJavaExceptionThrown())
123
const VersionExtended *const vx =
124
VersionExtended::getCppObjectFromLinkedLib(jthis);
126
return vx->get_linked_lib(index);
129
} // anonymous namespace
131
JNIEXPORT jstring JNICALL
132
Java_org_apache_subversion_javahl_types_VersionExtended_00024LinkedLib_getName(
133
JNIEnv *env, jobject jthis)
135
JNIEntry(VersionExtended$LinkedLib, getName);
136
const svn_version_ext_linked_lib_t *const lib = getLinkedLib(env, jthis);
138
return env->NewStringUTF(lib->name);
142
JNIEXPORT jstring JNICALL
143
Java_org_apache_subversion_javahl_types_VersionExtended_00024LinkedLib_getCompiledVersion(
144
JNIEnv *env, jobject jthis)
146
JNIEntry(VersionExtended$LinkedLib, getCompiledVersion);
147
const svn_version_ext_linked_lib_t *const lib = getLinkedLib(env, jthis);
149
return env->NewStringUTF(lib->compiled_version);
153
JNIEXPORT jstring JNICALL
154
Java_org_apache_subversion_javahl_types_VersionExtended_00024LinkedLib_getRuntimeVersion(
155
JNIEnv *env, jobject jthis)
157
JNIEntry(VersionExtended$LinkedLib, getRuntimeVersion);
158
const svn_version_ext_linked_lib_t *const lib = getLinkedLib(env, jthis);
160
return env->NewStringUTF(lib->runtime_version);
165
// VersionExtended.LoadedLib native methods
168
static const svn_version_ext_loaded_lib_t *
169
getLoadedLib(JNIEnv *env, jobject jthis)
171
static volatile jfieldID fid = 0;
174
fid = env->GetFieldID(env->GetObjectClass(jthis), "index", "I");
175
if (JNIUtil::isJavaExceptionThrown())
179
const int index = env->GetIntField(jthis, fid);
180
if (JNIUtil::isJavaExceptionThrown())
183
const VersionExtended *const vx =
184
VersionExtended::getCppObjectFromLoadedLib(jthis);
186
return vx->get_loaded_lib(index);
189
} // anonymous namespace
191
JNIEXPORT jstring JNICALL
192
Java_org_apache_subversion_javahl_types_VersionExtended_00024LoadedLib_getName(
193
JNIEnv *env, jobject jthis)
195
JNIEntry(VersionExtended$LoadedLib, getName);
196
const svn_version_ext_loaded_lib_t *const lib = getLoadedLib(env, jthis);
198
return env->NewStringUTF(lib->name);
202
JNIEXPORT jstring JNICALL
203
Java_org_apache_subversion_javahl_types_VersionExtended_00024LoadedLib_getVersion(
204
JNIEnv *env, jobject jthis)
206
JNIEntry(VersionExtended$LoadedLib, getVersion);
207
const svn_version_ext_loaded_lib_t *const lib = getLoadedLib(env, jthis);
209
return env->NewStringUTF(lib->version);
214
// VersionExtended.LinkedLibIterator and .LoadedLibIterator native methods
216
JNIEXPORT jboolean JNICALL
217
Java_org_apache_subversion_javahl_types_VersionExtended_00024LinkedLibIterator_hasNext(
218
JNIEnv *env, jobject jthis)
220
JNIEntry(VersionExtended$LinkedLibIterator, hasNext);
222
static volatile jfieldID fid = 0;
225
fid = env->GetFieldID(env->GetObjectClass(jthis), "index", "I");
226
if (JNIUtil::isJavaExceptionThrown())
230
const int index = env->GetIntField(jthis, fid);
231
if (JNIUtil::isJavaExceptionThrown())
234
const VersionExtended *const vx =
235
VersionExtended::getCppObjectFromLinkedLibIterator(jthis);
237
return !!vx->get_linked_lib(1 + index);
241
JNIEXPORT jboolean JNICALL
242
Java_org_apache_subversion_javahl_types_VersionExtended_00024LoadedLibIterator_hasNext(
243
JNIEnv *env, jobject jthis)
245
JNIEntry(VersionExtended$LoadedLibIterator, hasNext);
247
static volatile jfieldID fid = 0;
250
fid = env->GetFieldID(env->GetObjectClass(jthis), "index", "I");
251
if (JNIUtil::isJavaExceptionThrown())
255
const int index = env->GetIntField(jthis, fid);
256
if (JNIUtil::isJavaExceptionThrown())
259
const VersionExtended *const vx =
260
VersionExtended::getCppObjectFromLoadedLibIterator(jthis);
262
return !!vx->get_loaded_lib(1 + index);