Newer
Older
snipet / libsc / trunk / include / sc_iterator.h
  1. /* vim: ts=4 sw=4 sts=4 ff=unix fenc=utf-8 :
  2. * =====================================================================
  3. * sc_terator.h
  4. * Copyright (c) 2003 - 2011 sys0tem
  5. * LICENSE :
  6. * LGPL (GNU Lesser General Public License - Version 3,29 June 2007)
  7. * http://www.gnu.org/copyleft/lesser.html
  8. * or
  9. * EPL (Eclipse Public License - v1.0)
  10. * http://www.eclipse.org/legal/epl-v10.html
  11. * =====================================================================
  12. */
  13. #ifndef __SC_ITERATOR_H__
  14. #define __SC_ITERATOR_H__
  15.  
  16. #include <stddef.h>
  17.  
  18. #include <sc_stdbool.h>
  19.  
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23.  
  24.  
  25. typedef struct SC_Iterator_Entry_ {
  26. struct SC_Iterator_Entry_* next;
  27. const void* value;
  28. size_t size;
  29. } SC_Iterator_Entry;
  30.  
  31.  
  32. /**
  33. * Iteratorオブジェクト。
  34. */
  35. typedef struct SC_Iterator_ {
  36. bool (*hasNext)(struct SC_Iterator_* ite);
  37. const void* (*next )(struct SC_Iterator_* ite, size_t* size);
  38. const char* (*nextStr)(struct SC_Iterator_* ite);
  39. struct SC_Iterator_Entry_* _head;
  40. struct SC_Iterator_Entry_* _now;
  41. } SC_Iterator;
  42.  
  43.  
  44. SC_Iterator* SC_Iterator_new(SC_Iterator_Entry* head);
  45. void SC_Iterator_delete(SC_Iterator* ite);
  46.  
  47.  
  48. #ifdef __cplusplus
  49. }
  50. #endif
  51.  
  52. #endif /* __SC_ITERATOR_H__ */
  53.