summaryrefslogtreecommitdiff
path: root/plugins/HistoryStats/src/_langext.h
blob: c481f655679e8d95b4b3c2abdc5697b7b57ab08f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#if !defined(HISTORYSTATS_GUARD__LANGEXT_H)
#define HISTORYSTATS_GUARD__LANGEXT_H

/*
 * language "enhancements" - people will hate me for this
 */

#define bool_(c_bool) \
	((c_bool) ? true : false)

#define BOOL_(cpp_bool) \
	((cpp_bool) ? TRUE : FALSE)

#define range_each_(index_var, lo_bound, up_bound) \
	for (int index_var = (lo_bound); index_var < (up_bound); ++index_var)

#define upto_each_(index_var, up_bound) \
	range_each_(index_var, 0, (up_bound))

#define array_each_(index_var, array_var) \
	range_each_(index_var, 0, _countof(array_var))

#define vector_each_(index_var, vector_var) \
	for (size_t index_var = 0; index_var != (vector_var).size(); ++index_var)

#define iter_each_(cont_type, iter_var, cont_var) \
	for (cont_type::iterator iter_var = (cont_var).begin(); iter_var != (cont_var).end(); ++iter_var)

#define citer_each_(cont_type, iter_var, cont_var) \
	for (cont_type::const_iterator iter_var = (cont_var).begin(); iter_var != (cont_var).end(); ++iter_var)

#endif // HISTORYSTATS_GUARD__LANGEXT_H