Skip to content

Commit

Permalink
Remove redundant inline
Browse files Browse the repository at this point in the history
  • Loading branch information
yujincheng08 committed Dec 6, 2023
1 parent bd74aeb commit 4f51239
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lsplant/src/main/jni/include/utils/jni_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,28 +177,28 @@ inline auto JNI_NewStringUTF(JNIEnv *env, std::string_view sv) {

class JUTFString {
public:
inline JUTFString(JNIEnv *env, jstring jstr) : JUTFString(env, jstr, nullptr) {}
JUTFString(JNIEnv *env, jstring jstr) : JUTFString(env, jstr, nullptr) {}

inline JUTFString(const ScopedLocalRef<jstring> &jstr)
JUTFString(const ScopedLocalRef<jstring> &jstr)
: JUTFString(jstr.env_, jstr.local_ref_, nullptr) {}

inline JUTFString(JNIEnv *env, jstring jstr, const char *default_cstr)
JUTFString(JNIEnv *env, jstring jstr, const char *default_cstr)
: env_(env), jstr_(jstr) {
if (env_ && jstr_)
cstr_ = env_->GetStringUTFChars(jstr, nullptr);
else
cstr_ = default_cstr;
}

inline operator const char *() const { return cstr_; }
operator const char *() const { return cstr_; }

inline operator const std::string() const { return cstr_; }
operator const std::string() const { return cstr_; }

inline operator const bool() const { return cstr_ != nullptr; }
operator const bool() const { return cstr_ != nullptr; }

inline auto get() const { return cstr_; }
auto get() const { return cstr_; }

inline ~JUTFString() {
~JUTFString() {
if (env_ && jstr_) env_->ReleaseStringUTFChars(jstr_, cstr_);
}

Expand Down

0 comments on commit 4f51239

Please sign in to comment.