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