source: trunk/lang/java/jRpUnits.cc @ 1727

Last change on this file since 1727 was 1727, checked in by braffert, 11 years ago

Last fix for building java bindings. Also added license info and more comments.

File size: 1.1 KB
Line 
1/*
2 * ======================================================================
3 *  AUTHOR:  Ben Rafferty, Purdue University
4 *  Copyright (c) 2010  Purdue Research Foundation
5 *
6 *  See the file "license.terms" for information on usage and
7 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
8 * ======================================================================
9 */
10
11/*
12 * This file defines the native functions which are called by the java Units
13 * class methods, and in turn call the corresponding rappture RpUnits methods.
14 */
15
16#include "jRpUnits.h"
17#include "rappture.h"
18
19// convert
20JNIEXPORT jstring JNICALL Java_rappture_Units_jRpUnitsConvert
21  (JNIEnv *env, jclass cls, jstring javaFromVal, jstring javaTo, jboolean units){
22  const char* nativeFromVal = env->GetStringUTFChars(javaFromVal, 0);
23  const char* nativeTo = env->GetStringUTFChars(javaTo, 0);
24  std::string retStr = RpUnits::convert(nativeFromVal, nativeTo, (int)units);
25  env->ReleaseStringUTFChars(javaFromVal, nativeFromVal);
26  env->ReleaseStringUTFChars(javaTo, nativeTo);
27  return (env->NewStringUTF(retStr.c_str()));
28}
29
Note: See TracBrowser for help on using the repository browser.