• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ RETURN_ENUMERATOR函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: env_delete_if

static VALUE
env_delete_if(VALUE ehash, SEL sel)
{
    RETURN_ENUMERATOR(ehash, 0, 0);
    env_reject_bang(ehash, 0);
    return envtbl;
}
开发者ID:Hunter-Dolan,项目名称:MacRuby,代码行数:7,代码来源:env.c


示例2: _Manager_each

VALUE _Manager_each(VALUE self)
{
	RETURN_ENUMERATOR(self,0,NULL);
	for (uint i = 0; i < _manager->getNumAnimations(); ++i)
		rb_yield(wrap(_manager->getAnimationAtIdx(i)));
	return self;
}
开发者ID:Hanmac,项目名称:libcegui-ruby,代码行数:7,代码来源:ceguianimation.cpp


示例3: rbpod_collection_each

/*
 * call-seq:
 *     each(*args) -> Enumerator
 *     each(*args) { |item| block } -> Enumerator
 *
 * Iterate over the collection, passing each item to a given block.
 * If no block was supplied, return an enumerator for the collection.
 *
 */
static VALUE rbpod_collection_each(VALUE self, VALUE argv)
{
    GList *current = NULL, *collection = TYPED_DATA_PTR(self, GList);
    VALUE klass, item, arguments;

    /* Return an enumerator if a block was not supplied. */
    RETURN_ENUMERATOR(self, 0, 0);

    /* What sort of items are we casting this data to? */
    klass = rb_funcall(self, rb_intern("type"), 0);

    /* Create a shallow copy of the passed arguments. */
    arguments = rb_ary_dup(argv);

    /* Prepend an empty element as a placeholder. */
    rb_ary_unshift(arguments, Qnil);

    /* If we were supplied a block, enumerate the entire list. */
    for (current = collection; current != NULL; current = g_list_next(current)) {
        /* TODO: Find a better workaround than this or Data_Wrap_Struct. */
        item = rb_class_new_instance_with_data(0, NULL, klass, current->data);
        rb_ary_store(arguments, 0, item);
        rb_yield_splat(arguments);
    }

    return self;
}
开发者ID:jmkeyes,项目名称:rbpod,代码行数:36,代码来源:collection.c


示例4: _each

VALUE _each(VALUE self)
{
	RETURN_ENUMERATOR(self,0,NULL);
	for (uint i = 0; i < _self->getNumAffectors(); ++i)
		rb_yield(wrap( _self->getAffectorAtIdx(i)));
	return self;
}
开发者ID:Hanmac,项目名称:libcegui-ruby,代码行数:7,代码来源:ceguianimation.cpp


示例5: enumerator_with_object

/*
 *  call-seq:
 *    e.with_object(obj) {|(*args), memo_obj| ... }
 *    e.with_object(obj)
 *
 *  Iterates the given block for each element with an arbitrary
 *  object given, and returns the initially given object.
 *
 *  If no block is given, returns an enumerator.
 *
 */
static VALUE
enumerator_with_object(VALUE obj, SEL sel, VALUE memo)
{
    RETURN_ENUMERATOR(obj, 1, &memo);
    enumerator_block_call(obj, enumerator_with_object_i, memo);
    return memo;
}
开发者ID:Sophrinix,项目名称:MacRuby,代码行数:18,代码来源:enumerator.c


示例6: _each

/*
 * call-seq:
 *   each {|element| } -> self
 *   each -> Enumerator
 * 
 * interates the child Elements
 * ===Return value
 * self
*/
VALUE _each(VALUE self)
{
	RETURN_ENUMERATOR(self,0,NULL);
	for (size_t i = 0; i < _self->getChildCount(); ++i)
		rb_yield(wrap(_self->getChildElementAtIdx(i)));
	return self;
}
开发者ID:Hanmac,项目名称:libcegui-ruby,代码行数:16,代码来源:ceguielement.cpp


示例7: rb_RPRuby_Sender_Kernel_each_backtrace_frame

/*
 * call-seq:
 *   Kernel.each_backtrace_frame( & block )
 *
 * Return array of hashes with object and method frame information for backtrace.
 * Specifying number_of_frames will cause only the last number_of_frames to be returned.
 * Kernel.backtrace returns all frames including the current context (__method__/__callee__).
 */
