source: git/factory/fac_iterfor.h @ e4fe2b

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