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

Last change on this file since 1723 was 1722, checked in by braffert, 12 years ago

Added java bindings

File size: 553 bytes
Line 
1#include "jRpUnits.h"
2#include "rappture.h"
3
4JNIEXPORT jstring JNICALL Java_rappture_Units_jRpUnitsConvert
5  (JNIEnv *env, jclass cls, jstring javaFromVal, jstring javaTo, jboolean units){
6  const char* nativeFromVal = env->GetStringUTFChars(javaFromVal, 0);
7  const char* nativeTo = env->GetStringUTFChars(javaTo, 0);
8  std::string retStr = RpUnits::convert(nativeFromVal, nativeTo, (int)units);
9  env->ReleaseStringUTFChars(javaFromVal, nativeFromVal);
10  env->ReleaseStringUTFChars(javaTo, nativeTo);
11  return (env->NewStringUTF(retStr.c_str()));
12}
13
Note: See TracBrowser for help on using the repository browser.