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


C++ rb_call_super函数代码示例

本文整理汇总了C++中rb_call_super函数的典型用法代码示例。如果您正苦于以下问题:C++ rb_call_super函数的具体用法?C++ rb_call_super怎么用?C++ rb_call_super使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: nst_method_missing

static VALUE
nst_method_missing(int argc, VALUE *argv, VALUE self)
{
    VALUE s, tag, obj;

    if (argc == 2) {
        s = rb_sym_to_s(argv[0]);
        if (RSTRING_PTR(s)[RSTRING_LEN(s)-1] == '=') {
            tag = rb_str_intern(rb_str_new(RSTRING_PTR(s), RSTRING_LEN(s)-1));
            obj = nst_field(self, tag);
            if (RTEST(obj)) {
                rb_funcall(obj, rb_intern("store"), 1, argv[1]);
                return argv[1];
            }
        }
        return rb_call_super(argc,argv);
    }
    if (argc == 1) {
        obj = nst_field(self,argv[0]);
        if (RTEST(obj)) {
            return obj;
        }
    }
    return rb_call_super(argc,argv);
}
开发者ID:metanest,项目名称:narray-devel,代码行数:25,代码来源:struct.c

示例2: buffered_file_read

/* Read using an internal buffer to avoid system calls */
static VALUE buffered_file_read(VALUE self, VALUE arg_length) {
  long length = FIX2INT(arg_length);
  VALUE buffer = rb_ivar_get(self, id_ivar_buffer);
  long buffer_length = RSTRING_LEN(buffer);
  long buffer_index = FIX2INT(rb_ivar_get(self, id_ivar_buffer_index));
  VALUE result = Qnil;
  VALUE super_arg = Qnil;

  if (length <= (buffer_length - buffer_index)) {
    /* Return part of the buffer without having to go to the OS */
    result = rb_str_substr(buffer, buffer_index, length);
    buffer_index += length;
    rb_ivar_set(self, id_ivar_buffer_index, INT2FIX(buffer_index));
    return result;
  } else if (length > BUFFER_SIZE) {
    /* Reading more than our buffer */
    if (buffer_length > 0) {
      if (buffer_index > 0) {
        rb_funcall(buffer, id_method_slice_bang, 1, rb_range_new(INT2FIX(0), INT2FIX(buffer_index - 1), Qfalse));
        buffer_length = RSTRING_LEN(buffer);
        buffer_index = 0;
        rb_ivar_set(self, id_ivar_buffer_index, INT2FIX(0));
      }
      super_arg = INT2FIX(length - buffer_length);
      rb_str_append(buffer, rb_funcall(rb_call_super(1, &super_arg), id_method_to_s, 0));
      return rb_funcall(buffer, id_method_slice_bang, 1, rb_const_get(cBufferedFile, id_const_ALL_RANGE));
    } else {
      return rb_call_super(1, &arg_length);
    }
  } else {
    /* Read into the buffer */
    if (buffer_index > 0) {
      rb_funcall(buffer, id_method_slice_bang, 1, rb_range_new(INT2FIX(0), INT2FIX(buffer_index - 1), Qfalse));
      buffer_length = RSTRING_LEN(buffer);
      buffer_index = 0;
      rb_ivar_set(self, id_ivar_buffer_index, INT2FIX(0));
    }
    super_arg = INT2FIX(BUFFER_SIZE - buffer_length);
    rb_str_append(buffer, rb_funcall(rb_call_super(1, &super_arg), id_method_to_s, 0));
    buffer_length = RSTRING_LEN(buffer);
    if (buffer_length <= 0) {
      return Qnil;
    }

    if (length <= buffer_length) {
      result = rb_str_substr(buffer, buffer_index, length);
      buffer_index += length;
      rb_ivar_set(self, id_ivar_buffer_index, INT2FIX(buffer_index));
      return result;
    } else {
      return rb_funcall(buffer, id_method_slice_bang, 1, rb_const_get(cBufferedFile, id_const_ALL_RANGE));
    }
  }
}
开发者ID:WEST3357,项目名称:COSMOS,代码行数:55,代码来源:buffered_file.c

示例3: _new

VALUE _new(int argc,VALUE *argv,VALUE self)
{
	VALUE name;
	if(argc==2)
		return rb_call_super(2,argv);
	else{
		rb_scan_args(argc, argv, "01",&name);
		VALUE result[2];
		result[0]=wrap(CEGUI::String(CEGUI::ClippedContainer::WidgetTypeName));
		result[1]=name;
		return rb_call_super(2,result);
	}
}
开发者ID:Hanmac,项目名称:libcegui-ruby,代码行数:13,代码来源:ceguiclippedcontainer.cpp

示例4: interface_s_append_features

