Last active
June 18, 2018 13:13
-
-
Save LiewJunTung/5f903526d96c60e6a769f226b9dd5609 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct String | |
{ | |
using CppType = std::string; | |
using JniType = jstring; | |
using Boxed = String; | |
static CppType toCpp(JNIEnv* jniEnv, JniType j) | |
{ | |
assert(j != nullptr); | |
return jniUTF8FromString(jniEnv, j); | |
} | |
static LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c) | |
{ | |
return {jniEnv, jniStringFromUTF8(jniEnv, c)}; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment