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


C++ NativeMethodEnvironment::get_object方法代码示例

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


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

示例1: rb_string_value

    VALUE rb_string_value(volatile VALUE* object_variable) {
        NativeMethodEnvironment* env = NativeMethodEnvironment::get();

        if(!kind_of<String>(env->get_object(*object_variable))) {
            *object_variable = rb_str_to_str(*object_variable);
        }

        return *object_variable;
    }
开发者ID:,项目名称:,代码行数:9,代码来源:

示例2: rb_io_check_closed

  void rb_io_check_closed(rb_io_t* iot) {
    VALUE io_handle = iot->handle;
    NativeMethodEnvironment* env = NativeMethodEnvironment::get();
    IO* io = c_as<IO>(env->get_object(io_handle));

    if(io->descriptor()->to_native() == -1) {
      rb_raise(rb_eIOError, "closed stream");
    }
  }
开发者ID:Erreon,项目名称:rubinius,代码行数:9,代码来源:io.cpp

示例3: rb_ary_unshift

  VALUE rb_ary_unshift(VALUE self, VALUE object) {
    NativeMethodEnvironment* env = NativeMethodEnvironment::get();

    Array* array = capi_get_array(env, self);
    array->unshift(env->state(), env->get_object(object));
    capi_update_array(env, self);

    return self;
  }
开发者ID:Energy0124,项目名称:rubinius,代码行数:9,代码来源:array.cpp

示例4: rb_ary_unshift

  VALUE rb_ary_unshift(VALUE self_handle, VALUE object_handle) {
    NativeMethodEnvironment* env = NativeMethodEnvironment::get();

    Array* self = capi_get_array(env, self_handle);
    self->unshift(env->state(), env->get_object(object_handle));
    capi_update_array(env, self_handle);

    return self_handle;
  }
开发者ID:mutle,项目名称:rubinius,代码行数:9,代码来源:array.cpp

示例5: rb_io_check_writable

 void rb_io_check_writable(rb_io_t* iot) {
   VALUE io_handle = iot->handle;
   NativeMethodEnvironment* env = NativeMethodEnvironment::get();
   IO* io = c_as<IO>(env->get_object(io_handle));
   int io_mode = io->mode()->to_native() & O_ACCMODE;
   if(!(O_WRONLY == io_mode || O_RDWR == io_mode)) {
     rb_raise(rb_eIOError, "not opened for writing");
   }
 }
开发者ID:Azzurrio,项目名称:rubinius,代码行数:9,代码来源:io.cpp

示例6: rb_ivar_defined

  VALUE rb_ivar_defined(VALUE obj_handle, ID ivar_name) {
    NativeMethodEnvironment* env = NativeMethodEnvironment::get();

    Symbol* ivar = reinterpret_cast<Symbol*>(ivar_name);
    Object* obj = env->get_object(obj_handle);
    Object* ret = obj->ivar_defined(env->state(), ivar);

    return env->get_handle(ret);
  }
开发者ID:DanielVartanov,项目名称:rubinius,代码行数:9,代码来源:object.cpp

示例7: rb_string_value_ptr

    char* rb_string_value_ptr(volatile VALUE* object_variable) {
        NativeMethodEnvironment* env = NativeMethodEnvironment::get();

        VALUE str = rb_string_value(object_variable);
        // Type check.
        (void)c_as<String>(env->get_object(str));

        return RSTRING_PTR(str);
    }
开发者ID:,项目名称:,代码行数:9,代码来源:

示例8: rb_io_check_readable

  void rb_io_check_readable(rb_io_t* iot) {
    VALUE io_handle = iot->handle;
    NativeMethodEnvironment* env = NativeMethodEnvironment::get();
    IO* io = c_as<IO>(env->get_object(io_handle));

    if ((io->mode()->to_native() & O_ACCMODE) != O_RDONLY) {
      rb_raise(rb_eIOError, "not opened for reading");
    }
  }
开发者ID:aemoncannon,项目名称:rubinius,代码行数:9,代码来源:io.cpp