static VALUE
interface_s_append_features(VALUE self, VALUE klass)
{
    if (!rb_obj_is_kind_of(klass, cInstantiatable))
        rb_raise(rb_eTypeError, "Not a subclass of GLib::Instantiatable");
    return rb_call_super(1, &klass);
}
开发者ID:geoffyoungs,项目名称:ruby-gnome2,代码行数:7,代码来源:rbgobj_typeinterface.c

示例5: _isAncestor

VALUE _isAncestor(VALUE self,VALUE val)
{
	if(rb_obj_is_kind_of(val, rb_cInteger)){
		return wrap(_self->isAncestor(NUM2ULONG(val)));
	}else
		return rb_call_super(1,&val);
}
开发者ID:Hanmac,项目名称:libcegui-ruby,代码行数:7,代码来源:ceguiwindow.cpp

示例6: frequencycounter_initialize

VALUE frequencycounter_initialize(VALUE self, VALUE serial) {
  PhidgetInfo *info = device_info(self);
  CPhidgetFrequencyCounterHandle frequencycounter = 0;
  ensure(CPhidgetFrequencyCounter_create(&frequencycounter));
  info->handle = (CPhidgetHandle)frequencycounter;
  return rb_call_super(1, &serial);
}
开发者ID:brighton36,项目名称:phidgets_native,代码行数:7,代码来源:frequencycounter_ruby.c

示例7: queue_stats_request_init

/*
 * A {QueueStatsRequest} object instance to request queue statistics.
 * Request queue statistics.
 *
 * @overload initialize(options={})
 *
 *   @example
 *     QueueStatsRequest.new(
 *       :port_no => port_no,
 *       :queue_id => queue_id
 *     )
 *
 *   @param [Hash] options
 *     the options to create a message with.
 *
 *   @option options [Number] :port_no
 *     request statistics for a specific port if specified, otherwise set port_no
 *     to +OFPP_ALL+ for all ports.
 *
 *   @option options [Number] :queue_id
 *     request statistics for a specific queue_id or set queue_id to +OFPQ_ALL+
 *     for all queues.
 *
 *   @return [QueueStatsRequest]
 *     an object that encapsulates the +OFPT_STATS_REQUEST(OFPST_QUEUE)+ OpenFlow
 *     message.
 */
static VALUE
queue_stats_request_init( int argc, VALUE *argv, VALUE self ) {
  VALUE options;
  if ( !rb_scan_args( argc, argv, "01", &options )) {
    options = rb_hash_new();
  }
  rb_call_super( 1, &options );
  VALUE port_no = rb_hash_aref( options, ID2SYM( rb_intern( "port_no" ) ) );
  if ( port_no == Qnil ) {
    port_no = UINT2NUM( OFPP_ALL );
  }
  rb_iv_set( self, "@port_no", port_no );
  VALUE queue_id = rb_hash_aref( options, ID2SYM( rb_intern( "queue_id" ) ) );
  if ( queue_id == Qnil ) {
    queue_id = UINT2NUM( OFPQ_ALL );
  }
  rb_iv_set( self, "@queue_id", queue_id );


  buffer *message;
  Data_Get_Struct( self, buffer, message );
  ( ( struct ofp_header * ) ( message->data ) )->xid = htonl( get_stats_request_num2uint( self, "@transaction_id" ) );
  struct ofp_stats_request *stats_request;
  stats_request = ( struct ofp_stats_request * ) message->data;
  stats_request->flags = htons ( get_stats_request_num2uint16( self, "@flags" ) );

  stats_request = ( struct ofp_stats_request * ) message->data;
  struct ofp_queue_stats_request *queue_stats_request;
  queue_stats_request = ( struct ofp_queue_stats_request * ) stats_request->body;
  queue_stats_request->port_no = htons( get_stats_request_num2uint16( self, "@port_no" ) );
  queue_stats_request->queue_id = htonl( get_stats_request_num2uint( self, "@queue_id" ) );
  return self;
}
开发者ID:miyakz1192,项目名称:trema,代码行数:60,代码来源:stats-request.c

示例8: textled_initialize

VALUE textled_initialize(VALUE self, VALUE serial) {
  PhidgetInfo *info = device_info(self);
  CPhidgetTextLEDHandle textled = 0;
  ensure(CPhidgetTextLED_create(&textled));
  info->handle = (CPhidgetHandle)textled;
  return rb_call_super(1, &serial);
}
开发者ID:brighton36,项目名称:phidgets_native,代码行数:7,代码来源:textled_ruby.c

示例9: stepper_initialize

VALUE stepper_initialize(VALUE self, VALUE serial) {
  PhidgetInfo *info = device_info(self);
  CPhidgetStepperHandle stepper = 0;
  ensure(CPhidgetStepper_create(&stepper));
  info->handle = (CPhidgetHandle)stepper;
  return rb_call_super(1, &serial);
}
开发者ID:brighton36,项目名称:phidgets_native,代码行数:7,代码来源:stepper_ruby.c

示例10: _initialize

/*
 * call-seq:
 *   DirDialog.new(parent, name, [options])
 *   DirDialog.new(parent, [options])
 *
 * creates a new DirDialog widget.
 * ===Arguments
 * * parent of this window or nil
 * * name is a String describing a resource in a loaded xrc
 *
 * *options: Hash with possible options to set:
 *   * path String default path
 *   * message String
 *
 *   * must_exist Style Flag does set MUST_EXIST
 *   * change_dir Style Flag does set CHANGE_DIR
 *
*/
DLL_LOCAL VALUE _initialize(int argc,VALUE *argv,VALUE self)
{
	VALUE parent,name,hash;
	rb_scan_args(argc, argv, "11:",&parent,&name,&hash);
	if(!_created && !rb_obj_is_kind_of(name,rb_cString))
	{
		wxString message(wxDirSelectorPromptStr);
		wxString path(wxEmptyString);
		int style(wxDD_DEFAULT_STYLE);

		if(rb_obj_is_kind_of(hash,rb_cHash))
		{
			set_default_values(hash,message,path,style);

			TopLevel::set_style_flags(hash,style);
			set_style_flags(hash,style);
		}

		_self->Create(unwrap<wxWindow*>(parent),message,path,style);
		
	}

	rb_call_super(argc,argv);

	if(rb_obj_is_kind_of(name, rb_cString) &&
		rb_obj_is_kind_of(hash, rb_cHash))
	{
		set_obj_option(hash, "message", &wxDirDialog::SetMessage, _self);
		set_obj_option(hash, "path", &wxDirDialog::SetPath, _self);
	}

	return self;
}
开发者ID:Hanmac,项目名称:rwx,代码行数:51,代码来源:wxDirDialog.cpp

示例11: _initialize_copy

VALUE _initialize_copy(VALUE self, VALUE other)
{
	VALUE result = rb_call_super(1,&other);
	_set_d_width(self,_get_d_width(other));
	_set_d_height(self,_get_d_height(other));
	return result;
}
开发者ID:Hanmac,项目名称:libcegui-ruby,代码行数:7,代码来源:ceguiusize.cpp

示例12: GLError_initialize

VALUE GLError_initialize(VALUE obj,VALUE message, VALUE error_id)
{
	rb_call_super(1, &message);
	rb_iv_set(obj, "@id", error_id);

	return obj;
}
开发者ID:DouglasAllen,项目名称:opengl,代码行数:7,代码来源:gl-error.c

示例13: buffered_file_pos

/* Get the current file position */
static VALUE buffered_file_pos(VALUE self) {
  VALUE parent_pos = rb_call_super(0, NULL);
  long long ll_pos = NUM2LL(parent_pos);
  long buffer_length = RSTRING_LEN(rb_ivar_get(self, id_ivar_buffer));
  long buffer_index = FIX2INT(rb_ivar_get(self, id_ivar_buffer_index));
  return LL2NUM(ll_pos - (long long)(buffer_length - buffer_index));
}
开发者ID:WEST3357,项目名称:COSMOS,代码行数:8,代码来源:buffered_file.c

示例14: ImageMagickError_initialize

/*
    Method:     ImageMagickError#initialize(msg, loc)
    Purpose:    initialize a new ImageMagickError object - store
                the "loc" string in the @magick_location instance variable
*/
VALUE
ImageMagickError_initialize(int argc, VALUE *argv, VALUE self)
{
    VALUE super_argv[1] = {(VALUE)0};
    int super_argc = 0;
    volatile VALUE extra = Qnil;

    switch(argc)
    {
        case 2:
            extra = argv[1];
        case 1:
            super_argv[0] = argv[0];
            super_argc = 1;
        case 0:
            break;
        default:
            rb_raise(rb_eArgError, "wrong number of arguments (%d for 0 to 2)", argc);
    }

    (void) rb_call_super(super_argc, (const VALUE *)super_argv);
    (void) rb_iv_set(self, "@"MAGICK_LOC, extra);


    return self;
}
开发者ID:r-project,项目名称:BS,代码行数:31,代码来源:rmutil.c

示例15: _initialize_copy

VALUE _initialize_copy(VALUE self, VALUE other)
{
	VALUE result = rb_call_super(1,&other);
	_set_d_scale(self,_get_d_scale(other));
	_set_d_offset(self,_get_d_offset(other));
	return result;
}
开发者ID:Hanmac,项目名称:libcegui-ruby,代码行数:7,代码来源:ceguiudim.cpp


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