diff options
author | cvs2svn <admin@example.com> | 2010-02-14 12:53:07 +0000 |
---|---|---|
committer | cvs2svn <admin@example.com> | 2010-02-14 12:53:07 +0000 |
commit | 038a1d31955a315b5fdf8cee142623226ac3e48e (patch) | |
tree | bceeb16f00f4e73f602a56285093d897052d0063 /tools/listiter.h | |
parent | 56b10fbbe13a6eb219f41da6d8a78a37d15bd378 (diff) | |
download | xineliboutput-branch-1_o_x.tar.gz xineliboutput-branch-1_o_x.tar.bz2 |
This commit was manufactured by cvs2svn to create branch 'branch-1_o_x'.branch-1_o_x
Diffstat (limited to 'tools/listiter.h')
-rw-r--r-- | tools/listiter.h | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/tools/listiter.h b/tools/listiter.h deleted file mode 100644 index e16353cb..00000000 --- a/tools/listiter.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * listiter.h: - * - * See the main source file 'xineliboutput.c' for copyright information and - * how to reach the author. - * - * $Id: listiter.h,v 1.2 2010-02-03 13:58:05 phintuka Exp $ - * - */ - - -#ifndef _LISTITER_H_ -#define _LISTITER_H_ - -//------------------------------ list ---------------------------------------- - -template <class LIST,class ITEM, class RESULT> -void ForEach(LIST& List, RESULT (ITEM::*f)()) -{ - for(ITEM *it = List.First(); it; it = List.Next(it)) - (*it.*f)(); -} - -template <class LIST,class ITEM, class ARG1, class RESULT> -void ForEach(LIST& List, RESULT (ITEM::*f)(ARG1), ARG1 arg1) -{ - for(ITEM *it = List.First(); it; it = List.Next(it)) - (*it.*f)(arg1); -} - -template <class LIST,class ITEM, class ARG1, class ARG2> -void ForEach(LIST& List, void (ITEM::*f)(ARG1,ARG2), ARG1 arg1, ARG2 arg2) -{ - for(ITEM *it = List.First(); it; it = List.Next(it)) - (*it.*f)(arg1,arg2); -} - -template <class LIST,class ITEM, class ARG1, class RESULT> -RESULT ForEach(LIST& List, RESULT (ITEM::*f)(ARG1), ARG1 arg1, - RESULT (*combiner)(RESULT,RESULT), RESULT def) -{ - RESULT result = def; - for(ITEM *it = List.First(); it; it = List.Next(it)) - result = (*combiner)((*it.*f)(arg1),result); - return result; -} - -template <class LIST,class ITEM, class ARG1, class ARG2, class RESULT> -RESULT ForEach(LIST& List, RESULT (ITEM::*f)(ARG1,ARG2), - ARG1 arg1, ARG2 arg2, - RESULT (*combiner)(RESULT,RESULT), RESULT def) -{ - RESULT result = def; - for(ITEM *it = List.First(); it; it = List.Next(it)) - result = (*combiner)((*it.*f)(arg1,arg2),result); - return result; -} - -template <class LIST,class ITEM, class ARG1, class ARG2, class ARG3, - class RESULT> -RESULT ForEach(LIST& List, RESULT (ITEM::*f)(ARG1,ARG2,ARG3), - ARG1 arg1, ARG2 arg2, ARG3 arg3, - RESULT (*combiner)(RESULT,RESULT), RESULT def) -{ - RESULT result = def; - for(ITEM *it = List.First(); it; it = List.Next(it)) - result = (*combiner)((*it.*f)(arg1,arg2,arg3),result); - return result; -} - -template <class LIST, class ITEM, class ARG1, class ARG2, class ARG3, class ARG4, - class RESULT> - RESULT ForEach(LIST& List, RESULT (ITEM::*f)(ARG1,ARG2,ARG3,ARG4), - ARG1 arg1, ARG2 arg2, ARG3 arg3, ARG4 arg4, - RESULT (*combiner)(RESULT,RESULT), RESULT def) -{ - RESULT result = def; - for(ITEM *it = List.First(); it; it = List.Next(it)) - result = (*combiner)((*it.*f)(arg1,arg2,arg3,arg4),result); - return result; -} - -template<class T> -T mmin(T a, T b) {return a<b ? a : b;} - -template<class T> -T mmax(T a, T b) {return a>b ? a : b;} - -template<class T> -T mand(T a, T b) {return a&&b;} - -template<class T> -T mor(T a, T b) {return a||b;} - -#endif |