示例9: capi_define_method

  void capi_define_method(const char* file, VALUE target,
      const char* name, CApiGenericFunction fptr, int arity, CApiMethodKind kind) {
    NativeMethodEnvironment* env = NativeMethodEnvironment::get();

    VM* state = env->state();
    Symbol* method_name = state->symbol(name);

    Module* module = NULL;

    if (kind == cCApiSingletonMethod) {
      module = c_as<Module>(env->get_object(target)->metaclass(env->state()));
    }
    else {
      module = c_as<Module>(env->get_object(target));
    }

    NativeMethod* method = NULL;
    method = NativeMethod::create(state,
                                  String::create(state, file),
                                  module,
                                  method_name,
                                  fptr,
                                  Fixnum::from(arity));

    MethodVisibility* visibility = MethodVisibility::create(state);
    visibility->method(state, method);

    switch(kind) {
    case cCApiPrivateMethod:
      visibility->visibility(state, state->symbol("private"));
      break;

    case cCApiProtectedMethod:
      visibility->visibility(state, state->symbol("protected"));
      break;

    default:  /* Also catches singletons for now. @todo Verify OK. --rue */
      visibility->visibility(state, state->symbol("public"));
      break;
    }

    module->method_table()->store(state, method_name, visibility);
    state->global_cache->clear(module, method_name);
  }
开发者ID:,项目名称:,代码行数:44,代码来源:

示例10: rb_file_path_value

  VALUE rb_file_path_value(volatile VALUE* obj) {
    NativeMethodEnvironment* env = NativeMethodEnvironment::get();
    STATE = env->state();

    if(!kind_of<String>(env->get_object(*obj))) {
      *obj = rb_funcall(env->get_handle(G(type)), rb_intern("coerce_to_path"), 1, *obj);
    }

    return *obj;
  }
开发者ID:Azzurrio,项目名称:rubinius,代码行数:10,代码来源:file.cpp

示例11: rb_call_super

  VALUE rb_call_super(int argc, const VALUE *argv) {
    NativeMethodEnvironment* env = NativeMethodEnvironment::get();

    Object** args = reinterpret_cast<Object**>(alloca(sizeof(Object*) * argc));
    for(int i = 0; i < argc; i++) {
      args[i] = env->get_object(argv[i]);
    }

    return capi_call_super_native(env, argc, args);
  }
开发者ID:MarkusQ,项目名称:rubinius,代码行数:10,代码来源:capi.cpp

示例12: rb_big_sign

  int rb_big_sign(VALUE obj) {
    NativeMethodEnvironment* env = NativeMethodEnvironment::get();

    Bignum* big = c_as<Bignum>(env->get_object(obj));

    if (big->mp_val()->sign == MP_NEG) {
      return -1;
    }
    return 1;
  }
开发者ID:,项目名称:,代码行数:10,代码来源:

示例13: rb_enc_get_index

  int rb_enc_get_index(VALUE obj) {
    NativeMethodEnvironment* env = NativeMethodEnvironment::get();

    Object* val = env->get_object(obj);
    Encoding* enc = Encoding::get_object_encoding(env->state(), val);

    if(enc->nil_p()) return 0;

    return Encoding::find_index(env->state(), enc->get_encoding()->name);
  }
开发者ID:fakeleft,项目名称:rubinius,代码行数:10,代码来源:encoding.cpp

示例14: rb_enc_get

  rb_encoding* rb_enc_get(VALUE obj) {
    NativeMethodEnvironment* env = NativeMethodEnvironment::get();

    Object* val = env->get_object(obj);
    if(!val->reference_p() && !val->symbol_p()) return 0;
    Encoding* enc = Encoding::get_object_encoding(env->state(), val);

    if(enc->nil_p()) return 0;
    return enc->get_encoding();
  }
开发者ID:Emily,项目名称:rubinius,代码行数:10,代码来源:encoding.cpp

示例15: rb_call_super

  VALUE rb_call_super(int argc, const VALUE *argv) {
    NativeMethodEnvironment* env = NativeMethodEnvironment::get();

    Object* args[argc];
    for(int i = 0; i < argc; i++) {
      args[i] = env->get_object(argv[i]);
    }

    return capi_call_super_native(env, argc, args);
  }
开发者ID:cutorad,项目名称:rubinius,代码行数:10,代码来源:capi.cpp


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