VALUE rb_RPRuby_Sender_Kernel_each_backtrace_frame(	int		argc,
													VALUE*	args,
													VALUE	rb_self )	{

	rb_thread_t*			c_thread					= GET_THREAD();
	//	Get the current frame - we're doing a backtrace, so our current working frame to start is the first previous thread
	rb_control_frame_t*		c_current_context_frame		= RUBY_VM_PREVIOUS_CONTROL_FRAME( RUBY_VM_PREVIOUS_CONTROL_FRAME( c_thread->cfp ) );
	
	//	c_top_of_control_frame describes the top edge of the stack trace
	//	set c_top_of_control_frame to the first frame in <main>
    rb_control_frame_t*		c_top_of_control_frame	=	RUBY_VM_NEXT_CONTROL_FRAME( RUBY_VM_NEXT_CONTROL_FRAME( (void *)( c_thread->stack + c_thread->stack_size ) ) );
	
	VALUE	rb_stored_backtrace_array	=	Qnil;
	
	//	if we were passed a stored backtrace array, use it
	if (	argc == 1
		&&	TYPE( args[ 0 ] ) == T_ARRAY )	{
		rb_stored_backtrace_array	=	args[ 0 ];
	}
				
	//	for each control frame:
    while ( c_current_context_frame < c_top_of_control_frame ) {

		VALUE	rb_frame_hash;
		//	if we are using a stored backtrace we don't need to ask for a new hash
		if ( rb_stored_backtrace_array == Qnil )	{
			rb_frame_hash	=	rb_RPRuby_Sender_Kernel_internal_backtraceHashForControlFrame(	& c_current_context_frame );
		}
		else {
			rb_frame_hash	=	rb_ary_shift( rb_stored_backtrace_array );
		}

		if ( rb_frame_hash == Qnil )	{
			break;
		}
		
		//	if we try to iterate using an Enumerator we will lose our context
		if ( ! rb_block_given_p() )	{
			
			//	we solve this by assuming that the desired context is the moment when each_backtrace_frame is called
			//	this allows us to store the backtrace and iterate it as we want
			//	the only downside is that we have to get the entire backtrace first in order to store it
			rb_stored_backtrace_array	=	rb_RPRuby_Sender_Kernel_backtrace(	0,
																				NULL,
																				rb_self );
		
			RETURN_ENUMERATOR( rb_self, 1, & rb_stored_backtrace_array );
		}
		
		//	otherwise, yield the block
		rb_yield( rb_frame_hash );
		
		//	only move the frame if we are not using a stored backtrace
		if ( rb_stored_backtrace_array == Qnil )	{
			c_current_context_frame = RUBY_VM_PREVIOUS_CONTROL_FRAME( c_current_context_frame );		
		}
	}
	
	return Qnil;
}
开发者ID:stephenprater,项目名称:sender,代码行数:68,代码来源:rb_Kernel.c


示例8: etc_each_group

/* call-seq:
 *	Etc::Group.each { |group| block }   ->	obj
 *	Etc::Group.each			    ->	Enumerator
 *
 * Iterates for each entry in the /etc/group file if a block is given.
 *
 * If no block is given, returns the Enumerator.
 *
 * The code block is passed a Group struct.
 *
 * Example:
 *
 *     require 'etc'
 *
 *     Etc::Group.each {|g|
 *       puts g.name + ": " + g.mem.join(', ')
 *     }
 *
 *     Etc::Group.collect {|g| g.name}
 *     Etc::Group.select {|g| !g.mem.empty?}
 *
 */
static VALUE
etc_each_group(VALUE obj)
{
    RETURN_ENUMERATOR(obj, 0, 0);
    each_group();
    return obj;
}
开发者ID:Shopify,项目名称:ruby,代码行数:29,代码来源:etc.c


示例9: rb_set_each

static VALUE
rb_set_each(VALUE set, SEL sel)
{
    RETURN_ENUMERATOR(set, 0, 0);
    CFSetApplyFunction((CFMutableSetRef)set, rb_set_each_callback, NULL);
    return Qnil;
}
开发者ID:alloy,项目名称:mr-experimental,代码行数:7,代码来源:set.c


示例10: rb_grn_database_each

