Skip to content

Commit ad0891c

Browse files
committed
refactoring iterator.
1 parent 467965b commit ad0891c

File tree

9 files changed

+5039
-185
lines changed

9 files changed

+5039
-185
lines changed

config.log

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,3 +818,21 @@ target_alias=''
818818
#define HAVE_MALLOC 1
819819

820820
configure: exit 0
821+
822+
## ---------------------- ##
823+
## Running config.status. ##
824+
## ---------------------- ##
825+
826+
This file was extended by libcstl config.status 2.0.2, which was
827+
generated by GNU Autoconf 2.66. Invocation command line was
828+
829+
CONFIG_FILES =
830+
CONFIG_HEADERS =
831+
CONFIG_LINKS =
832+
CONFIG_COMMANDS =
833+
$ ./config.status test/ut/Makefile depfiles
834+
835+
on ActiveSys
836+
837+
config.status:1077: creating test/ut/Makefile
838+
config.status:1305: executing depfiles commands

cstl/cstl_iterator.h

Lines changed: 110 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -36,49 +36,135 @@ extern "C" {
3636
/** exported global variable declaration section **/
3737

3838
/** exported function prototype section **/
39-
/* the handler of iterator */
40-
/*
41-
* Get and set value.
39+
/**
40+
* Get value that pointed by iterator.
41+
* @param it_iter iterator.
42+
* @param pv_value value.
43+
* @return void
44+
* @remakes it_iter must be valid and pv_value != NULL, otherwise the behavior is undefined.
45+
*/
46+
extern void iterator_get_value(iterator_t it_iter, void* pv_value);
47+
48+
/**
49+
* Set value that pointed by iterator.
50+
* @param it_iter iterator.
51+
* @param cpv_value value.
52+
* @return void
53+
* @remakes it_iter must be valid and cpv_value != NULL, otherwise the behavior is undefined.
4254
*/
43-
extern void iterator_get_value(iterator_t t_iter, void* pv_value);
44-
extern void iterator_set_value(iterator_t t_iter, const void* cpv_value);
45-
extern const void* iterator_get_pointer(iterator_t t_iter);
55+
extern void iterator_set_value(iterator_t it_iter, const void* cpv_value);
4656

47-
/*
48-
* Move iterator.
57+
/**
58+
* Get pointer that pointed by iterator.
59+
* @param it_iter iterator.
60+
* @return pointer
61+
* @remakes it_iter must be valid and must be not end(), otherwise the behavior is undefined.
4962
*/
50-
extern iterator_t iterator_next(iterator_t t_iter);
51-
extern iterator_t iterator_prev(iterator_t t_iter);
52-
extern iterator_t iterator_next_n(iterator_t t_iter, int n_step);
53-
extern iterator_t iterator_prev_n(iterator_t t_iter, int n_step);
63+
extern const void* iterator_get_pointer(iterator_t it_iter);
5464

55-
/*
56-
* Relationship operator functions.
65+
/**
66+
* Move iterator to next position.
67+
* @param it_iter iterator.
68+
* @return next position.
69+
* @remakes it_iter must be valid and must be not end(), otherwise the behavior is undefined.
70+
*/
71+
extern iterator_t iterator_next(iterator_t it_iter);
72+
73+
/**
74+
* Move iterator to previous position.
75+
* @param it_iter iterator.
76+
* @return previous position.
77+
* @remakes it_iter must be valid and must be not end(), otherwise the behavior is undefined.
78+
*/
79+
extern iterator_t iterator_prev(iterator_t it_iter);
80+
81+
/**
82+
* Move iterator to next n position.
83+
* @param it_iter iterator.
84+
* @return next n position.
85+
* @remakes it_iter must be valid and must be not end(), otherwise the behavior is undefined.
86+
*/
87+
extern iterator_t iterator_next_n(iterator_t it_iter, int n_step);
88+
89+
/**
90+
* Move iterator to prev n position.
91+
* @param it_iter iterator.
92+
* @return prev n position.
93+
* @remakes it_iter must be valid and must be not end(), otherwise the behavior is undefined.
94+
*/
95+
extern iterator_t iterator_prev_n(iterator_t it_iter, int n_step);
96+
97+
/**
98+
* Test two iterator are equal or not.
99+
* @param it_first first iterator.
100+
* @param it_second second iterator.
101+
* @return whether equal or not.
102+
* @remakes two iterator must be valid, otherwise the behavior is undefined.
103+
*/
104+
extern bool_t iterator_equal(iterator_t it_first, iterator_t it_second);
105+
106+
/**
107+
* Test two iterator are equal or not.
108+
* @param it_first first iterator.
109+
* @param it_second second iterator.
110+
* @return whether equal or not.
111+
* @remakes two iterator must be valid, otherwise the behavior is undefined.
112+
*/
113+
extern bool_t iterator_not_equal(iterator_t it_first, iterator_t it_second);
114+
115+
/**
116+
* Test first iterator is less than second iterator.
117+
* @param it_first first iterator.
118+
* @param it_second second iterator.
119+
* @return whether first iterator less than second iterator or not.
120+
* @remakes two iterator must be valid, otherwise the behavior is undefined.
121+
*/
122+
extern bool_t iterator_less(iterator_t it_first, iterator_t it_second);
123+
124+
/**
125+
* Test first iterator is less than or equal to second iterator.
126+
* @param it_first first iterator.
127+
* @param it_second second iterator.
128+
* @return whether first iterator less than or equal to second iterator or not.
129+
* @remakes two iterator must be valid, otherwise the behavior is undefined.
130+
*/
131+
extern bool_t iterator_less_equal(iterator_t it_first, iterator_t it_second);
132+
133+
/**
134+
* Test first iterator is greater than second iterator.
135+
* @param it_first first iterator.
136+
* @param it_second second iterator.
137+
* @return whether first iterator greater than second iterator or not.
138+
* @remakes two iterator must be valid, otherwise the behavior is undefined.
139+
*/
140+
extern bool_t iterator_greater(iterator_t it_first, iterator_t it_second);
141+
142+
/**
143+
* Test first iterator is greater than or equal to second iterator.
144+
* @param it_first first iterator.
145+
* @param it_second second iterator.
146+
* @return whether first iterator greater than or equal to second iterator or not.
147+
* @remakes two iterator must be valid, otherwise the behavior is undefined.
57148
*/
58-
extern bool_t iterator_equal(iterator_t t_iterfirst, iterator_t t_itersecond);
59-
extern bool_t iterator_not_equal(iterator_t t_iterfirst, iterator_t t_itersecond);
60-
extern bool_t iterator_less(iterator_t t_iterfirst, iterator_t t_itersecond);
61-
extern bool_t iterator_less_equal(iterator_t t_iterfirst, iterator_t t_itersecond);
62-
extern bool_t iterator_greater(iterator_t t_iterfirst, iterator_t t_itersecond);
63-
extern bool_t iterator_greater_equal(iterator_t t_iterfirst, iterator_t t_itersecond);
149+
extern bool_t iterator_greater_equal(iterator_t it_first, iterator_t it_second);
64150

65151
/*
66152
* Element random access.
67153
*/
68-
extern void* iterator_at(iterator_t t_iter, int n_index);
154+
extern void* iterator_at(iterator_t it_iter, int n_index);
69155

70156

71157
/*
72158
* Distance.
73159
*/
74-
extern int iterator_minus(iterator_t t_iterfirst, iterator_t t_itersecond);
160+
extern int iterator_minus(iterator_t it_first, iterator_t it_second);
75161

76162
/* the iterator auxilary function */
77163
/*
78164
* Advance and distance.
79165
*/
80-
extern iterator_t iterator_advance(iterator_t t_iter, int n_step);
81-
extern int iterator_distance(iterator_t t_iterfirst, iterator_t t_itersecond);
166+
extern iterator_t iterator_advance(iterator_t it_iter, int n_step);
167+
extern int iterator_distance(iterator_t it_first, iterator_t it_second);
82168

83169
#ifdef __cplusplus
84170
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy