Sha256: 03f112ec2861550b79f7250532201c38804e475271c0d417daac2395755e04b6

Contents?: true

Size: 1.48 KB

Versions: 18

Compression:

Stored size: 1.48 KB

Contents

#ifndef _RHODES_H_D9BFC7B4FD394BECAF7EC535453253CC
#define _RHODES_H_D9BFC7B4FD394BECAF7EC535453253CC

#include <jni.h>
#include <string>

JNIEnv *jnienv();

jclass rho_find_class(JNIEnv *env, const char *c);

extern "C" void *rho_nativethread_start();
extern "C" void rho_nativethread_end(void *);

std::string const &rho_root_path();
std::string const &rho_apk_path();

namespace details
{

template <typename T, typename U>
struct rho_cast_helper;

template <>
struct rho_cast_helper<std::string, jstring>
{
    std::string operator()(JNIEnv *env, jstring );
};

template <>
struct rho_cast_helper<jstring, char const *>
{
    jstring operator()(JNIEnv *env, char const *);
};

template <>
struct rho_cast_helper<jstring, char *>
{
    jstring operator()(JNIEnv *env, char *s) {return rho_cast_helper<jstring, char const *>()(env, s);}
};

template <int N>
struct rho_cast_helper<jstring, char [N]>
{
    jstring operator()(JNIEnv *env, char (&s)[N]) {return rho_cast_helper<jstring, char const *>()(env, &s[0]);}
};

template <>
struct rho_cast_helper<jstring, std::string>
{
    jstring operator()(JNIEnv *env, std::string const &s) {return rho_cast_helper<jstring, char const *>()(env, s.c_str());}
};

} // namespace details

template <typename T, typename U>
T rho_cast(JNIEnv *env, U u)
{
    return details::rho_cast_helper<T, U>()(env, u);
}

template <typename T, typename U>
T rho_cast(U u)
{
    return details::rho_cast_helper<T, U>()(jnienv(), u);
}

#endif // _RHODES_H_D9BFC7B4FD394BECAF7EC535453253CC

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
rhodes-2.2.6 platform/android/Rhodes/jni/include/rhodes.h
rhodes-2.2.6.beta.1 platform/android/Rhodes/jni/include/rhodes.h
rhodes-2.2.5 platform/android/Rhodes/jni/include/rhodes.h
rhodes-2.2.5.beta.3 platform/android/Rhodes/jni/include/rhodes.h
rhodes-2.2.5.beta.2 platform/android/Rhodes/jni/include/rhodes.h
rhodes-2.2.5.beta.1 platform/android/Rhodes/jni/include/rhodes.h
rhodes-2.2.4.beta.1 platform/android/Rhodes/jni/include/rhodes.h
rhodes-2.2.3 platform/android/Rhodes/jni/include/rhodes.h
rhodes-2.2.3.beta.1 platform/android/Rhodes/jni/include/rhodes.h
rhodes-2.2.2 platform/android/Rhodes/jni/include/rhodes.h
rhodes-2.2.2.beta.1 platform/android/Rhodes/jni/include/rhodes.h
rhodes-2.2.1 platform/android/Rhodes/jni/include/rhodes.h
rhodes-2.2.1.beta.2 platform/android/Rhodes/jni/include/rhodes.h
rhodes-2.2.1.beta.1 platform/android/Rhodes/jni/include/rhodes.h
rhodes-2.2.0 platform/android/Rhodes/jni/include/rhodes.h
rhodes-2.2.0.beta.3 platform/android/Rhodes/jni/include/rhodes.h
rhodes-2.2.0.beta.2 platform/android/Rhodes/jni/include/rhodes.h
rhodes-2.2.0.beta.1 platform/android/Rhodes/jni/include/rhodes.h