/*
 * データベース内のオブジェクトを順番にブロックに渡す。
 *
 * @example すべてのオブジェクトの名前を表示する:
 *   database.each do |object|
 *     p object.name
 *   end
 *
 * @example すべてのオブジェクトの名前をID順で表示する:
 *   database.each(:order_by => :id) do |object|
 *     p object.name
 *   end
 *
 * @example すべてのオブジェクトの名前をキー名の降順で表示する:
 *   database.each(:order_by => :key, :order => :desc) do |object|
 *     p object.name
 *   end
 *
 * @overload each(options=nil)
 *   @macro [new] database.each.options
 *     @param options [::Hash]
 *     @yield [object]
 *     @option options :order
 *       +:asc+ または +:ascending+ を指定すると昇順にレコードを取
 *       り出す。(デフォルト)
 *       +:desc+ または +:descending+ を指定すると降順にレコードを
 *       取り出す。
 *     @option options :order_by (:key)
 *       +:id+ を指定するとID順にレコードを取り出す。
 *       +:key+ 指定するとキー順にレコードを取り出す。(デフォル
 *       ト)
 *   @macro database.each.options
 *
 * @overload each(options=nil)
 *   @macro database.each.options
 *   @option options :ignore_missing_object (false)
 *     Specify +true+ to ignore missing object. Otherwise, an exception is
 *     raised for missing object.
 *
 *   @since 2.0.5
 */
