当前位置: 首页>>代码示例>>C++>>正文


C++ JNIEnv::CallCharMethodA方法代码示例

本文整理汇总了C++中JNIEnv::CallCharMethodA方法的典型用法代码示例。如果您正苦于以下问题:C++ JNIEnv::CallCharMethodA方法的具体用法?C++ JNIEnv::CallCharMethodA怎么用?C++ JNIEnv::CallCharMethodA使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JNIEnv的用法示例。


在下文中一共展示了JNIEnv::CallCharMethodA方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CallMember

   value CallMember(jobject inObject, value inArgs)
   {
      JNIEnv *env = GetEnv();

      jvalue jargs[MAX];
      if (!HaxeToJNIArgs(env,inArgs,jargs))
      {
         CleanStringArgs();
         ELOG("CallMember - bad argument list");
         return alloc_null();
      }
      value result = 0;

      switch(mReturn)
      {
         case jniVoid:
            result = alloc_null();
            env->CallVoidMethodA(inObject, mMethod, jargs);
            break;
         case jniObject:
            result = JObjectToHaxe(env->CallObjectMethodA(inObject,mMethod, jargs));
            break;
         case jniObjectString:
            result = JStringToHaxe(env,env->CallObjectMethodA(inObject, mMethod, jargs));
            break;
         case jniObjectArray:
            result = JArrayToHaxe(env->CallObjectMethodA(inObject, mMethod, jargs));
            break;
         case jniBoolean:
            result = alloc_bool(env->CallBooleanMethodA(inObject, mMethod, jargs));
            break;
         case jniByte:
            result = alloc_int(env->CallByteMethodA(inObject, mMethod, jargs));
            break;
         case jniChar:
            result = alloc_int(env->CallCharMethodA(inObject, mMethod, jargs));
            break;
         case jniShort:
            result = alloc_int(env->CallShortMethodA(inObject, mMethod, jargs));
            break;
         case jniInt:
            result = alloc_int(env->CallIntMethodA(mClass, mMethod, jargs));
            break;
         case jniLong:
            result = alloc_int(env->CallLongMethodA(inObject, mMethod, jargs));
            break;
         case jniFloat:
            result = alloc_float(env->CallFloatMethodA(inObject, mMethod, jargs));
            break;
         case jniDouble:
            result = alloc_float(env->CallDoubleMethodA(inObject, mMethod, jargs));
            break;
      }

      CleanStringArgs();
      return result;
   }
开发者ID:deltaluca,项目名称:Haxe-NME--fork-,代码行数:57,代码来源:JNI.cpp

示例2: _call_method


//.........这里部分代码省略.........


    case ARG_TYPE_VOID: {
        if (method->_static) {
            env->CallStaticVoidMethodA(_class,method->method,argv);
        } else {
            env->CallVoidMethodA(p_instance->instance,method->method,argv);
        }
        ret=Variant();

    }
    break;
    case ARG_TYPE_BOOLEAN: {
        if (method->_static) {
            ret=env->CallStaticBooleanMethodA(_class,method->method,argv);
        } else {
            ret=env->CallBooleanMethodA(p_instance->instance,method->method,argv);
        }
    }
    break;
    case ARG_TYPE_BYTE: {
        if (method->_static) {
            ret=env->CallStaticByteMethodA(_class,method->method,argv);
        } else {
            ret=env->CallByteMethodA(p_instance->instance,method->method,argv);
        }
    }
    break;
    case ARG_TYPE_CHAR: {

        if (method->_static) {
            ret=env->CallStaticCharMethodA(_class,method->method,argv);
        } else {
            ret=env->CallCharMethodA(p_instance->instance,method->method,argv);
        }
    }
    break;
    case ARG_TYPE_SHORT: {

        if (method->_static) {
            ret=env->CallStaticShortMethodA(_class,method->method,argv);
        } else {
            ret=env->CallShortMethodA(p_instance->instance,method->method,argv);
        }

    }
    break;
    case ARG_TYPE_INT: {

        if (method->_static) {
            ret=env->CallStaticIntMethodA(_class,method->method,argv);
        } else {
            ret=env->CallIntMethodA(p_instance->instance,method->method,argv);
        }

    }
    break;
    case ARG_TYPE_LONG: {

        if (method->_static) {
            ret=env->CallStaticLongMethodA(_class,method->method,argv);
        } else {
            ret=env->CallLongMethodA(p_instance->instance,method->method,argv);
        }

    }
开发者ID:James-Z,项目名称:godot,代码行数:67,代码来源:java_class_wrapper.cpp

示例3: methodSig


//.........这里部分代码省略.........
          retval.b = env->CallByteMethodA(javaObject, mid, java_params);
          break;

        case nsXPTType::T_I16:
        case nsXPTType::T_U8:
          retval.s = env->CallShortMethodA(javaObject, mid, java_params);
          break;

        case nsXPTType::T_I32:
        case nsXPTType::T_U16:
          retval.i = env->CallIntMethodA(javaObject, mid, java_params);
          break;

        case nsXPTType::T_I64:
        case nsXPTType::T_U32:
          retval.j = env->CallLongMethodA(javaObject, mid, java_params);
          break;

        case nsXPTType::T_FLOAT:
          retval.f = env->CallFloatMethodA(javaObject, mid, java_params);
          break;

        case nsXPTType::T_U64:
        case nsXPTType::T_DOUBLE:
          retval.d = env->CallDoubleMethodA(javaObject, mid, java_params);
          break;

        case nsXPTType::T_BOOL:
          retval.z = env->CallBooleanMethodA(javaObject, mid, java_params);
          break;

        case nsXPTType::T_CHAR:
        case nsXPTType::T_WCHAR:
          retval.c = env->CallCharMethodA(javaObject, mid, java_params);
          break;

        case nsXPTType::T_CHAR_STR:
        case nsXPTType::T_WCHAR_STR:
        case nsXPTType::T_IID:
        case nsXPTType::T_ASTRING:
        case nsXPTType::T_DOMSTRING:
        case nsXPTType::T_UTF8STRING:
        case nsXPTType::T_CSTRING:
        case nsXPTType::T_INTERFACE:
        case nsXPTType::T_INTERFACE_IS:
          retval.l = env->CallObjectMethodA(javaObject, mid, java_params);
          break;

        case nsXPTType::T_VOID:
          retval.j = env->CallLongMethodA(javaObject, mid, java_params);
          break;

        default:
          NS_WARNING("Unhandled retval type");
          break;
      }
    }

    // Check for exception from called Java function
    jthrowable exp = env->ExceptionOccurred();
    if (exp) {
      // If the exception is an instance of XPCOMException, then get the
      // nsresult from the exception instance.  Else, default to
      // NS_ERROR_FAILURE.
      if (env->IsInstanceOf(exp, xpcomExceptionClass)) {
        jfieldID fid;
开发者ID:bringhurst,项目名称:vbox,代码行数:67,代码来源:nsJavaXPTCStub.cpp


注:本文中的JNIEnv::CallCharMethodA方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。