source: git/factory/fac_iterfor.h @ 362fc67

jengelh-datetimespielwiese
Last change on this file since 362fc67 was 362fc67, checked in by Martin Lee <martinlee84@…>, 11 years ago
chg: remove $Id$
  • Property mode set to 100644
File size: 1.1 KB
Line 
1/* emacs edit mode for this file is -*- C++ -*- */
2
3#ifndef INCL_FAC_ITERFOR_H
4#define INCL_FAC_ITERFOR_H
5
6// #include "config.h"
7
8#ifndef NOSTREAMIO
9#ifdef HAVE_IOSTREAM
10#include <iostream>
11#define OSTREAM std::ostream
12#elif defined(HAVE_IOSTREAM_H)
13#include <iostream.h>
14#define OSTREAM ostream
15#endif
16#endif /* NOSTREAMIO */
17
18class IteratedFor
19{
20private:
21    int MAX;
22    int FROM;
23    int TO;
24    int N;
25    bool last;
26    int * index;
27    int * imax;
28    void fill ( int from, int n );
29public:
30    IteratedFor( int from, int to, int max );
31    IteratedFor( const IteratedFor & );
32    ~IteratedFor();
33    IteratedFor& operator= ( const IteratedFor & );
34    int from() const { return FROM; }
35    int to() const { return TO; }
36    int n() const { return N; };
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
45#ifndef NOSTREAMIO
46OSTREAM& operator<< ( OSTREAM &, const IteratedFor & );
47#endif /* NOSTREAMIO */
48
49#endif /* ! INCL_FAC_ITERFOR_H */
Note: See TracBrowser for help on using the repository browser.