/* vim: ts=4 sw=4 sts=4 ff=unix fenc=utf-8 :
 * =====================================================================
 *  sc_terator.h
 *  Copyright (c)  2003 - 2011  sys0tem
 *  LICENSE :
 *	LGPL (GNU Lesser General Public License - Version 3,29 June 2007)
 *	http://www.gnu.org/copyleft/lesser.html
 *	or
 *	EPL (Eclipse Public License - v1.0)
 *	http://www.eclipse.org/legal/epl-v10.html
 * =====================================================================
 */
#ifndef __SC_ITERATOR_H__
#define __SC_ITERATOR_H__

#include <stddef.h>

#include <sc_stdbool.h>

#ifdef __cplusplus
extern "C" {
#endif


typedef struct SC_Iterator_Entry_ {
	struct SC_Iterator_Entry_* next;
	const void*  value;
	size_t size;
} SC_Iterator_Entry;


/**
 * Iteratorオブジェクト。
 */
typedef struct SC_Iterator_ {
	bool        (*hasNext)(struct SC_Iterator_* ite);
	const void* (*next   )(struct SC_Iterator_* ite, size_t* size);
	const char* (*nextStr)(struct SC_Iterator_* ite);
	struct SC_Iterator_Entry_* _head;
	struct SC_Iterator_Entry_* _now;
} SC_Iterator;


SC_Iterator* SC_Iterator_new(SC_Iterator_Entry* head);
void         SC_Iterator_delete(SC_Iterator* ite);


#ifdef __cplusplus
}
#endif

#endif	/* __SC_ITERATOR_H__ */

