source:
git/factory/fac_iterfor.h
@
e4fe2b
Last change on this file since e4fe2b was e4fe2b, checked in by , 12 years ago | |
---|---|
|
|
File size: 1.1 KB |
Rev | Line | |
---|---|---|
[493c477] | 1 | /* emacs edit mode for this file is -*- C++ -*- */ |
[341696] | 2 | /* $Id$ */ |
[2dd068] | 3 | |
[493c477] | 4 | #ifndef INCL_FAC_ITERFOR_H |
5 | #define INCL_FAC_ITERFOR_H | |
[2dd068] | 6 | |
[e4fe2b] | 7 | // #include "config.h" |
[b973c0] | 8 | |
[a347e8] | 9 | #ifndef NOSTREAMIO |
[1dc616] | 10 | #ifdef HAVE_IOSTREAM |
11 | #include <iostream> | |
[181148] | 12 | #define OSTREAM std::ostream |
[1dc616] | 13 | #elif defined(HAVE_IOSTREAM_H) |
[2dd068] | 14 | #include <iostream.h> |
[181148] | 15 | #define OSTREAM ostream |
[1dc616] | 16 | #endif |
[a347e8] | 17 | #endif /* NOSTREAMIO */ |
[2dd068] | 18 | |
19 | class IteratedFor | |
20 | { | |
21 | private: | |
22 | int MAX; | |
[d675c7] | 23 | int FROM; |
24 | int TO; | |
[2dd068] | 25 | int N; |
26 | bool last; | |
27 | int * index; | |
28 | int * imax; | |
29 | void fill ( int from, int n ); | |
30 | public: | |
[d675c7] | 31 | IteratedFor( int from, int to, int max ); |
[2dd068] | 32 | IteratedFor( const IteratedFor & ); |
33 | ~IteratedFor(); | |
34 | IteratedFor& operator= ( const IteratedFor & ); | |
[d675c7] | 35 | int from() const { return FROM; } |
36 | int to() const { return TO; } | |
37 | int n() const { return N; }; | |
[2dd068] | 38 | int max() const { return MAX; } |
39 | void nextiteration(); | |
40 | void operator++ () { nextiteration(); } | |
41 | void operator++ ( int ) { nextiteration(); } | |
42 | bool iterations_left() const { return ! last; } | |
43 | int operator[] ( int ) const; | |
44 | }; | |
45 | ||
[a347e8] | 46 | #ifndef NOSTREAMIO |
[181148] | 47 | OSTREAM& operator<< ( OSTREAM &, const IteratedFor & ); |
[a347e8] | 48 | #endif /* NOSTREAMIO */ |
[2dd068] | 49 | |
[493c477] | 50 | #endif /* ! INCL_FAC_ITERFOR_H */ |
Note: See TracBrowser
for help on using the repository browser.