Newer
Older
libkc / modules / include / kc_iterator.h
Nomura Kei on 22 May 2024 1 KB update list
  1. /**
  2. * @file kc_iterator.h
  3. * @brief KC Iterator モジュール
  4. * @copyright 2003 - 2023 Nomura Kei
  5. * @depends
  6. * kc.h
  7. */
  8. #ifndef KC_ITERATOR_H
  9. #define KC_ITERATOR_H
  10.  
  11. #include <kc.h>
  12.  
  13. #ifdef __cplusplus
  14. extern "C"
  15. {
  16. namespace kc
  17. {
  18. using namespace std;
  19. #endif
  20.  
  21. /**
  22. * Iterator オブジェクト
  23. */
  24. typedef struct KcIterator_
  25. {
  26. /**
  27. * 次の要素の有無を取得します。
  28. *
  29. * @param ite Iterator オブジェクト
  30. * @return true/false (次の要素がある/次の要素がない)
  31. */
  32. bool (*hasNext)(struct KcIterator_ *ite);
  33.  
  34. /**
  35. * 次の要素を取得します。
  36. *
  37. * @param ite Iterator オブジェクト
  38. * @param size 取得したオブジェクトのサイズ格納用
  39. * @return 次のオブジェクト
  40. */
  41. const void *(*next)(struct KcIterator_ *ite, size_t *size);
  42.  
  43. /** 内部情報 */
  44. void *_info;
  45.  
  46. } KcIterator;
  47.  
  48. void KcIterator_delete(KcIterator *ite);
  49.  
  50. #ifdef __cplusplus
  51. } // namespace kc
  52. } // extern "C"
  53. #endif
  54. #endif // KC_ITERATOR_H