static VALUE
rb_grn_database_each (int argc, VALUE *argv, VALUE self)
{
    grn_ctx *context = NULL;
    grn_obj *database;
    grn_table_cursor *cursor;
    VALUE rb_cursor, rb_options, rb_order, rb_order_by;
    VALUE rb_ignore_missing_object;
    int flags = 0;
    grn_id id;
    VALUE exception;

    RETURN_ENUMERATOR(self, argc, argv);

    rb_grn_database_deconstruct(SELF(self), &database, &context,
                                NULL, NULL, NULL, NULL);

    rb_scan_args(argc, argv, "01", &rb_options);

    rb_grn_scan_options(rb_options,
                        "order", &rb_order,
                        "order_by", &rb_order_by,
                        "ignore_missing_object", &rb_ignore_missing_object,
                        NULL);

    flags |= rb_grn_table_cursor_order_to_flag(rb_order);
    flags |= rb_grn_table_cursor_order_by_to_flag(GRN_TABLE_PAT_KEY,
                                                  self,
                                                  rb_order_by);

    cursor = grn_table_cursor_open(context, database, NULL, 0, NULL, 0,
                                   0, -1,
                                   flags);
    rb_cursor = GRNTABLECURSOR2RVAL(Qnil, context, cursor);
    rb_iv_set(self, "cursor", rb_cursor);
    while ((id = grn_table_cursor_next(context, cursor)) != GRN_ID_NIL) {
        grn_obj *object;

        object = grn_ctx_at(context, id);
        if (!object && RTEST(rb_ignore_missing_object)) {
            context->rc = GRN_SUCCESS;
            continue;
        }

        exception = rb_grn_context_to_exception(context, self);
        if (!NIL_P(exception)) {
            rb_grn_object_close(rb_cursor);
            rb_iv_set(self, "cursor", Qnil);
            rb_exc_raise(exception);
        }

        if (object) {
            rb_yield(GRNOBJECT2RVAL(Qnil, context, object, GRN_FALSE));
        }
    }
    rb_grn_object_close(rb_cursor);
    rb_iv_set(self, "cursor", Qnil);

    return Qnil;
//.........这里部分代码省略.........
开发者ID:genki,项目名称:rroonga,代码行数:101,代码来源:rb-grn-database.c


示例11: _Manager_each

VALUE _Manager_each(VALUE self)
{
	RETURN_ENUMERATOR(self,0,NULL);
	//check if system is created
	wrap< CEGUI::System* >(self);
	wrap_each(_manager->getIterator());
	return self;
}
开发者ID:Hanmac,项目名称:libcegui-ruby,代码行数:8,代码来源:ceguiwindow.cpp


示例12: _each_child

VALUE _each_child(VALUE self)
{
    RETURN_ENUMERATOR(self,0,NULL);
    size_t count = _self->GetChildCount();
    for(size_t i = 0; i < count; ++i)
        rb_yield(wrap(_self->Item(i)));
    return self;
}
开发者ID:ileitch,项目名称:rwx,代码行数:8,代码来源:wxProperty.cpp


示例13: _Manager_each_falagard

VALUE _Manager_each_falagard(VALUE self)
{
	RETURN_ENUMERATOR(self,0,NULL);
	//check if system is created
	wrap< CEGUI::System* >(self);
	wrap_each(_factorymanager->getFalagardMappingIterator());
	return self;
}
开发者ID:Hanmac,项目名称:libcegui-ruby,代码行数:8,代码来源:ceguiwindow.cpp


示例14: rhash_each_pair

static VALUE
rhash_each_pair(VALUE hash, SEL sel)
{
    RETURN_ENUMERATOR(hash, 0, 0);
    rhash_foreach(hash, each_pair_i, 0);
    RETURN_IF_BROKEN();
    return hash;
}
开发者ID:Jaharmi,项目名称:MacRuby,代码行数:8,代码来源:hash.c


示例15: rhash_keep_if

VALUE
rhash_keep_if(VALUE hash, SEL sel)
{
    RETURN_ENUMERATOR(hash, 0, 0);
    rhash_modify(hash);
    rhash_foreach(hash, keep_if_i, hash);
    return hash;
}
开发者ID:Jaharmi,项目名称:MacRuby,代码行数:8,代码来源:hash.c


示例16: rhash_reject_bang

static VALUE
rhash_reject_bang(VALUE hash, SEL sel)
{
    RETURN_ENUMERATOR(hash, 0, 0);
    const long n = rhash_len(hash);
    rhash_delete_if(hash, 0);
    return n == rhash_len(hash) ? Qnil : hash;
}
开发者ID:Jaharmi,项目名称:MacRuby,代码行数:8,代码来源:hash.c


示例17: _each

VALUE _each(VALUE self)
{
	RETURN_ENUMERATOR(self,0,NULL);
	for (unsigned int i = 0; i < _self->getNumPoints(); ++i)
	{
		rb_yield(wrap(_self->getPoint(i)));
	}
	return self;
}
开发者ID:Hanmac,项目名称:libogre-ruby,代码行数:9,代码来源:ogrerotationalspline.cpp


示例18: etc_each_passwd

/* call-seq:
 *	Etc::Passwd.each { |struct| block }	->  Passwd
 *	Etc::Passwd.each			->  Enumerator
 *
 * Iterates for each entry in the /etc/passwd file if a block is given.
 *
 * If no block is given, returns the Enumerator.
 *
 * The code block is passed an Passwd struct.
 *
 * See ::getpwent above for details.
 *
 * Example:
 *
 *     require 'etc'
 *
 *     Etc::Passwd.each {|u|
 *       puts u.name + " = " + u.gecos
 *     }
 *
 *     Etc::Passwd.collect {|u| u.gecos}
 *     Etc::Passwd.collect {|u| u.gecos}
 *
 */
static VALUE
etc_each_passwd(VALUE obj)
{
#ifdef HAVE_GETPWENT
    RETURN_ENUMERATOR(obj, 0, 0);
    each_passwd();
#endif
    return obj;
}
开发者ID:Shopify,项目名称:ruby,代码行数:33,代码来源:etc.c


示例19: _each_item

VALUE _each_item(VALUE self)
{
	RETURN_ENUMERATOR(self,0,NULL);
	for (unsigned int i = 0; i < _self->getItemCount(); ++i)
	{
		rb_yield(wrap(_self->getListboxItemFromIndex(i)));
	}
	return self;
}
开发者ID:Hanmac,项目名称:libcegui-ruby,代码行数:9,代码来源:ceguicombobox.cpp


示例20: rhash_select

static VALUE
rhash_select(VALUE hash, SEL sel)
{
    RETURN_ENUMERATOR(hash, 0, 0);
    VALUE result = rb_hash_new();
    rhash_foreach(hash, select_i, result);
    RETURN_IF_BROKEN();
    return result;
}
开发者ID:Jaharmi,项目名称:MacRuby,代码行数:9,代码来源:hash.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ RETURN_ERROR1函数代码示例发布时间:2022-05-30
下一篇:
C++ RETURN_CTORW函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap