1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-04 02:09:35 +02:00

native code simplification (introduced JString class)

This commit is contained in:
Nikolay Pultsin 2014-04-07 21:02:52 +01:00
parent 48cdfee8a2
commit fdb21b67dc
4 changed files with 71 additions and 83 deletions

View file

@ -44,6 +44,22 @@ class ZLFile;
class FileEncryptionInfo;
class ZLFileImage;
class JString {
public:
JString(JNIEnv* env, const std::string &str, bool emptyIsNull = true);
jstring j();
~JString();
private:
JNIEnv *myEnv;
jstring myJ;
private:
JString(const JString&);
const JString& operator = (const JString&);
};
class AndroidUtil {
private:
@ -155,7 +171,6 @@ public:
static JNIEnv *getEnv();
static std::string fromJavaString(JNIEnv *env, jstring from);
static jstring createJavaString(JNIEnv* env, shared_ptr<std::string>);
static jstring createJavaString(JNIEnv* env, const std::string &str);
static std::string convertNonUtfString(const std::string &str);
@ -171,4 +186,6 @@ public:
//static void throwBookReadingException(const std::string &resourceId, const ZLFile &file);
};
inline jstring JString::j() { return myJ; }
#endif /* __ANDROIDUTIL_H__ */