本文整理汇总了C++中JLocalEnv::CallVoidMethod方法的典型用法代码示例。如果您正苦于以下问题:C++ JLocalEnv::CallVoidMethod方法的具体用法?C++ JLocalEnv::CallVoidMethod怎么用?C++ JLocalEnv::CallVoidMethod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JLocalEnv
的用法示例。
在下文中一共展示了JLocalEnv::CallVoidMethod方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getCachedMethodID
extern "C" void
rb_str_modify(VALUE str)
{
JLocalEnv env;
jmethodID mid = getCachedMethodID(env, RubyString_class, "modify", "()V");
env->CallVoidMethod(valueToObject(env, str), mid);
checkExceptions(env);
}
示例2: getMethodID
extern "C" void
rb_define_const(VALUE module, const char* name, VALUE obj)
{
JLocalEnv env;
jmethodID mid = getMethodID(env, RubyModule_class, "defineConstant",
"(Ljava/lang/String;Lorg/jruby/runtime/builtin/IRubyObject;)V");
env->CallVoidMethod(valueToObject(env, module), mid, env->NewStringUTF(name), valueToObject(env, obj));
checkExceptions(env);
}
示例3: getCachedMethodID
extern "C" void
rb_define_alias(VALUE klass, const char* new_name, const char* old_name)
{
JLocalEnv env;
jmethodID mid = getCachedMethodID(env, RubyModule_class, "defineAlias",
"(Ljava/lang/String;Ljava/lang/String;)V");
env->CallVoidMethod(valueToObject(env, klass), mid, env->NewStringUTF(new_name),
env->NewStringUTF(old_name));
checkExceptions(env);
}
示例4: checkExceptions
extern "C" VALUE
rb_str_resize(VALUE str, long size) {
long length = (long) jruby_str_length(str);
if (size != length) {
JLocalEnv env;
env->CallVoidMethod(valueToObject(env, str), RubyString_resize_method, (jint)size);
checkExceptions(env);
jruby_rstring(str)->len = size;
}
return str;
}
示例5: VALUE
extern "C" void
rb_define_alloc_func(VALUE klass, VALUE (*fn)(VALUE))
{
JLocalEnv env;
jobject allocator = env->NewObject(NativeObjectAllocator_class,
getMethodID(env, NativeObjectAllocator_class, "<init>", "(J)V"),
p2j((void *) fn));
checkExceptions(env);
env->CallVoidMethod(valueToObject(env, klass), RubyClass_setAllocator_method, allocator);
}
示例6: VALUE
extern "C" void
rb_define_method(VALUE klass, const char* meth, VALUE(*fn)(ANYARGS), int arity)
{
JLocalEnv env;
jmethodID JRuby_newMethod = getStaticMethodID(env, JRuby_class, "newMethod", "(Lorg/jruby/RubyModule;JI)Lorg/jruby/internal/runtime/methods/DynamicMethod;");
jmethodID RubyModule_addMethod_method = getMethodID(env, RubyModule_class, "addMethod",
"(Ljava/lang/String;Lorg/jruby/internal/runtime/methods/DynamicMethod;)V");
jobject module = valueToObject(env, klass);
env->CallVoidMethod(module, RubyModule_addMethod_method, env->NewStringUTF(meth),
env->CallStaticObjectMethod(JRuby_class, JRuby_newMethod, module, (jlong)(intptr_t) fn, arity));
checkExceptions(env);
}