iter.h
Go to the documentation of this file.
1 #pragma once
2 
12 
13 #include <stdlib.h>
14 #include <stdbool.h>
15 #include <string.h>
16 #include <inttypes.h>
17 
18 typedef struct HAC_ITER_ft HAC_ITER_ft;
19 struct HAC_ITER_ft{
20  bool (*beginl)(void *self, HAC_ITER_ft*, void *ctr);
21  bool (*endl)(void *self, HAC_ITER_ft*, void *ctr);
22  bool (*beginr)(void *self, HAC_ITER_ft*, void *ctr);
23  bool (*endr)(void *self, HAC_ITER_ft*, void *ctr);
24  uint64_t (*position)(void *self, HAC_ITER_ft*);
25  void *(*next)(void *self, HAC_ITER_ft*);
26  void *(*prev)(void *self, HAC_ITER_ft*);
27  void *(*step)(void *self, HAC_ITER_ft*, int64_t n);
28  void *(*get)(void *self, HAC_ITER_ft*);
29  void *(*get_offset)(void *self, HAC_ITER_ft*, int64_t n);
30  bool (*set)(void *self, HAC_ITER_ft*, void *val);
31  bool (*set_offset)(void *self, HAC_ITER_ft*, int64_t n, void *val);
32  bool (*insert)(void *self, HAC_ITER_ft, void *val);
33  bool (*insert_offset)(void *self, HAC_ITER_ft, int64_t n, void *val);
34  void *(*remove)(void *self, HAC_ITER_ft*);
35  void *(*remove_offset)(void *self, HAC_ITER_ft*, int64_t n);
36  void *(*split)(void *self, HAC_ITER_ft*);
37  void *(*split_offset)(void *self, HAC_ITER_ft*, int64_t n);
38  bool (*copy)(void *self, HAC_ITER_ft*, void *other);
39  uint64_t traits;
40  void *data;
41 };
42 
43 typedef enum{
44  HAC_ITER_INPUT = 1ull << 0,
45  HAC_ITER_OUTPUT = 1ull << 1,
46  HAC_ITER_INSERT = 1ull << 2,
47  HAC_ITER_REMOVE = 1ull << 3,
48  HAC_ITER_SPLIT = 1ull << 4,
49  HAC_ITER_FORWARD = 1ull << 5,
50  HAC_ITER_REVERSE = 1ull << 6,
51  HAC_ITER_POSITION = 1ull << 7,
52  HAC_ITER_STEP = 1ull << 8,
53  HAC_ITER_OFFSET = 1ull << 9,
54  HAC_ITER_COPY = 1ull << 10
55 } HAC_ITER_TRAITS;
56